• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeutils API Reference
  • KDE Home
  • Contact Us
 

kgpg

  • sources
  • kde-4.14
  • kdeutils
  • kgpg
  • model
kgpgitemmodel.cpp
Go to the documentation of this file.
1 /* Copyright 2008,2009,2010,2011,2012,2013 Rolf Eike Beer <kde@opensource.sf-tec.de>
2  *
3  * This program is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU General Public License as
5  * published by the Free Software Foundation; either version 2 of
6  * the License or (at your option) version 3 or any later version
7  * accepted by the membership of KDE e.V. (or its successor approved
8  * by the membership of KDE e.V.), which shall act as a proxy
9  * defined in Section 14 of version 3 of the license.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 #include "kgpgitemmodel.h"
20 
21 #include "kgpgsettings.h"
22 #include "core/convert.h"
23 #include "core/images.h"
24 #include "model/kgpgitemnode.h"
25 
26 #include <KGlobal>
27 #include <KLocale>
28 #include <QMetaObject>
29 
30 KGpgItemModel::KGpgItemModel(QObject *parent)
31  : QAbstractItemModel(parent),
32  m_root(new KGpgRootNode(this)),
33  m_default(KGpgSettings::defaultKey())
34 {
35  QMetaObject::invokeMethod(this, "refreshGroups", Qt::QueuedConnection);
36 }
37 
38 KGpgItemModel::~KGpgItemModel()
39 {
40  delete m_root;
41 }
42 
43 QModelIndex
44 KGpgItemModel::index(int row, int column, const QModelIndex &parent) const
45 {
46  if (hasIndex(row, column, parent)) {
47  KGpgNode *parentNode = nodeForIndex(parent);
48  KGpgNode *childNode = parentNode->getChild(row);
49  return createIndex(row, column, childNode);
50  }
51  return QModelIndex();
52 }
53 
54 QModelIndex
55 KGpgItemModel::parent(const QModelIndex &child) const
56 {
57  if (!child.isValid())
58  return QModelIndex();
59  KGpgNode *childNode = nodeForIndex(child);
60  KGpgNode *parentNode = childNode->m_parent;
61 
62  if (parentNode == m_root)
63  return QModelIndex();
64 
65  Q_ASSERT(parentNode != NULL);
66  int row = rowForNode(parentNode);
67  int column = 0;
68 
69  return createIndex(row, column, parentNode);
70 }
71 
72 int
73 KGpgItemModel::rowCount(const QModelIndex &parent) const
74 {
75  if (parent.column() > 0)
76  return 0;
77 
78  KGpgNode *parentNode = nodeForIndex(parent);
79 
80  return parentNode->getChildCount();
81 }
82 
83 bool
84 KGpgItemModel::hasChildren(const QModelIndex &parent) const
85 {
86  if (parent.column() > 0)
87  return false;
88 
89  KGpgNode *parentNode = nodeForIndex(parent);
90 
91  return parentNode->hasChildren();
92 }
93 
94 QVariant
95 KGpgItemModel::data(const QModelIndex &index, int role) const
96 {
97  if (!index.isValid())
98  return QVariant();
99 
100  KGpgNode *node = nodeForIndex(index);
101 
102  if (role == Qt::FontRole) {
103  QFont f;
104  f.setBold(isDefaultKey(node));
105  return f;
106  }
107 
108  switch (index.column()) {
109  case KEYCOLUMN_NAME:
110  switch (role) {
111  case Qt::DisplayRole:
112  case Qt::EditRole:
113  return node->getName();
114  case Qt::DecorationRole:
115  switch (node->getType()) {
116  case ITYPE_GROUP:
117  return Images::group();
118  case ITYPE_GSECRET:
119  case ITYPE_SECRET:
120  return Images::orphan();
121  case ITYPE_GPUBLIC:
122  case ITYPE_SUB:
123  case ITYPE_PUBLIC:
124  return Images::single();
125  case ITYPE_GPAIR:
126  case ITYPE_PAIR:
127  return Images::pair();
128  case ITYPE_UID:
129  return Images::userId();
130  case ITYPE_UAT:
131  return node->toUatNode()->getPixmap();
132  case ITYPE_REVSIGN:
133  return Images::revoke();
134  case ITYPE_SIGN:
135  return Images::signature();
136  default:
137  Q_ASSERT(0);
138  return QVariant();
139  }
140  case Qt::ToolTipRole:
141  return node->getComment();
142  }
143  break;
144  case KEYCOLUMN_EMAIL:
145  if (role == Qt::DisplayRole)
146  return node->getEmail();
147  break;
148  case KEYCOLUMN_TRUST:
149  {
150  KgpgKeyTrust t = node->getTrust();
151 
152  switch (role) {
153  case Qt::BackgroundColorRole:
154  switch (t) {
155  case TRUST_INVALID:
156  case TRUST_DISABLED:
157  return KGpgSettings::colorBad();
158  case TRUST_EXPIRED:
159  return KGpgSettings::colorExpired();
160  case TRUST_MARGINAL:
161  return KGpgSettings::colorMarginal();
162  case TRUST_REVOKED:
163  return KGpgSettings::colorRev();
164  case TRUST_UNDEFINED:
165  case TRUST_NONE:
166  return KGpgSettings::colorUnknown();
167  case TRUST_FULL:
168  return KGpgSettings::colorGood();
169  case TRUST_ULTIMATE:
170  return KGpgSettings::colorUltimate();
171  case TRUST_UNKNOWN:
172  default:
173  return KGpgSettings::colorUnknown();
174  }
175  case Qt::AccessibleTextRole:
176  return Convert::toString(t);
177  }
178  break;
179  }
180  case KEYCOLUMN_EXPIR:
181  if (role == Qt::DisplayRole)
182  return KGlobal::locale()->formatDate(node->getExpiration().date(), KLocale::ShortDate);
183  break;
184  case KEYCOLUMN_SIZE:
185  switch (role) {
186  case Qt::DisplayRole:
187  return node->getSize();
188  case Qt::ToolTipRole:
189  switch (node->getType()) {
190  case ITYPE_PAIR:
191  case ITYPE_PUBLIC:
192  return node->toKeyNode()->getSignCount();
193  case ITYPE_UAT:
194  return node->toUatNode()->getSignCount();
195  case ITYPE_UID:
196  return node->toUidNode()->getSignCount();
197  case ITYPE_SUB:
198  return node->toSubkeyNode()->getSignCount();
199  }
200  }
201  break;
202  case KEYCOLUMN_CREAT:
203  if (role == Qt::DisplayRole)
204  return KGlobal::locale()->formatDate(node->getCreation().date(), KLocale::ShortDate);
205  break;
206  case KEYCOLUMN_ID:
207  switch (role) {
208  case Qt::DisplayRole:
209  return node->getId();
210  case Qt::ToolTipRole:
211  switch (node->getType()) {
212  case ITYPE_PAIR:
213  case ITYPE_PUBLIC:
214  return node->toKeyNode()->getFingerprint();
215  case ITYPE_SECRET:
216  return node->toOrphanNode()->getFingerprint();
217  default:
218  return QVariant();
219  }
220  default:
221  return QVariant();
222  }
223  break;
224  }
225 
226  return QVariant();
227 }
228 
229 KGpgNode *
230 KGpgItemModel::nodeForIndex(const QModelIndex &index) const
231 {
232  if (index.isValid())
233  return static_cast<KGpgNode*>(index.internalPointer());
234  return m_root;
235 }
236 
237 KGpgKeyNode *
238 KGpgItemModel::findKeyNode(const QString& id) const
239 {
240  return m_root->findKey(id);
241 }
242 
243 int
244 KGpgItemModel::rowForNode(KGpgNode *node) const
245 {
246  return node->m_parent->getChildIndex(node);
247 }
248 
249 KGpgRootNode *
250 KGpgItemModel::getRootNode() const
251 {
252  return m_root;
253 }
254 
255 QString
256 KGpgItemModel::statusCountMessage() const
257 {
258  const int groups = m_root->groupChildren();
259  const int keys = m_root->getChildCount() - groups;
260 
261  return statusCountMessageString(keys, groups);
262 }
263 
264 QString
265 KGpgItemModel::statusCountMessageString(const unsigned int keys, const unsigned int groups)
266 {
267  // Most people will not have groups. Handle this case
268  // special so the string isn't displayed in this case at all
269  if (groups == 0) {
270  return i18np("1 Key", "%1 Keys", keys);
271  }
272 
273  const QString keyString = i18np("1 Key", "%1 Keys", keys);
274  const QString groupString = i18np("1 Group", "%1 Groups", groups);
275 
276  return i18nc("%1 = something like 7 keys, %2 = something like 2 groups", "%1, %2", keyString, groupString);
277 
278 }
279 
280 KGpgGroupNode *
281 KGpgItemModel::addGroup(const QString &name, const KGpgKeyNode::List &keys)
282 {
283  KGpgGroupNode *nd;
284  const int cIndex = m_root->getChildCount(); // row of the new node
285 
286  beginInsertRows(QModelIndex(), cIndex, cIndex);
287  nd = new KGpgGroupNode(m_root, name, keys);
288  endInsertRows();
289 
290  nd->saveMembers();
291 
292  Q_ASSERT(m_root->getChildIndex(nd) == cIndex);
293 
294  return nd;
295 }
296 
297 void
298 KGpgItemModel::delNode(KGpgNode *node)
299 {
300  beginResetModel();
301  delete node;
302  endResetModel();
303 }
304 
305 void
306 KGpgItemModel::changeGroup(KGpgGroupNode *node, const QList<KGpgNode *> &keys)
307 {
308  const QModelIndex gIndex = nodeIndex(node);
309  for (int i = node->getChildCount() - 1; i >= 0; i--) {
310  bool found = false;
311 
312  foreach (const KGpgNode *nd, keys) {
313  found = (node->getChild(i)->getId() == nd->getId());
314  if (found)
315  break;
316  }
317  if (found)
318  continue;
319 
320  beginRemoveRows(gIndex, i, i);
321  delete node->getChild(i);
322  endRemoveRows();
323  }
324 
325  int cnt = node->getChildCount();
326 
327  for (int i = 0; i < keys.count(); i++) {
328  bool found = false;
329 
330  foreach (const KGpgNode *nd, node->getChildren()) {
331  found = (nd->getId() == keys.at(i)->getId());
332  if (found)
333  break;
334  }
335  if (found)
336  continue;
337 
338  beginInsertRows(gIndex, cnt, cnt);
339  new KGpgGroupMemberNode(node, keys.at(i)->toKeyNode());
340  endInsertRows();
341  cnt++;
342  }
343 
344  node->saveMembers();
345 }
346 
347 void
348 KGpgItemModel::deleteFromGroup(KGpgGroupNode *group, KGpgGroupMemberNode *member)
349 {
350  Q_ASSERT(group == member->getParentKeyNode());
351 
352  const int childRow = group->getChildIndex(member);
353  const QModelIndex pIndex = nodeIndex(group);
354 
355  beginRemoveRows(pIndex, childRow, childRow);
356  delete member;
357  endRemoveRows();
358 
359  group->saveMembers();
360 }
361 
362 QVariant
363 KGpgItemModel::headerData(int section, Qt::Orientation orientation, int role) const
364 {
365  if (role != Qt::DisplayRole)
366  return QVariant();
367 
368  if (orientation != Qt::Horizontal)
369  return QVariant();
370 
371  switch (section) {
372  case KEYCOLUMN_NAME: return QString(i18n("Name"));
373  case KEYCOLUMN_EMAIL: return QString(i18nc("@title:column Title of a column of emails", "Email"));
374  case KEYCOLUMN_TRUST: return QString(i18n("Trust"));
375  case KEYCOLUMN_SIZE: return QString(i18n("Size"));
376  case KEYCOLUMN_EXPIR: return QString(i18n("Expiration"));
377  case KEYCOLUMN_CREAT: return QString(i18n("Creation"));
378  case KEYCOLUMN_ID: return QString(i18n("ID"));
379  default: return QVariant();
380  }
381 }
382 
383 void
384 KGpgItemModel::setDefaultKey(KGpgKeyNode *def)
385 {
386  int defrow = m_root->findKeyRow(def);
387  int odefrow = m_root->findKeyRow(m_default);
388  if (defrow == odefrow)
389  return;
390 
391  int lastcol = columnCount(QModelIndex()) - 1;
392  if (odefrow >= 0) {
393  KGpgNode *nd = m_root->getChild(odefrow);
394  emit dataChanged(createIndex(odefrow, 0, nd), createIndex(odefrow, lastcol, nd));
395  }
396 
397  if (def) {
398  m_default = def->getId();
399  emit dataChanged(createIndex(defrow, 0, def), createIndex(defrow, lastcol, def));
400  } else {
401  m_default.clear();
402  }
403 }
404 
405 QModelIndex
406 KGpgItemModel::nodeIndex(KGpgNode *node, const int column)
407 {
408  KGpgNode *p = node->getParentKeyNode();
409 
410  for (int i = 0; i < p->getChildCount(); i++)
411  if (p->getChild(i) == node)
412  return createIndex(i, column, node);
413 
414  Q_ASSERT(0);
415  return QModelIndex();
416 }
417 
418 void
419 KGpgItemModel::refreshKey(KGpgKeyNode *nd)
420 {
421  KGpgKeyNode::List nodes;
422 
423  nodes.append(nd);
424 
425  refreshKeyIds(nodes);
426 }
427 
428 void
429 KGpgItemModel::refreshKey(const QString &id)
430 {
431  refreshKeyIds(QStringList(id));
432 }
433 
434 void
435 KGpgItemModel::refreshKeys(KGpgKeyNode::List keys)
436 {
437  refreshKeyIds(keys);
438 }
439 
440 void
441 KGpgItemModel::refreshKeys(const QStringList &ids)
442 {
443  refreshKeyIds(ids);
444 }
445 
446 void
447 KGpgItemModel::refreshKeyIds(const QStringList &ids)
448 {
449  beginResetModel();
450  if (ids.isEmpty()) {
451  for (int i = m_root->getChildCount() - 1; i >= 0; i--) {
452  KGpgNode *nd = m_root->getChild(i);
453  if (nd->getType() == ITYPE_GROUP)
454  continue;
455  delete nd;
456  }
457  m_root->addKeys();
458  } else {
459  QStringList::ConstIterator it = ids.constBegin();
460  const QStringList::ConstIterator itEnd = ids.constEnd();
461 
462  KGpgKeyNode::List refreshNodes;
463  QStringList addIds;
464 
465  for (; it != itEnd; ++it) {
466  KGpgKeyNode *nd = m_root->findKey(*it);
467  if (nd)
468  refreshNodes << nd;
469  else
470  addIds << *it;
471  }
472 
473  if (!refreshNodes.isEmpty())
474  m_root->refreshKeys(refreshNodes);
475  if (!addIds.isEmpty())
476  m_root->addKeys(addIds);
477  }
478 
479  endResetModel();
480 }
481 
482 void
483 KGpgItemModel::refreshKeyIds(KGpgKeyNode::List &nodes)
484 {
485  beginResetModel();
486  m_root->refreshKeys(nodes);
487  endResetModel();
488 }
489 
490 void
491 KGpgItemModel::refreshGroups()
492 {
493  for (int i = m_root->getChildCount() - 1; i >= 0; i--) {
494  KGpgNode *nd = m_root->getChild(i);
495  if (nd->getType() != ITYPE_GROUP)
496  continue;
497 
498  beginRemoveRows(QModelIndex(), i, i);
499  delete nd;
500  endRemoveRows();
501  }
502 
503  const QStringList groups = KGpgGroupNode::readGroups();
504 
505  if (groups.isEmpty())
506  return;
507 
508  const int oldCount = m_root->getChildCount();
509  beginInsertRows(QModelIndex(), oldCount, oldCount + groups.count());
510  m_root->addGroups(groups);
511  endInsertRows();
512 }
513 
514 bool
515 KGpgItemModel::isDefaultKey(const KGpgNode *node) const
516 {
517  return !m_default.isEmpty() && (m_default == node->getId().right(m_default.length()));
518 }
519 
520 void
521 KGpgItemModel::invalidateIndexes(KGpgNode *nd)
522 {
523  foreach (const QModelIndex &idx, persistentIndexList()) {
524  KGpgNode *n = nodeForIndex(idx);
525 
526  if (n != nd)
527  continue;
528 
529  changePersistentIndex(idx, QModelIndex());
530  }
531 }
532 
533 void
534 KGpgItemModel::refreshTrust(const KgpgCore::KgpgKeyTrust trust, const QColor& color)
535 {
536  updateNodeTrustColor(m_root, trust, color);
537 }
538 
539 void
540 KGpgItemModel::updateNodeTrustColor(KGpgExpandableNode *node, const KgpgCore::KgpgKeyTrust trust, const QColor &color)
541 {
542  for (int i = 0; i < node->getChildCount(); i++) {
543  KGpgNode *child = node->getChild(i);
544 
545  if (child->getTrust() == trust)
546  emit dataChanged(createIndex(i, KEYCOLUMN_TRUST, child), createIndex(i, KEYCOLUMN_TRUST, child));
547 
548  if (!child->hasChildren())
549  continue;
550 
551  KGpgExpandableNode *echild = child->toExpandableNode();
552  if (echild->wasExpanded())
553  updateNodeTrustColor(echild, trust, color);
554  }
555 }
556 
557 #include "kgpgitemmodel.moc"
QAbstractItemModel::hasIndex
bool hasIndex(int row, int column, const QModelIndex &parent) const
QObject::child
QObject * child(const char *objName, const char *inheritsClass, bool recursiveSearch) const
KEYCOLUMN_SIZE
#define KEYCOLUMN_SIZE
Definition: kgpgitemmodel.h:34
QModelIndex
KgpgCore::TRUST_MARGINAL
there is a minimal level of trust
Definition: kgpgkey.h:62
KgpgCore::ITYPE_GPAIR
key pair as member of a key group
Definition: kgpgkey.h:97
KEYCOLUMN_TRUST
#define KEYCOLUMN_TRUST
Definition: kgpgitemmodel.h:32
QAbstractItemModel::changePersistentIndex
void changePersistentIndex(const QModelIndex &from, const QModelIndex &to)
KGpgSettings::colorExpired
static QColor colorExpired()
Get Color used for expired keys.
Definition: kgpgsettings.h:839
KGpgNode::getParentKeyNode
KGpgExpandableNode * getParentKeyNode() const
Returns the parent node in the key hierarchy.
Definition: KGpgNode.cpp:330
KGpgExpandableNode::getChildren
virtual const KGpgNode::List & getChildren() const
Definition: KGpgExpandableNode.cpp:71
KGpgItemModel::isDefaultKey
bool isDefaultKey(const KGpgNode *node) const
Definition: kgpgitemmodel.cpp:515
KGpgExpandableNode::getChildIndex
virtual int getChildIndex(KGpgNode *node) const
Returns the index for a given child node.
Definition: KGpgExpandableNode.cpp:77
KGpgGroupNode
A GnuPG group of public keys.
Definition: KGpgGroupNode.h:33
KGpgKeyNode::getSignCount
virtual QString getSignCount() const
Return the number of signatures of the primary user id.
Definition: KGpgKeyNode.cpp:166
KGpgItemModel::updateNodeTrustColor
void updateNodeTrustColor(KGpgExpandableNode *node, const KgpgCore::KgpgKeyTrust trust, const QColor &color)
Definition: kgpgitemmodel.cpp:540
KGpgItemModel::addGroup
KGpgGroupNode * addGroup(const QString &name, const KGpgKeyNode::List &keys)
Definition: kgpgitemmodel.cpp:281
KGpgKeyNode::getId
virtual QString getId() const
Definition: KGpgKeyNode.cpp:113
KGpgItemModel::refreshKey
void refreshKey(const QString &id)
Definition: kgpgitemmodel.cpp:429
KGpgRootNode::refreshKeys
void refreshKeys(KGpgKeyNode::List nodes)
Definition: KGpgRootNode.cpp:89
QFont
KGpgSettings::colorUnknown
static QColor colorUnknown()
Get Color used for unknown keys.
Definition: kgpgsettings.h:763
QList::at
const T & at(int i) const
KGpgOrphanNode::getFingerprint
const QString & getFingerprint() const
Definition: KGpgOrphanNode.cpp:81
KgpgCore::ITYPE_GPUBLIC
public key as member of a key group
Definition: kgpgkey.h:96
images.h
KGpgItemModel::statusCountMessageString
static QString statusCountMessageString(const unsigned int keys, const unsigned int groups)
Definition: kgpgitemmodel.cpp:265
KGpgItemModel::KGpgItemModel
KGpgItemModel(QObject *parent=0)
Definition: kgpgitemmodel.cpp:30
KGpgSettings::colorRev
static QColor colorRev()
Get Color used for revoked keys.
Definition: kgpgsettings.h:744
KGpgItemModel::refreshTrust
void refreshTrust(const KgpgCore::KgpgKeyTrust trust, const QColor &color)
Definition: kgpgitemmodel.cpp:534
KGpgItemModel::hasChildren
virtual bool hasChildren(const QModelIndex &parent) const
Definition: kgpgitemmodel.cpp:84
KGpgExpandableNode::getChild
virtual KGpgNode * getChild(const int index) const
Returns the child node at the given index.
Definition: KGpgExpandableNode.cpp:41
QAbstractItemModel::persistentIndexList
QModelIndexList persistentIndexList() const
KGpgNode::getComment
virtual QString getComment() const
Definition: KGpgNode.cpp:324
KGpgKeyNode
A public key with or without corresponding secret key.
Definition: KGpgKeyNode.h:33
KEYCOLUMN_CREAT
#define KEYCOLUMN_CREAT
Definition: kgpgitemmodel.h:35
KgpgCore::Images::signature
QPixmap signature()
Definition: images.cpp:64
QString::clear
void clear()
KGpgItemModel::rowCount
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: kgpgitemmodel.cpp:73
KGpgItemModel::invalidateIndexes
void invalidateIndexes(KGpgNode *nd)
Definition: kgpgitemmodel.cpp:521
KGpgItemModel::rowForNode
int rowForNode(KGpgNode *node) const
Definition: kgpgitemmodel.cpp:244
QFont::setBold
void setBold(bool enable)
QAbstractItemModel::beginResetModel
void beginResetModel()
KGpgNode::getCreation
virtual QDateTime getCreation() const
Definition: KGpgNode.cpp:312
KGpgNode::getType
virtual KgpgCore::KgpgItemType getType() const =0
Returns the item type of this object.
QModelIndex::isValid
bool isValid() const
KGpgNode::getExpiration
virtual QDateTime getExpiration() const
Definition: KGpgNode.cpp:306
KgpgCore::ITYPE_GSECRET
secret key as member of a key group
Definition: kgpgkey.h:95
QList::count
int count(const T &value) const
KGpgRootNode
The parent of all key data objects.
Definition: KGpgRootNode.h:38
QList::append
void append(const T &value)
KGpgItemModel::findKeyNode
KGpgKeyNode * findKeyNode(const QString &id) const
Definition: kgpgitemmodel.cpp:238
KGpgKeyNode::getFingerprint
const QString & getFingerprint() const
Definition: KGpgKeyNode.cpp:75
KGpgNode::getSize
virtual QString getSize() const
Returns a string describing the size of this object.
Definition: KGpgNode.cpp:288
QAbstractItemModel::dataChanged
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
QAbstractItemModel::endInsertRows
void endInsertRows()
KgpgCore::TRUST_DISABLED
key is disabled by user (not owner)
Definition: kgpgkey.h:56
KgpgCore::ITYPE_SECRET
secret key
Definition: kgpgkey.h:92
QObject
KGpgItemModel::refreshGroups
void refreshGroups()
Definition: kgpgitemmodel.cpp:491
kgpgitemmodel.h
KgpgCore::Images::orphan
QPixmap orphan()
Definition: images.cpp:56
KGpgSettings::colorUltimate
static QColor colorUltimate()
Get Color used for ultimately trusted keys.
Definition: kgpgsettings.h:801
QList::isEmpty
bool isEmpty() const
QString::isEmpty
bool isEmpty() const
QAbstractItemModel::beginRemoveRows
void beginRemoveRows(const QModelIndex &parent, int first, int last)
KgpgCore::ITYPE_PUBLIC
public key
Definition: kgpgkey.h:93
KGpgUatNode::getPixmap
const QPixmap & getPixmap() const
Definition: KGpgUatNode.cpp:148
KGpgExpandableNode::getChildCount
virtual int getChildCount()
Return how many child nodes exist.
Definition: KGpgExpandableNode.cpp:49
KgpgCore::Convert::toString
QString toString(const KgpgKeyAlgo algorithm)
Definition: convert.cpp:35
QModelIndex::internalPointer
void * internalPointer() const
KGpgItemModel::refreshKeyIds
void refreshKeyIds(const QStringList &id)
Definition: kgpgitemmodel.cpp:447
KGpgItemModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
Definition: kgpgitemmodel.cpp:44
KGpgItemModel::~KGpgItemModel
virtual ~KGpgItemModel()
Definition: kgpgitemmodel.cpp:38
KGpgItemModel::data
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: kgpgitemmodel.cpp:95
KGpgItemModel::statusCountMessage
QString statusCountMessage() const
Definition: kgpgitemmodel.cpp:256
KGpgItemModel::changeGroup
void changeGroup(KGpgGroupNode *node, const KGpgNode::List &keys)
Definition: kgpgitemmodel.cpp:306
KGpgGroupMemberNode::getParentKeyNode
virtual KGpgGroupNode * getParentKeyNode() const
Definition: KGpgGroupMemberNode.cpp:97
QString
QList
QColor
KgpgCore::TRUST_FULL
you can fully trust this key
Definition: kgpgkey.h:63
KGpgGroupNode::readGroups
static QStringList readGroups()
get all groups from GnuPG config file
Definition: KGpgGroupNode.cpp:255
KgpgCore::ITYPE_GROUP
the element is a GnuPG key group
Definition: kgpgkey.h:91
QStringList
KGpgRootNode::addGroups
void addGroups(const QStringList &groups)
Create new group nodes.
Definition: KGpgRootNode.cpp:54
kgpgitemnode.h
QString::right
QString right(int n) const
QAbstractItemModel::createIndex
QModelIndex createIndex(int row, int column, void *ptr) const
KGpgNode::toOrphanNode
KGpgOrphanNode * toOrphanNode()
Definition: KGpgNode.cpp:240
KGpgItemModel::delNode
void delNode(KGpgNode *node)
Definition: kgpgitemmodel.cpp:298
KGpgNode
The abstract base class for all classes representing keyring data.
Definition: KGpgNode.h:42
KgpgCore::ITYPE_PAIR
key pair
Definition: kgpgkey.h:94
KGpgItemModel::getRootNode
KGpgRootNode * getRootNode() const
Definition: kgpgitemmodel.cpp:250
KgpgCore::TRUST_EXPIRED
key is beyond it's expiry date
Definition: kgpgkey.h:58
KgpgCore::ITYPE_REVSIGN
revokation signature
Definition: kgpgkey.h:101
KgpgCore::TRUST_UNDEFINED
trust value undefined (i.e. you did not set a trust level)
Definition: kgpgkey.h:59
KEYCOLUMN_EXPIR
#define KEYCOLUMN_EXPIR
Definition: kgpgitemmodel.h:33
KgpgCore::Images::group
QPixmap group()
Definition: images.cpp:48
KgpgCore::TRUST_REVOKED
key is revoked by owner
Definition: kgpgkey.h:57
KGpgRootNode::findKey
KGpgKeyNode * findKey(const QString &keyId)
Find a key node with the given id.
Definition: KGpgRootNode.cpp:118
QMetaObject::invokeMethod
bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, QGenericReturnArgument ret, QGenericArgument val0, QGenericArgument val1, QGenericArgument val2, QGenericArgument val3, QGenericArgument val4, QGenericArgument val5, QGenericArgument val6, QGenericArgument val7, QGenericArgument val8, QGenericArgument val9)
KGpgRootNode::addKeys
void addKeys(const QStringList &ids=QStringList())
Definition: KGpgRootNode.cpp:64
KGpgNode::toExpandableNode
KGpgExpandableNode * toExpandableNode()
Definition: KGpgNode.cpp:60
QAbstractItemModel::beginInsertRows
void beginInsertRows(const QModelIndex &parent, int first, int last)
KGpgItemModel::headerData
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Definition: kgpgitemmodel.cpp:363
KGpgSettings::colorGood
static QColor colorGood()
Get Color used for trusted keys.
Definition: kgpgsettings.h:725
kgpgsettings.h
KgpgCore::ITYPE_SIGN
signature (to a key, uid or uat)
Definition: kgpgkey.h:102
KgpgCore::Images::revoke
QPixmap revoke()
Definition: images.cpp:88
KGpgExpandableNode
The abstract base class for all classes that may have child objects.
Definition: KGpgExpandableNode.h:34
KGpgNode::toUatNode
KGpgUatNode * toUatNode()
Definition: KGpgNode.cpp:160
KGpgSettings
Definition: kgpgsettings.h:13
KGpgNode::toKeyNode
KGpgKeyNode * toKeyNode()
Definition: KGpgNode.cpp:94
QDateTime::date
QDate date() const
KGpgRootNode::findKeyRow
int findKeyRow(const QString &keyId)
Return the child number of the key with the given id.
Definition: KGpgRootNode.cpp:129
KGpgItemModel::refreshKeys
void refreshKeys(const QStringList &ids=QStringList())
Definition: kgpgitemmodel.cpp:441
KGpgNode::getId
virtual QString getId() const
Definition: KGpgNode.cpp:318
KGpgExpandableNode::wasExpanded
virtual bool wasExpanded() const
check if there are any child nodes present in memory
Definition: KGpgExpandableNode.cpp:64
KGpgNode::toUidNode
KGpgUidNode * toUidNode()
Definition: KGpgNode.cpp:128
KGpgGroupMemberNode
A member of a GnuPG group.
Definition: KGpgGroupMemberNode.h:35
KGpgNode::m_parent
KGpgExpandableNode * m_parent
Definition: KGpgNode.h:50
KgpgCore::ITYPE_UAT
user attribute to a key (i.e. photo id)
Definition: kgpgkey.h:100
KGpgSettings::colorMarginal
static QColor colorMarginal()
Get Color used for marginally trusted keys.
Definition: kgpgsettings.h:820
QList::ConstIterator
typedef ConstIterator
KGpgNode::getEmail
virtual QString getEmail() const
Definition: KGpgNode.cpp:300
KGpgNode::getChild
virtual KGpgNode * getChild(const int index) const
Returns the child node at the given index.
Definition: KGpgNode.cpp:268
QModelIndex::column
int column() const
KGpgRootNode::groupChildren
int groupChildren() const
Return the group count.
Definition: KGpgRootNode.cpp:150
QString::length
int length() const
KGpgNode::getChildCount
virtual int getChildCount()
Return how many child nodes exist.
Definition: KGpgNode.cpp:262
QAbstractItemModel
KGpgItemModel::nodeForIndex
KGpgNode * nodeForIndex(const QModelIndex &index) const
Definition: kgpgitemmodel.cpp:230
KGpgNode::getName
virtual QString getName() const
Definition: KGpgNode.cpp:294
KGpgItemModel::nodeIndex
QModelIndex nodeIndex(KGpgNode *node, const int column=0)
Definition: kgpgitemmodel.cpp:406
KGpgSignableNode::getSignCount
virtual QString getSignCount() const
count signatures
Definition: KGpgSignableNode.cpp:46
KGpgItemModel::deleteFromGroup
void deleteFromGroup(KGpgGroupNode *group, KGpgGroupMemberNode *member)
Definition: kgpgitemmodel.cpp:348
KGpgNode::toSubkeyNode
KGpgSubkeyNode * toSubkeyNode()
Definition: KGpgNode.cpp:144
KGpgItemModel::setDefaultKey
void setDefaultKey(KGpgKeyNode *def)
Definition: kgpgitemmodel.cpp:384
KgpgCore::TRUST_UNKNOWN
trust value unknown (i.e. no entry in gpg's trust database)
Definition: kgpgkey.h:60
KGpgGroupNode::saveMembers
void saveMembers()
Write the current members to GnuPG config file.
Definition: KGpgGroupNode.cpp:202
QList::constEnd
const_iterator constEnd() const
QAbstractItemModel::endRemoveRows
void endRemoveRows()
KgpgCore::TRUST_ULTIMATE
this key has highest possible level of trust (e.g. your own secret keys)
Definition: kgpgkey.h:64
QList::constBegin
const_iterator constBegin() const
QAbstractItemModel::endResetModel
void endResetModel()
KGpgNode::hasChildren
virtual bool hasChildren() const
Returns if this node has child nodes.
Definition: KGpgNode.cpp:256
QObject::parent
QObject * parent() const
KgpgCore::Images::pair
QPixmap pair()
Definition: images.cpp:40
KGpgNode::getTrust
virtual KgpgCore::KgpgKeyTrust getTrust() const
Definition: KGpgNode.cpp:282
KgpgCore::TRUST_INVALID
key is invalid
Definition: kgpgkey.h:55
KgpgCore::ITYPE_UID
additional user id
Definition: kgpgkey.h:99
convert.h
KGpgItemModel::columnCount
virtual int columnCount(const QModelIndex &) const
Definition: kgpgitemmodel.h:62
KEYCOLUMN_EMAIL
#define KEYCOLUMN_EMAIL
Definition: kgpgitemmodel.h:31
defaultKey
static QString defaultKey()
Definition: kgpgsettings_addons.h:23
KgpgCore::TRUST_NONE
there is no trusted path to this key
Definition: kgpgkey.h:61
KgpgCore::Images::userId
QPixmap userId()
Definition: images.cpp:72
KEYCOLUMN_NAME
#define KEYCOLUMN_NAME
Definition: kgpgitemmodel.h:30
KGpgSettings::colorBad
static QColor colorBad()
Get Color used for untrusted keys.
Definition: kgpgsettings.h:782
QVariant
KEYCOLUMN_ID
#define KEYCOLUMN_ID
Definition: kgpgitemmodel.h:36
KgpgCore::Images::single
QPixmap single()
Definition: images.cpp:32
KgpgCore::ITYPE_SUB
subkey of a public or secret key
Definition: kgpgkey.h:98
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:42:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kgpg

Skip menu "kgpg"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • ktimer
  • kwallet
  • sweeper

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal