Version: 1.1.2 (using KDE 3.2.1, SuSE) Compiler: gcc version 3.3.3 (SuSE Linux) OS: Linux (i686) release 2.6.5-7.104-default I have configured two lines of encrypt-to in my ~/.gnupg/gpg.conf with different key IDs because I want outgoing mail also encrypted with both those pub keys. Whenever I save any settings in kgpg->settings->configure kgpg, it overwrites all my encrypt-to lines with the one-only-configurable ID ->encryption->always encrypt with, screwing my configuration. Turing ->always-encrypt-with off doesn't help, kgpg then kindly wipes all my encrypt-to lines altogether. Not good :(
SVN commit 450249 by mardelle: Allow multiple keys for encrypt-to config option CCMAIL:87293-done@bugs.kde.org M +29 -0 kgpginterface.cpp M +1 -0 kgpginterface.h M +2 -3 kgpgoptions.cpp M +1 -1 listkeys.cpp --- branches/KDE/3.5/kdeutils/kgpg/kgpginterface.cpp #450248:450249 @@ -1847,6 +1847,35 @@ return QString::null; } +QString KgpgInterface::getGpgMultiSetting(QString name,QString configFile) +{ +// get GnuPG setting for item that can have multiple entries (eg. encrypt-to) + +QString parsedResult=QString::null; + + name=name.stripWhiteSpace()+" "; + QFile qfile(QFile::encodeName(configFile)); + if (qfile.open(IO_ReadOnly) && (qfile.exists())) { + QString result; + QTextStream t( &qfile ); + result=t.readLine(); + while (result!=NULL) { + if (result.stripWhiteSpace().startsWith(name)) { + result=result.stripWhiteSpace(); + result.remove(0,name.length()); + if (parsedResult!=QString::null) + parsedResult+=" "+result.stripWhiteSpace(); + else + parsedResult+=result.stripWhiteSpace(); + //return result.section(" ",0,0); + } + result=t.readLine(); + } + qfile.close(); + } + return parsedResult; +} + void KgpgInterface::delGpgGroup(QString name, QString configFile) { QString textToWrite; --- branches/KDE/3.5/kdeutils/kgpg/kgpginterface.h #450248:450249 @@ -151,6 +151,7 @@ void KgpgSignText(QString text,QString userIDs, QStringList Options); static QString getGpgSetting(QString name,QString configFile); + static QString getGpgMultiSetting(QString name,QString configFile); static void setGpgSetting(QString name,QString ID,QString url); static bool getGpgBoolSetting(QString name,QString configFile); static void setGpgBoolSetting(QString name,bool enable,QString url); --- branches/KDE/3.5/kdeutils/kgpg/kgpgoptions.cpp #450248:450249 @@ -158,7 +158,7 @@ { QString signKeyID; ///// open key selection dialog - KgpgSelKey *opts=new KgpgSelKey(this,0,false,page1->alwaysKey->text()); + KgpgSelKey *opts=new KgpgSelKey(this,0,true,page1->alwaysKey->text()); if (opts->exec()==QDialog::Accepted) { page1->alwaysKey->setText(opts->getkeyID()); @@ -212,12 +212,11 @@ page4->gpg_home_path->setText(KURL(gpgConfigPath).directory(false)); // fill some values from kgpg's config file - page1->alwaysKey->setText(KgpgInterface::getGpgSetting("encrypt-to", gpgConfigPath)); useAgent = KgpgInterface::getGpgBoolSetting("use-agent", gpgConfigPath); defaultUseAgent = false; - page1->alwaysKey->setText(KgpgInterface::getGpgSetting("encrypt-to", gpgConfigPath)); + page1->alwaysKey->setText(KgpgInterface::getGpgMultiSetting("encrypt-to", gpgConfigPath)); alwaysKeyID = page1->alwaysKey->text(); page4->use_agent->setChecked( useAgent ); --- branches/KDE/3.5/kdeutils/kgpg/listkeys.cpp #450248:450249 @@ -369,7 +369,7 @@ for ( item = list.first(); item; item = list.next() ) { result.append(item->text(2)); - if (item!=list.getLast()) result.append(", "); + if (item!=list.getLast()) result.append(" "); } return(result); }