Summary: | Item "delete signature" missing from context menu for more than one signature | ||
---|---|---|---|
Product: | [Applications] kgpg | Reporter: | Oliver Klee <dev+kde> |
Component: | general | Assignee: | bj |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
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 14:46:16 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; |