Bug 104814

Summary: Menu item for downloading missing signatures should be disabled if all signatures are present
Product: [Applications] kgpg Reporter: Oliver Klee <dev+kde>
Component: generalAssignee: bj
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 1.2   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Oliver Klee 2005-04-30 13:31:59 UTC
Version:           1.2 (using KDE KDE 3.3.2)
Installed from:    Debian testing/unstable Packages

Steps to reproduce:
1. Right-click on a key that has no missing signatures.
2. Have a look at the context menu.

Expected result:
The menu item "Import missing signatures from key server" is disabled.

Actual result:
The menu item "Import missing signatures from key server" is enabled. Clicking on it pops up an alert saying that all signatures are already in the key ring.

This should be changed following the usability principle: "Disable all GUI elements that don't lead to an action (e.g. Paste when the clipboard is empty)."
Comment 1 Rolf Eike Beer 2007-08-27 10:40:01 UTC
SVN commit 705127 by dakon:

Deactivate "import missing signatures" when we already know to have all

Be careful: we don't "know" if the key has never been expanded before. Only 
key expansion loads all the signatures and will take several seconds on a 
big keyring. Therefore unexpanded keys will lead the item always to be visible 
(behaviour like before).

BUG:104814


 M  +20 -0     keysmanager.cpp  


--- trunk/KDE/kdeutils/kgpg/keysmanager.cpp #705126:705127
@@ -1366,7 +1366,27 @@
             else
             {
                 QList<KeyListViewItem*> exportList = keysList2->selectedItems();
+                bool unksig = false;
 
+                // find out if an item has unknown signatures. Only check if the item has been
+                // expanded before as expansion is very expensive and can take several seconds
+                // that will freeze the UI meanwhile.
+                for (int i = 0; i < exportList.count(); i++) {
+                   KeyListViewItem *k = exportList.at(i);
+                   QStringList l;
+
+                   if (k->firstChild() == NULL) {
+                      unksig = true;
+                      break;
+                   }
+                   getMissingSigs(&l, k);
+                   if (!l.isEmpty()) {
+                      unksig = true;
+                      break;
+                   }
+                }
+                importAllSignKeys->setEnabled(unksig);
+
                 if (((sel->itemType() & KeyListViewItem::Pair) == KeyListViewItem::Pair) && (exportList.count() == 1))
                     m_popupsec->exec(pos);
                 else