summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRolf Eike Beer <kde@opensource.sf-tec.de>2012-03-20 19:39:19 (GMT)
committerRolf Eike Beer <kde@opensource.sf-tec.de>2012-03-20 19:40:51 (GMT)
commit2a100ae8d203107d17e438f67f65d26a4949cccc (patch)
treefaac542e55c3947b518a9f5e4459d229512ee59d
parent68e727d9eb64e99bb4655dbcf90b789344f5f4ce (diff)
distinguish between key id and fingerprint
BUG:292405
-rw-r--r--core/KGpgKeyNode.cpp10
-rw-r--r--core/KGpgKeyNode.h6
-rw-r--r--core/KGpgOrphanNode.cpp8
-rw-r--r--core/KGpgOrphanNode.h4
-rw-r--r--core/KGpgUatNode.cpp4
-rw-r--r--core/kgpgkey.cpp16
-rw-r--r--core/kgpgkey.h6
-rw-r--r--kgpginterface.cpp4
-rw-r--r--model/keylistproxymodel.cpp5
-rw-r--r--model/kgpgitemmodel.cpp16
10 files changed, 50 insertions, 29 deletions
diff --git a/core/KGpgKeyNode.cpp b/core/KGpgKeyNode.cpp
index 14476a7..1d29cc0 100644
--- a/core/KGpgKeyNode.cpp
+++ b/core/KGpgKeyNode.cpp
@@ -1,4 +1,4 @@
-/* Copyright 2008,2009,2010 Rolf Eike Beer <kde@opensource.sf-tec.de>
+/* Copyright 2008,2009,2010,2011,2012 Rolf Eike Beer <kde@opensource.sf-tec.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -71,10 +71,10 @@ KGpgKeyNode::getTrust() const
return m_key->trust();
}
-QString
-KGpgKeyNode::getKeyId() const
+const QString &
+KGpgKeyNode::getFingerprint() const
{
- return m_key->fullId();
+ return m_key->fingerprint();
}
QString
@@ -112,7 +112,7 @@ KGpgKeyNode::getCreation() const
QString
KGpgKeyNode::getId() const
{
- return m_key->fingerprint();
+ return m_key->fullId();
}
KGpgKeyNode *
diff --git a/core/KGpgKeyNode.h b/core/KGpgKeyNode.h
index 96bcbb7..23fe456 100644
--- a/core/KGpgKeyNode.h
+++ b/core/KGpgKeyNode.h
@@ -1,4 +1,4 @@
-/* Copyright 2008,2009,2010 Rolf Eike Beer <kde@opensource.sf-tec.de>
+/* Copyright 2008,2009,2010,2012 Rolf Eike Beer <kde@opensource.sf-tec.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -59,7 +59,7 @@ public:
virtual KgpgCore::KgpgItemType getType() const;
virtual KgpgCore::KgpgKeyTrust getTrust() const;
- QString getKeyId() const;
+ const QString &getFingerprint() const;
virtual QString getSize() const;
virtual QString getName() const;
virtual QString getEmail() const;
@@ -83,7 +83,7 @@ public:
*
* @return the full fingerprint with spaces inserted
*/
- virtual QString getBeautifiedFingerprint() const;
+ QString getBeautifiedFingerprint() const;
virtual QString getComment() const;
/**
* @brief Return the number of signatures of the primary user id
diff --git a/core/KGpgOrphanNode.cpp b/core/KGpgOrphanNode.cpp
index 31f8576..f245121 100644
--- a/core/KGpgOrphanNode.cpp
+++ b/core/KGpgOrphanNode.cpp
@@ -1,4 +1,4 @@
-/* Copyright 2008,2009 Rolf Eike Beer <kde@opensource.sf-tec.de>
+/* Copyright 2008,2009,2010,2012 Rolf Eike Beer <kde@opensource.sf-tec.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -77,8 +77,8 @@ KGpgOrphanNode::getTrust() const
return m_key->trust();
}
-QString
-KGpgOrphanNode::getKeyId() const
+const QString &
+KGpgOrphanNode::getFingerprint() const
{
- return m_key->fullId();
+ return m_key->fingerprint();
}
diff --git a/core/KGpgOrphanNode.h b/core/KGpgOrphanNode.h
index aa6c0f4..9268da4 100644
--- a/core/KGpgOrphanNode.h
+++ b/core/KGpgOrphanNode.h
@@ -1,4 +1,4 @@
-/* Copyright 2008,2009 Rolf Eike Beer <kde@opensource.sf-tec.de>
+/* Copyright 2008,2009,2010,2012 Rolf Eike Beer <kde@opensource.sf-tec.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -41,7 +41,7 @@ public:
virtual KgpgCore::KgpgItemType getType() const;
virtual KgpgCore::KgpgKeyTrust getTrust() const;
- QString getKeyId() const;
+ const QString &getFingerprint() const;
virtual QString getSize() const;
virtual QString getName() const;
virtual QString getEmail() const;
diff --git a/core/KGpgUatNode.cpp b/core/KGpgUatNode.cpp
index 2bc05b9..ccc8030 100644
--- a/core/KGpgUatNode.cpp
+++ b/core/KGpgUatNode.cpp
@@ -1,4 +1,4 @@
-/* Copyright 2008,2009,2010 Rolf Eike Beer <kde@opensource.sf-tec.de>
+/* Copyright 2008,2009,2010,2012 Rolf Eike Beer <kde@opensource.sf-tec.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -47,7 +47,7 @@ KGpgUatNode::KGpgUatNode(KGpgKeyNode *parent, const unsigned int index, const QS
: KGpgSignableNode(parent),
d_ptr(new KGpgUatNodePrivate(index, sl))
{
- d_ptr->m_pixmap = KgpgInterface::loadPhoto(parent->getKeyId(), d_ptr->m_idx);
+ d_ptr->m_pixmap = KgpgInterface::loadPhoto(parent->getFingerprint(), d_ptr->m_idx);
}
KGpgUatNode::~KGpgUatNode()
diff --git a/core/kgpgkey.cpp b/core/kgpgkey.cpp
index e607a27..9141cd2 100644
--- a/core/kgpgkey.cpp
+++ b/core/kgpgkey.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006,2007 Jimmy Gilles <jimmygilles@gmail.com>
- * Copyright (C) 2007,2008,2009,2010 Rolf Eike Beer <kde@opensource.sf-tec.de>
+ * Copyright (C) 2007,2008,2009,2010,2012 Rolf Eike Beer <kde@opensource.sf-tec.de>
*/
/***************************************************************************
@@ -170,6 +170,7 @@ bool KgpgKeyPrivate::operator==(const KgpgKeyPrivate &other) const
if (gpgkeyname != other.gpgkeyname) return false;
if (gpgkeycomment != other.gpgkeycomment) return false;
if (gpgkeyfingerprint != other.gpgkeyfingerprint) return false;
+ if (gpgkeyid != other.gpgkeyid) return false;
if (gpgkeysize != other.gpgkeysize) return false;
if (gpgkeyownertrust != other.gpgkeyownertrust) return false;
if (gpgkeytrust != other.gpgkeytrust) return false;
@@ -218,6 +219,13 @@ void KgpgKey::setComment(const QString &comment)
void KgpgKey::setFingerprint(const QString &fingerprint)
{
d->gpgkeyfingerprint = fingerprint;
+ if (d->gpgkeyid.isEmpty())
+ d->gpgkeyid = fingerprint.right(16);
+}
+
+void KgpgKey::setKeyId (const QString &id)
+{
+ d->gpgkeyid = id;
}
void KgpgKey::setSize(const uint &size)
@@ -262,12 +270,12 @@ bool KgpgKey::valid() const
QString KgpgKey::id() const
{
- return d->gpgkeyfingerprint.right(8);
+ return d->gpgkeyid.right(8);
}
QString KgpgKey::fullId() const
{
- return d->gpgkeyfingerprint.right(16);
+ return d->gpgkeyid;
}
QString KgpgKey::name() const
@@ -285,7 +293,7 @@ QString KgpgKey::comment() const
return d->gpgkeycomment;
}
-QString KgpgKey::fingerprint() const
+const QString &KgpgKey::fingerprint() const
{
return d->gpgkeyfingerprint;
}
diff --git a/core/kgpgkey.h b/core/kgpgkey.h
index 5173779..bc43119 100644
--- a/core/kgpgkey.h
+++ b/core/kgpgkey.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2006,2007 Jimmy Gilles <jimmygilles@gmail.com>
- * Copyright (C) 2007,2008,2009,2010 Rolf Eike Beer <kde@opensource.sf-tec.de>
+ * Copyright (C) 2007,2008,2009,2010,2012 Rolf Eike Beer <kde@opensource.sf-tec.de>
*/
/***************************************************************************
@@ -222,6 +222,7 @@ public:
QString gpgkeyname;
QString gpgkeycomment;
QString gpgkeyfingerprint;
+ QString gpgkeyid;
uint gpgkeysize;
KgpgKeyOwnerTrust gpgkeyownertrust;
KgpgKeyTrust gpgkeytrust;
@@ -248,6 +249,7 @@ public:
void setEmail(const QString &email);
void setComment(const QString &comment);
void setFingerprint(const QString &fingerprint);
+ void setKeyId(const QString &id);
void setSize(const uint &size);
void setOwnerTrust(const KgpgKeyOwnerTrust &owtrust);
void setTrust(const KgpgKeyTrust &trust);
@@ -262,7 +264,7 @@ public:
QString name() const;
QString email() const;
QString comment() const;
- QString fingerprint() const;
+ const QString &fingerprint() const;
QString fingerprintBeautified() const;
uint size() const;
uint encryptionSize() const;
diff --git a/kgpginterface.cpp b/kgpginterface.cpp
index 88ed2c6..fae5f93 100644
--- a/kgpginterface.cpp
+++ b/kgpginterface.cpp
@@ -517,7 +517,7 @@ void KgpgInterface::readPublicKeysProcess(GPGProc *p)
m_publickey.setTrust(Convert::toTrust(lsp.at(1)));
m_publickey.setSize(lsp.at(2).toUInt());
m_publickey.setAlgorithm(Convert::toAlgo(lsp.at(3).toInt()));
- m_publickey.setFingerprint(lsp.at(4));
+ m_publickey.setKeyId(lsp.at(4));
m_publickey.setCreation(QDateTime::fromTime_t(lsp.at(5).toUInt()));
m_publickey.setOwnerTrust(Convert::toOwnerTrust(lsp.at(8)));
@@ -685,7 +685,7 @@ void KgpgInterface::readSecretKeysProcess(GPGProc *p)
m_secretkey.setTrust(Convert::toTrust(lsp.at(1)));
m_secretkey.setSize(lsp.at(2).toUInt());
m_secretkey.setAlgorithm(Convert::toAlgo(lsp.at(3).toInt()));
- m_secretkey.setFingerprint(lsp.at(4));
+ m_secretkey.setKeyId(lsp.at(4));
m_secretkey.setCreation(QDateTime::fromTime_t(lsp.at(5).toUInt()));
m_secretkey.setSecret(true);
diff --git a/model/keylistproxymodel.cpp b/model/keylistproxymodel.cpp
index c4b02e0..ed2bce8 100644
--- a/model/keylistproxymodel.cpp
+++ b/model/keylistproxymodel.cpp
@@ -1,4 +1,4 @@
-/* Copyright 2008 Rolf Eike Beer <kde@opensource.sf-tec.de>
+/* Copyright 2008,2009,2010,2012 Rolf Eike Beer <kde@opensource.sf-tec.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -129,9 +129,6 @@ KeyListProxyModelPrivate::dataMultiColumn(const QModelIndex &index, int role, co
} else if ((role == Qt::DisplayRole) && (index.column() == KEYCOLUMN_ID)) {
QString id = m_model->data(q->mapToSource(index), Qt::DisplayRole).toString();
return id.right(m_idLength);
- } else if ((role == Qt::ToolTipRole) && (index.column() == KEYCOLUMN_ID)) {
- QString id = m_model->data(q->mapToSource(index), Qt::DisplayRole).toString();
- return id;
}
return m_model->data(q->mapToSource(index), role);
}
diff --git a/model/kgpgitemmodel.cpp b/model/kgpgitemmodel.cpp
index e219e8d..e2efb64 100644
--- a/model/kgpgitemmodel.cpp
+++ b/model/kgpgitemmodel.cpp
@@ -159,8 +159,22 @@ KGpgItemModel::data(const QModelIndex &index, int role) const
return KGlobal::locale()->formatDate(node->getCreation().date(), KLocale::ShortDate);
break;
case KEYCOLUMN_ID:
- if (role == Qt::DisplayRole)
+ switch (role) {
+ case Qt::DisplayRole:
return node->getId();
+ case Qt::ToolTipRole:
+ switch (node->getType()) {
+ case ITYPE_PAIR:
+ case ITYPE_PUBLIC:
+ return node->toKeyNode()->getFingerprint();
+ case ITYPE_SECRET:
+ return node->toOrphanNode()->getFingerprint();
+ default:
+ return QVariant();
+ }
+ default:
+ return QVariant();
+ }
break;
}