Commit 70d64b7d authored by Rolf Eike Beer's avatar Rolf Eike Beer
Browse files

show number of signatures for all items where it makes sense as tooltip in the

size column of keys manager

CCBUG:159350

svn path=/trunk/KDE/kdeutils/kgpg/; revision=786804
parent b66c3692
......@@ -110,8 +110,22 @@ KGpgItemModel::data(const QModelIndex &index, int role) const
return node->getExpiration();
break;
case KEYCOLUMN_SIZE:
if (role == Qt::DisplayRole)
switch (role) {
case Qt::DisplayRole:
return node->getSize();
case Qt::ToolTipRole:
switch (node->getType()) {
case ITYPE_PAIR:
case ITYPE_PUBLIC:
return static_cast<KGpgKeyNode *>(node)->getSignCount();
case ITYPE_UAT:
return static_cast<KGpgUatNode *>(node)->getSignCount();
case ITYPE_UID:
return static_cast<KGpgUidNode *>(node)->getSignCount();
case ITYPE_SUB:
return static_cast<KGpgSubkeyNode *>(node)->getSignCount();
}
}
break;
case KEYCOLUMN_CREAT:
if (role == Qt::DisplayRole)
......
......@@ -146,6 +146,7 @@ KGpgRootNode::findKeyRow(const QString &keyId)
KGpgKeyNode::KGpgKeyNode(KGpgExpandableNode *parent, const KgpgKey &k)
: KGpgExpandableNode(parent), m_key(new KgpgKey(k))
{
m_signs = 0;
}
KGpgKeyNode::~KGpgKeyNode()
......@@ -243,6 +244,8 @@ KGpgKeyNode::readChildren()
/******** insertion of signature ********/
insertSigns(this, key.signList());
m_signs = key.signList().size();
}
void KGpgKeyNode::insertSigns(KGpgExpandableNode *node, const KgpgKeySignList &list)
......@@ -253,6 +256,13 @@ void KGpgKeyNode::insertSigns(KGpgExpandableNode *node, const KgpgKeySignList &l
}
}
QString KGpgKeyNode::getSignCount() const
{
if (!wasExpanded())
return QString();
return i18np("1 signature", "%1 signatures", m_signs);
}
KGpgUidNode::KGpgUidNode(KGpgKeyNode *parent, const KgpgKeyUid &u)
: KGpgExpandableNode(parent), m_uid(new KgpgKeyUid(u))
{
......@@ -271,7 +281,7 @@ KGpgUidNode::getEmail() const
}
QString
KGpgUidNode::getSize() const
KGpgUidNode::getSignCount() const
{
return i18np("1 signature", "%1 signatures", children.count());
}
......@@ -362,6 +372,12 @@ KGpgSubkeyNode::getSize() const
return QString::number(m_skey.size());
}
QString
KGpgSubkeyNode::getSignCount() const
{
return i18np("1 signature", "%1 signatures", children.count());
}
KGpgUatNode::KGpgUatNode(KGpgKeyNode *parent, const KgpgKeyUat &k, const QString &index)
: KGpgExpandableNode(parent), m_uat(k), m_idx(index)
{
......@@ -388,6 +404,12 @@ KGpgUatNode::getCreation() const
return m_uat.creationDate();
}
QString
KGpgUatNode::getSignCount() const
{
return i18np("1 signature", "%1 signatures", children.count());
}
KGpgGroupNode::KGpgGroupNode(KGpgRootNode *parent, const QString &name)
: KGpgExpandableNode(parent), m_name(name)
{
......
......@@ -94,6 +94,7 @@ class KGpgKeyNode : public KGpgExpandableNode
private:
KgpgKey *m_key;
int m_signs;
void insertSigns(KGpgExpandableNode *node, const KgpgKeySignList &list);
......@@ -124,6 +125,7 @@ public:
{ return m_key->fingerprintBeautified(); }
virtual QString getComment() const
{ return m_key->comment(); }
virtual QString getSignCount() const;
};
typedef QList<KGpgKeyNode *> KGpgKeyNodeList;
......@@ -174,7 +176,6 @@ public:
{ return ITYPE_UID; }
virtual KgpgKeyTrust getTrust() const
{ return m_uid->trust(); }
virtual QString getSize() const;
virtual QString getName() const;
virtual QString getEmail() const;
virtual QString getId() const;
......@@ -182,6 +183,7 @@ public:
{ return static_cast<KGpgKeyNode *>(m_parent); }
virtual QString getComment() const
{ return m_uid->comment(); }
virtual QString getSignCount() const;
};
class KGpgSignNode : public KGpgNode
......@@ -232,6 +234,7 @@ public:
virtual QString getId() const;
virtual KGpgKeyNode *getParentKeyNode() const
{ return static_cast<KGpgKeyNode *>(m_parent); }
virtual QString getSignCount() const;
};
class KGpgUatNode : public KGpgExpandableNode
......@@ -265,6 +268,7 @@ public:
virtual QDate getCreation() const;
virtual KGpgKeyNode *getParentKeyNode() const
{ return static_cast<KGpgKeyNode *>(m_parent); }
virtual QString getSignCount() const;
};
class KGpgGroupNode : public KGpgExpandableNode
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment