Bug 114303 - Enhancement: Allow --export-options export-minimal option in export key dialog
Summary: Enhancement: Allow --export-options export-minimal option in export key dialog
Status: RESOLVED FIXED
Alias: None
Product: kgpg
Classification: Applications
Component: general (show other bugs)
Version: 1.2.1
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: bj
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-12 23:21 UTC by Unknown
Modified: 2007-08-15 11:59 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Unknown 2005-10-12 23:21:51 UTC
Version:           1.2.1 (using KDE 3.4.2, Gentoo)
Compiler:          gcc version 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)
OS:                Linux (i686) release 2.6.13-gentoo-r3

New services such as the PGP Global Directory, request that "stripped" keys be uploaded. That is the base user public key minus any signatures, photos, etc. This entails using the gpg --armor --export-options export-minimal --export keyname. The current export key dialog DOES allow for including or excluding photos (--export-options export-attributes). This additional checkbox would be a nice addition to make exporting through kgpg more complete and versatile. Should be a minor adjustment to the screen and to the dialog. I recommend the default checkbox state look like this:

default ON: Export All Signatures. (no-export-minimal)

Unchecked would change the export option to export-minimal.

In keyexport.ui, this block could contain the addition for minimal:
    <grid>
        <property name="name">
            <cstring>unnamed</cstring>
        </property>
        <property name="margin">
            <number>0</number>
        </property>
        <widget class="QCheckBox" row="1" column="0">
            <property name="name">
                <cstring>exportAttributes</cstring>
            </property>
            <property name="text">
                <string>Export attributes (photo id)</string>
            </property>
            <property name="checked">
                <bool>true</bool>
            </property>

Then in keyservers.cpp, this block could be modified to include no-export-minimal as default behavior unless the checkbox to include all signatures is UNchecked.

void keyServer::slotExport(QString keyId)
{
        if (page->kCBexportks->currentText().isEmpty())
                return;
        readmessage=QString::null;
        exportproc=new KProcIO();
        QString keyserv=page->kCBexportks->currentText();

        *exportproc<<"gpg";
	if (!page->exportAttributes->isChecked())
                *exportproc<<"--export-options"<<"no-include-attributes";

JM2C. HTH
Comment 1 Unknown 2005-10-13 14:48:08 UTC
I should correct myself. The PGP Global Directory does NOT require stripped keys. Its server will strip any extra signatures not in ITS database. However, certain key-signing party methods, such as the Sassaman-Zimmerman method http://sion.quickie.net/keysigning.txt do suggest sending stipped keys to cut down on size and unnecessary clutter.
Comment 2 Rolf Eike Beer 2007-08-15 11:59:38 UTC
SVN commit 700349 by dakon:

Improve and fix key exporting

-allow exporting not only to default keyserver, but to any in the config list
-key may also exported as minimal key (e.g. for keysigning parties)
FEATURE:114303
-exporting to local files did not work (gpg doesn't understand file://)

GUI


 M  +7 -3      keyexport.cpp  
 M  +1 -2      keyexport.h  
 M  +38 -12    keyexport.ui  
 M  +1 -1      keylistview.cpp  
 M  +14 -4     keyservers.cpp  
 M  +3 -1      keyservers.h  
 M  +24 -11    keysmanager.cpp  
 M  +3 -3      kgpginterface.cpp  
 M  +1 -1      kgpginterface.h  


--- trunk/KDE/kdeutils/kgpg/keyexport.cpp #700348:700349
@@ -18,15 +18,19 @@
 
 #include "keyexport.h"
 
-KeyExport::KeyExport( QWidget* parent )
+KeyExport::KeyExport( QWidget* parent, const QStringList *keyservers )
     : QWidget( parent ), Ui_KeyExport()
 {
-    setupUi( this );
-    connect(checkFile, SIGNAL(toggled(bool)), this,SLOT(checkFile_toggled(bool)));
+	setupUi( this );
+	connect(checkFile, SIGNAL(toggled(bool)), this,SLOT(checkFile_toggled(bool)));
+
+	if (keyservers != NULL)
+		destServer->addItems(*keyservers);
 }
 
 void KeyExport::checkFile_toggled( bool isOn)
 {
     newFilename->setEnabled(isOn);
 }
+
 #include "keyexport.moc"
--- trunk/KDE/kdeutils/kgpg/keyexport.h #700348:700349
@@ -27,8 +27,7 @@
     Q_OBJECT
 
 public:
-    KeyExport( QWidget* parent = 0 );
-    
+    KeyExport( QWidget* parent = 0, const QStringList *keyservers = 0 );
 
 public slots:
    virtual void checkFile_toggled(bool);
--- trunk/KDE/kdeutils/kgpg/keyexport.ui #700348:700349
@@ -45,16 +45,12 @@
       <item>
        <widget class="QRadioButton" name="checkServer" >
         <property name="text" >
-         <string>Default key server</string>
+         <string>Key server</string>
         </property>
        </widget>
       </item>
       <item>
-       <widget class="KUrlRequester" name="newFilename" >
-        <property name="enabled" >
-         <bool>true</bool>
-        </property>
-       </widget>
+       <widget class="QComboBox" name="destServer" />
       </item>
       <item>
        <widget class="QRadioButton" name="checkFile" >
@@ -66,17 +62,47 @@
         </property>
        </widget>
       </item>
+      <item>
+       <widget class="KUrlRequester" name="newFilename" >
+        <property name="enabled" >
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
    <item>
-    <widget class="QCheckBox" name="exportAttributes" >
-     <property name="text" >
-      <string>Export attributes (photo id)</string>
+    <widget class="Q3ButtonGroup" name="buttonGroup3" >
+     <property name="title" >
+      <string>Export settings</string>
      </property>
-     <property name="checked" >
-      <bool>true</bool>
-     </property>
+     <layout class="QVBoxLayout" >
+      <item>
+       <widget class="QRadioButton" name="checkAttrAll" >
+        <property name="text" >
+         <string>Export everything</string>
+        </property>
+        <property name="checked" >
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QRadioButton" name="checkAttrPhoto" >
+        <property name="text" >
+         <string>Do not export attributes (photo ids)</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QRadioButton" name="checkAttrClean" >
+        <property name="text" >
+         <string>Clean key</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
     </widget>
    </item>
    <item>
--- trunk/KDE/kdeutils/kgpg/keylistview.cpp #700348:700349
@@ -325,7 +325,7 @@
 		return;
 
     KgpgInterface *interface = new KgpgInterface();
-    QString keytxt = interface->getKeys(true, true, QStringList(keyid));
+    QString keytxt = interface->getKeys(true, NULL, QStringList(keyid));
     delete interface;
 
     Q3DragObject *d = new Q3TextDrag(keytxt, this);
--- trunk/KDE/kdeutils/kgpg/keyservers.cpp #700348:700349
@@ -322,8 +322,10 @@
     m_readmessage.clear();
     QStringList *args = new QStringList();
 
-    if (!page->exportAttributes->isChecked())
-        *args << "--export-options" << "no-include-attributes";
+    if (expattr != QString())
+        *args << "--export-options" << expattr;
+    else if (!page->exportAttributes->isChecked())
+        *args << "--export-options" << "no-export-attributes";
 
     *args << "--send-keys" << keyId;
 
@@ -509,9 +511,12 @@
     page->Buttonsearch->setEnabled(!text.isEmpty());
 }
 
-void KeyServer::slotSetExportAttribute(const bool &state)
+void KeyServer::slotSetExportAttribute(const QString *state)
 {
-    page->exportAttributes->setChecked(state);
+	if (state != NULL)
+		expattr = QString(*state);
+	else
+		expattr = QString();
 }
 
 void KeyServer::slotEnableProxyI(const bool &on)
@@ -635,4 +640,9 @@
 	return gp;
 }
 
+void KeyServer::slotSetKeyserver(const QString &server)
+{
+	page->kCBimportks->setCurrentText(server);
+}
+
 #include "keyservers.moc"
--- trunk/KDE/kdeutils/kgpg/keyservers.h #700348:700349
@@ -69,9 +69,10 @@
     void slotAbortSearch();
     void slotSetText(const QString &text);
     void slotTextChanged(const QString &text);
-    void slotSetExportAttribute(const bool &state);
+    void slotSetExportAttribute(const QString *attr);
     void slotEnableProxyI(const bool &on);
     void slotEnableProxyE(const bool &on);
