Bug 74873 - wish: "download unknown keys" menu option when [User-ID not found] is shown
Summary: wish: "download unknown keys" menu option when [User-ID not found] is shown
Status: RESOLVED FIXED
Alias: None
Product: kgpg
Classification: Applications
Component: general (show other bugs)
Version: 1.1
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: bj
URL:
Keywords:
: 78993 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-02-10 21:08 UTC by Jens
Modified: 2007-08-14 08:31 UTC (History)
3 users (show)

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 Jens 2004-02-10 21:08:37 UTC
Version:           1.1 (using KDE 3.2.0,  (testing/unstable))
Compiler:          gcc version 3.3.3 20040110 (prerelease) (Debian)
OS:          Linux (i686) release 2.4.22b-w4l-p4

I just imported my key from another machine which has been signed by a couple dozen people. Which now all show up as "unkonwn" (User ID not found).

I would like a context menu item on all keys, that says "download/refresh this key", and perhaps a menu item "download unknown keys", so that you can refresh your whole database at once.

This wish might be related to Bug #67094.
Comment 1 bj 2004-02-10 23:52:11 UTC
Hi!

If i understand correctly, the feature you are requesting already exists, 
although I now realize it should probably be renamed.

Right click on a key, choose "import missing signatures from keyserver", and 
all unknown signing keys will be downloaded.
Comment 2 Jens 2004-02-14 13:22:51 UTC
Hi,

thanks for your reply!

yes, but if I click on that menu option in the context menu the "[Key ID not found]" keys just stay the same, and KGpg claims it has already downloaded all unknown keys (which is obviously wrong).

Comment 3 bj 2004-02-15 12:48:24 UTC
Hi!

> yes, but if I click on that menu option in the context menu the "[Key ID
> not found]" keys just stay the same, and KGpg claims it has already
> downloaded all unknown keys (which is obviously wrong).

The "import missing signatures from keyserver" option should download only 
unknown keys used to sign the selected key. If this does not work, try right 
clicking on one of the [user id not found] item and choose "import key from 
keyserver". This should open the key import dialog. What does it tell you 
then ?

Downloading all unknown keys from your keyring is not yet implemented.


Comment 4 Jens 2004-02-15 12:56:51 UTC
Am Sonntag, 15. Februar 2004 12:48 schrieb bj@altern.org:

> try right clicking on one of the [user id not found] item and choose
> "import key from keyserver". This should open the key import dialog.
> What does it tell you then ?

Nothing. That menu option is disabled. I think that's why I missed it. I 
only have one choice ("delete signature") when I right-click on an unknown 
key.

> Downloading all unknown keys from your keyring is not yet implemented.

Oh. Pity. :(
Can gnupg (command line) do it?


Comment 5 bj 2004-02-15 13:36:05 UTC
> Nothing. That menu option is disabled. I think that's why I missed it. I
> only have one choice ("delete signature") when I right-click on an unknown
> key.

Hmm. I see, there is at least a bug. KGpg waits for the string: "User id not 
found", but if you are using a non english locale, the string will be 
translated by gpg and KGpg will not recognised the key as unknown. I will 
work on that issue to try to find a better way of detecting unknown keys.

> > Downloading all unknown keys from your keyring is not yet implemented.
>
> Oh. Pity. :(
> Can gnupg (command line) do it?

Don't know, will look at it later.
Comment 6 Marcin Juszkiewicz 2007-01-15 13:52:38 UTC
Any work done on it? It is *VERY* annoying to import key by key by hand.. Each time I have to:

- select key, 
- expand it (twice),
- select another 'user id not found', 
- open context menu, 
- select 'import key from keyserver'
- wait

and then another key and another...

Ofcourse option 'fetch all missing keys' == 'all keys are already present in keyring' message ;(
Comment 7 Bram Schoenmakers 2007-05-22 19:46:49 UTC
*** Bug 78993 has been marked as a duplicate of this bug. ***
Comment 8 Rolf Eike Beer 2007-08-14 08:30:56 UTC
SVN commit 699871 by dakon:

Improve popup menus

-"Generate key pair" should not show up in any popup menu
-importing of several missing signatures at once works now

FEATURE:74873
BUG:104825
GUI


 M  +38 -18    keysmanager.cpp  
 M  +2 -1      keysmanager.h  


--- trunk/KDE/kdeutils/kgpg/keysmanager.cpp #699870:699871
@@ -272,9 +272,9 @@
     deletePhoto->setIcon(KIcon("delete"));
     deletePhoto->setText(i18n("&Delete Photo"));
     connect(deletePhoto, SIGNAL(triggered(bool)), SLOT(slotDeletePhoto()));
-    QAction *delSignKey = actionCollection()->addAction("key_delsign");
+    delSignKey = actionCollection()->addAction("key_delsign");
     delSignKey->setIcon(KIcon("edit-delete"));
-    delSignKey->setText(i18n("Delete Sign&ature"));
+    delSignKey->setText(i18n("Delete sign&ature(s)"));
     connect(delSignKey, SIGNAL(triggered(bool)), SLOT(delsignkey()));
 
     importAllSignKeys = actionCollection()->addAction("key_importallsign");
@@ -291,7 +291,7 @@
     connect(signKey, SIGNAL(triggered(bool)), SLOT(signkey()));
     importSignatureKey = actionCollection()->addAction("key_importsign");
     importSignatureKey->setIcon(KIcon("network-wired"));
-    importSignatureKey->setText(i18n("Import Key From Keyserver"));
+    importSignatureKey->setText(i18n("Import key(s) from keyserver"));
     connect(importSignatureKey, SIGNAL(triggered(bool)), SLOT(preimportsignkey()));
 
     sTrust = actionCollection()->add<KToggleAction>("show_trust");
@@ -356,7 +356,6 @@
 
     m_popupout = new KMenu();
     m_popupout->addAction(importKey);
-    m_popupout->addAction(generateKey);
 
     m_popupsig = new KMenu();
     m_popupsig->addAction(importSignatureKey);
@@ -1283,8 +1282,8 @@
 
 bool KeysManager::isSignatureUnknown(KeyListViewItem *item)
 {
-	Q_ASSERT(isSignature(item));
-
+	if (!isSignature(item))
+		return false;
 	// ugly hack to detect unknown keys
 	return (item->text(0).startsWith("[") && item->text(0).endsWith("]"));
 }
@@ -1300,12 +1299,26 @@
         {
             QList<KeyListViewItem*> exportList = keysList2->selectedItems();
             bool keyDepth = true;
+            bool allunksig = true;
+            bool allsig = true;
+
             for (int i = 0; i < exportList.count(); ++i)
                 if (exportList.at(i))
-                    if (exportList.at(i)->depth() != 0)
+                    if (exportList.at(i)->depth() != 0) {
                         keyDepth = false;
+                        allsig &= isSignature(exportList.at(i));
+                        allunksig &= isSignatureUnknown(exportList.at(i));
+                    } else {
+                      allunksig = false;
+                      allsig = false;
+                    }
 
-            if (!keyDepth)
+            if (allsig) {
+                importSignatureKey->setEnabled(allunksig);
+                delSignKey->setEnabled(false);
+                m_popupsig->exec(pos);
+                return;
+            } else if (!keyDepth)
             {
                 signKey->setEnabled(false);
                 refreshKey->setEnabled(false);
@@ -1330,6 +1343,7 @@
                         importSignatureKey->setEnabled(true);
                     else
                         importSignatureKey->setEnabled(false);
+                    delSignKey->setEnabled(true);
                     m_popupsig->exec(pos);
                     return;
                 }
@@ -1946,27 +1960,33 @@
         keysList2->currentItem()->setOpen(false);
     }
 
-    QString missingKeysList;
+    QStringList missingKeys;
     KeyListViewItem *current = keysList2->currentItem()->firstChild();
     while (current)
     {
         if (isSignatureUnknown(current))
-            missingKeysList += current->text(6) + ' ';
+            missingKeys << current->text(6);
         current = current->nextSibling();
     }
 
-    if (!missingKeysList.isEmpty())
-        importsignkey(missingKeysList);
+    if (!missingKeys.isEmpty())
+        importsignkey(missingKeys);
     else
         KMessageBox::information(this, i18n("All signatures for this key are already in your keyring"));
 }
 
 void KeysManager::preimportsignkey()
 {
-    if (keysList2->currentItem() == NULL)
-        return;
-    else
-        importsignkey(keysList2->currentItem()->text(6));
+    QList<KeyListViewItem*> exportList = keysList2->selectedItems();
+    QStringList idlist;
+
+    if (exportList.empty())
+      return;
+
+    for (int i = 0; i < exportList.count(); ++i)
+      idlist << exportList.at(i)->text(6);
+
+    importsignkey(idlist);
 }
 
 bool KeysManager::importRemoteKey(const QString &keyID)
@@ -2002,11 +2022,11 @@
     refreshkey();
 }
 
-void KeysManager::importsignkey(const QString &importKeyId)
+void KeysManager::importsignkey(const QStringList &importKeyId)
 {
     // sign a key
     kServer = new KeyServer(0, false);
-    kServer->slotSetText(importKeyId);
+    kServer->slotSetText(importKeyId.join(" "));
     //kServer->Buttonimport->setDefault(true);
     kServer->slotImport();
     //kServer->show();
--- trunk/KDE/kdeutils/kgpg/keysmanager.h #699870:699871
@@ -161,7 +161,7 @@
     void signkey();
     void delsignkey();
     void preimportsignkey();
-    void importsignkey(const QString &importKeyId);
+    void importsignkey(const QStringList &importKeyId);
     void importallsignkey();
     void importfinished();
     void signatureResult(int success, KgpgInterface*);
@@ -222,6 +222,7 @@
     QAction *signKey;
     QAction *refreshKey;
     QAction *setPrimUid;
+    QAction *delSignKey;
 
     KeyServer *kServer;
     groupEdit *gEdit;