| Summary: | Double-clicking on a signature should jump to the corresponding key | ||
|---|---|---|---|
| Product: | [Applications] kgpg | Reporter: | Oliver Klee <dev+kde> |
| Component: | general | Assignee: | bj |
| Status: | RESOLVED FIXED | ||
| Severity: | wishlist | ||
| Priority: | NOR | ||
| Version First Reported In: | 1.2 | ||
| Target Milestone: | --- | ||
| Platform: | Debian testing | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Oliver Klee
2005-04-30 15:26:54 UTC
SVN commit 701575 by dakon:
Implement "double click on signature jumps to key"
FEATURE:104829
M +42 -24 keylistview.cpp
M +3 -1 keylistview.h
M +15 -5 keysmanager.cpp
--- trunk/KDE/kdeutils/kgpg/keylistview.cpp #701574:701575
@@ -37,6 +37,7 @@
m_exp = isexpired;
m_type = type;
m_key = NULL;
+ m_sig = NULL;
setText(0, name);
setText(1, email);
setText(2, trust);
@@ -53,6 +54,7 @@
m_exp = isexpired;
m_type = type;
m_key = NULL;
+ m_sig = NULL;
setText(0, name);
setText(1, email);
setText(2, trust);
@@ -69,6 +71,7 @@
m_exp = (key.trust() == TRUST_EXPIRED);
m_type = Public;
m_key = new KgpgKey(key);
+ m_sig = NULL;
if (key.secret())
m_type |= Secret;
setText(0, key.name());
@@ -80,9 +83,43 @@
setText(6, key.id());
}
+KeyListViewItem::KeyListViewItem(K3ListViewItem *parent, const KgpgKeySign &sig)
+ : K3ListViewItem(parent)
+{
+ m_def = false;
+ m_exp = false; // TODO: sign expiration
+ m_type = Sign;
+ m_key = NULL;
+ m_sig = new KgpgKeySign(sig);
+
+ QString tmpname = sig.name();
+ if (!sig.comment().isEmpty())
+ tmpname += " (" + sig.comment() + ')';
+
+ setText(0, tmpname);
+
+ QString tmpemail = sig.email();
+ if (sig.local())
+ tmpemail += i18n(" [local]");
+
+ if (sig.revocation()) {
+ tmpemail += i18n(" [Revocation signature]");
+ setPixmap(0, Images::revoke());
+ } else
+ setPixmap(0, Images::signature());
+
+ setText(1, tmpemail);
+ setText(2, "-");
+ setText(3, sig.expiration());
+ setText(4, "-");
+ setText(5, sig.creation());
+ setText(6, sig.id());
+}
+
KeyListViewItem::~KeyListViewItem()
{
delete m_key;
+ delete m_sig;
}
void KeyListViewItem::setItemType(const ItemType &type)
@@ -736,30 +773,9 @@
void KeyListView::insertSigns(KeyListViewItem *item, const KgpgKeySignList &list)
{
- KeyListViewItem *newitem;
for (int i = 0; i < list.size(); ++i)
{
- const KgpgKeySign sign = list.at(i);
-
- QString tmpname = sign.name();
- if (!sign.comment().isEmpty())
- tmpname += " (" + sign.comment() + ')';
-
- QString tmpemail = sign.email();
- if (sign.local())
- tmpemail += i18n(" [local]");
-
- if (sign.revocation())
- {
- tmpemail += i18n(" [Revocation signature]");
- newitem = new KeyListViewItem(item, tmpname, tmpemail, "-", "-", "-", sign.creation(), sign.id(), false, false, KeyListViewItem::Rev);
- newitem->setPixmap(0, Images::revoke());
- }
- else
- {
- newitem = new KeyListViewItem(item, tmpname, tmpemail, "-", sign.expiration(), "-", sign.creation(), sign.id(), false, false, KeyListViewItem::Sign);
- newitem->setPixmap(0, Images::signature());
- }
+ (void) new KeyListViewItem(item, list.at(i));
}
}
@@ -829,8 +845,10 @@
return cur;
// The first hit doesn't match the full id. Do deep scanning.
- for (int i = 0; i < childCount(); i++) {
- cur = itemAtIndex(i);
+ Q3ListViewItemIterator it(this);
+
+ for(; it.current(); ++it) {
+ cur = static_cast<KeyListViewItem*>(it.current());
key = cur->getKey();
if (key == NULL)
continue;
--- trunk/KDE/kdeutils/kgpg/keylistview.h #701574:701575
@@ -49,6 +49,7 @@
explicit KeyListViewItem(KeyListView *parent = 0, const QString &name = QString(), const QString &email = QString(), const QString &trust = QString(), const QString &expiration = QString(), const QString &size = QString(), const QString &creation = QString(), const QString &id = QString() , const bool isdefault = false, const bool isexpired = false, ItemType type = Public);
explicit KeyListViewItem(KeyListViewItem *parent = 0, const QString &name = QString(), const QString &email = QString(), const QString &trust = QString(), const QString &expiration = QString(), const QString &size = QString(), const QString &creation = QString(), const QString &id = QString(), const bool isdefault = false, const bool isexpired = false, ItemType type = Public);
KeyListViewItem(K3ListView *parent, const KgpgKey &key, const bool isbold);
+ KeyListViewItem(K3ListViewItem *parent, const KgpgKeySign &sig);
~KeyListViewItem();
void setItemType(const ItemType &type);
@@ -67,13 +68,14 @@
virtual KeyListViewItem *nextSibling() const { return static_cast<KeyListViewItem*>(K3ListViewItem::nextSibling()); }
virtual KeyListViewItem *firstChild() const { return static_cast<KeyListViewItem*>(K3ListViewItem::firstChild()); }
virtual KgpgKey* getKey() { return m_key; }
- virtual QString keyId(void) const { return m_key ? m_key->fullId() : text(6); }
+ virtual QString keyId(void) const { return m_key ? m_key->fullId() : m_sig ? m_sig->fullId() : text(6); }
private:
bool m_def; /// Is set to \em true if it is the default key, \em false otherwise.
bool m_exp; /// Is set to \em true if the key is expired, \em false otherwise.
ItemType m_type;
KgpgKey *m_key;
+ KgpgKeySign *m_sig;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(KeyListViewItem::ItemType)
--- trunk/KDE/kdeutils/kgpg/keysmanager.cpp #701574:701575
@@ -1629,20 +1629,30 @@
void KeysManager::listsigns()
{
// kDebug(2100) << "Edit -------------------------------" ;
- if (keysList2->currentItem() == 0)
+ KeyListViewItem *cur = keysList2->currentItem();
+ if (cur == NULL)
return;
- if (keysList2->currentItem()->depth() != 0)
+ if (cur->depth() != 0)
{
- if (keysList2->currentItem()->text(0) == i18n("Photo id"))
+ if (cur->text(0) == i18n("Photo id"))
{
// display photo
slotShowPhoto();
}
+ if (isSignatureUnknown(cur))
+ return;
+ KeyListViewItem *tgt = keysList2->findItemByKeyId(cur->keyId());
+ if (tgt == NULL)
+ return;
+ keysList2->clearSelection();
+ keysList2->setCurrentItem(tgt);
+ keysList2->setSelected(tgt, true);
+ keysList2->ensureItemVisible(tgt);
return;
}
- if (keysList2->currentItem()->pixmap(0)->serialNumber() == Images::orphan().serialNumber())
+ if (cur->pixmap(0)->serialNumber() == Images::orphan().serialNumber())
{
if (KMessageBox::questionYesNo(this, i18n("This key is an orphaned secret key (secret key without public key.) It is currently not usable.\n\n"
"Would you like to regenerate the public key?"), QString(), KGuiItem(i18n("Generate")), KGuiItem(i18n("Do Not Generate"))) == KMessageBox::Yes)
@@ -1650,7 +1660,7 @@
return;
}
- QString key = keysList2->currentItem()->keyId();
+ QString key = cur->keyId();
if (!key.isEmpty())
{
KgpgKeyInfo *opts = new KgpgKeyInfo(key, this);
|