+    void slotSetKeyserver(const QString &server);
 
     void transferKeyID();
     void slotPreImport();
@@ -108,6 +109,7 @@
     uint m_keynumbers;
     bool m_cycle;
     bool m_autoclosewindow;
+    QString expattr;
 
     K3ProcIO *createGPGProc(QStringList *keys);
 };
--- trunk/KDE/kdeutils/kgpg/keysmanager.cpp #700348:700349
@@ -1516,7 +1516,16 @@
     dial->setDefaultButton( KDialog::Ok );
     dial->setModal( true );
 
-    KeyExport *page = new KeyExport(dial);
+    KConfig *m_config = new KConfig("kgpgrc", KConfig::OnlyLocal);
+    KConfigGroup gr = m_config->group("Servers");
+    QString servers = gr.readEntry("Server_List");
+    delete m_config;
+
+    QStringList *serverList = new QStringList(servers.split(","));
+
+    KeyExport *page = new KeyExport(dial, serverList);
+    delete serverList;
+
     dial->setMainWidget(page);
     page->newFilename->setUrl(sname);
     page->newFilename->setWindowTitle(i18n("Save File"));
@@ -1526,23 +1535,26 @@
     if (dial->exec() == QDialog::Accepted)
     {
         // export to file
-        QString expname;
-        bool exportAttr = page->exportAttributes->isChecked();
+        QString *exportAttr;
+
+	if (page->checkAttrAll->isChecked())
+		exportAttr = NULL;
+	else if (page->checkAttrPhoto->isChecked())
+		exportAttr = new QString("no-export-attributes");
+	else
+		exportAttr = new QString("export-minimal");
         if (page->checkServer->isChecked())
         {
             KeyServer *expServer = new KeyServer(0, false);
             expServer->slotSetExportAttribute(exportAttr);
+            expServer->slotSetKeyserver(page->destServer->currentText());
 
-		QString exportKeysList;
-		for (QStringList::ConstIterator it = klist.begin(); it != klist.end(); it++)
-			exportKeysList.append(' ' + QString(*it));
-                expServer->slotExport(exportKeysList);
-                return;
+            expServer->slotExport(klist.join(" "));
         }
         else
         if (page->checkFile->isChecked())
         {
-            expname = page->newFilename->url().url().simplified();
+            QString expname = page->newFilename->url().path().simplified();
             if (!expname.isEmpty())
             {
                 QFile fgpg(expname);
@@ -1553,8 +1565,8 @@
                 p << KGpgSettings::gpgBinaryPath() << "--no-tty";
 
                 p << "--output" << expname << "--export" << "--armor";
-                if (!exportAttr)
-                    p << "--export-options" << "no-include-attributes";
+                if (exportAttr != NULL)
+                    p << "--export-options" << *exportAttr;
 
                 p << klist;
 
@@ -1577,6 +1589,7 @@
             else
                 slotProcessExportMail(result);
         }
+        delete exportAttr;
     }
 
     delete dial;
--- trunk/KDE/kdeutils/kgpg/kgpginterface.cpp #700348:700349
@@ -933,7 +933,7 @@
     p->ackRead();
 }
 
-QString KgpgInterface::getKeys(const bool &block, const bool &attributes, const QStringList &ids)
+QString KgpgInterface::getKeys(const bool &block, const QString *attributes, const QStringList &ids)
 {
     m_partialline.clear();
     m_ispartial = false;
@@ -943,8 +943,8 @@
     process->setParent(this);
     *process << "--export" << "--armor";
 
-    if (!attributes)
-        *process << "--export-options" << "no-include-attributes";
+    if (attributes)
+	*process << "--export-options" << *attributes;
 
     for (QStringList::ConstIterator it = ids.begin(); it != ids.end(); ++it)
         *process << *it;
--- trunk/KDE/kdeutils/kgpg/kgpginterface.h #700348:700349
@@ -136,7 +136,7 @@
     void getKeysFinished(QString, KgpgInterface*);
 
 public slots:
-    QString getKeys(const bool &block = false, const bool &attributes = true, const QStringList &ids = QStringList());
+    QString getKeys(const bool &block = false, const QString *attributes = NULL, const QStringList &ids = QStringList());
 
 private slots:
     void getKeysProcess(K3ProcIO *p);