• 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
keylistproxymodel.cpp
Go to the documentation of this file.
1 /* Copyright 2008,2009,2010,2012,2013 Rolf Eike Beer <kde@opensource.sf-tec.de>
2  * Copyright 2013 Thomas Fischer <fischer@unix-ag.uni-kl.de>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of
7  * the License or (at your option) version 3 or any later version
8  * accepted by the membership of KDE e.V. (or its successor approved
9  * by the membership of KDE e.V.), which shall act as a proxy
10  * defined in Section 14 of version 3 of the license.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #include "keylistproxymodel.h"
21 #include "model/kgpgitemnode.h"
22 #include "kgpgitemmodel.h"
23 #include "kgpgsettings.h"
24 #include "core/kgpgkey.h"
25 #include "core/images.h"
26 
27 #include <KLocale>
28 #include <QDate>
29 
30 using namespace KgpgCore;
31 
32 class KeyListProxyModelPrivate {
33  KeyListProxyModel * const q_ptr;
34 
35  Q_DECLARE_PUBLIC(KeyListProxyModel)
36 public:
37  KeyListProxyModelPrivate(KeyListProxyModel *parent, const KeyListProxyModel::DisplayMode mode);
38 
39  bool lessThan(const KGpgNode *left, const KGpgNode *right, const int column) const;
40  bool nodeLessThan(const KGpgNode *left, const KGpgNode *right, const int column) const;
41  KGpgItemModel *m_model;
42  bool m_onlysecret;
43  bool m_encryptionKeys;
44  KgpgCore::KgpgKeyTrustFlag m_mintrust;
45  int m_previewsize;
46  int m_idLength;
47  KeyListProxyModel::DisplayMode m_displaymode;
48  int m_emailSorting;
49 
50  QString reorderEmailComponents(const QString &emailAddress) const;
51  QVariant dataSingleColumn(const QModelIndex &index, int role, const KGpgNode *node) const;
52  QVariant dataMultiColumn(const QModelIndex &index, int role, const KGpgNode *node) const;
53 };
54 
55 KeyListProxyModelPrivate::KeyListProxyModelPrivate(KeyListProxyModel *parent, const KeyListProxyModel::DisplayMode mode)
56  : q_ptr(parent),
57  m_model(NULL),
58  m_onlysecret(false),
59  m_encryptionKeys(false),
60  m_mintrust(TRUST_UNKNOWN),
61  m_previewsize(22),
62  m_idLength(8),
63  m_displaymode(mode),
64  m_emailSorting(KGpgSettings::emailSorting())
65 {
66 }
67 
72 static QString reverseListAndJoinWithChar(const QStringList &list, const QChar &separator)
73 {
74  QString result = list.last();
75  for (int i = list.count() - 2; i >= 0; --i)
76  result.append(separator).append(list[i]);
77  return result;
78 }
79 
80 QString
81 KeyListProxyModelPrivate::reorderEmailComponents(const QString &emailAddress) const
82 {
83  if (emailAddress.isEmpty())
84  return QString();
85 
87  static const QChar charAt = QLatin1Char('@');
89  static const QChar charDot = QLatin1Char('.');
90 
92  QString result = emailAddress.toLower();
93 
94  switch (m_emailSorting) {
95  case KGpgSettings::EnumEmailSorting::TLDfirst:
96  {
99  const QStringList emailComponents = result.split(charAt);
100  if (emailComponents.count() != 2)
101  break;
104  const QString fqdn = emailComponents.last();
105  QStringList fqdnComponents = fqdn.split(charDot);
106  if (fqdnComponents.count() < 2)
107  return fqdn + charDot + emailComponents.first();
108  fqdnComponents.insert(0, emailComponents.first());
112  result = reverseListAndJoinWithChar(fqdnComponents, charDot);
113  break;
114  }
115  case KGpgSettings::EnumEmailSorting::DomainFirst:
116  {
119  const QStringList emailComponents = result.split(charAt);
120  if (emailComponents.count() != 2)
121  break;
124  const QString fqdn = emailComponents.last();
125  QStringList fqdnComponents = fqdn.split(charDot);
126  if (fqdnComponents.count() < 2)
127  return fqdn + charDot + emailComponents.first();
128  result = charDot + fqdnComponents.takeLast();
131  result.prepend(fqdnComponents.takeLast());
133  result.append(charDot).append(fqdnComponents.join(charDot));
135  result.append(charDot).append(emailComponents.first());
136  break;
137  }
138  case KGpgSettings::EnumEmailSorting::FQDNFirst:
139  {
142  const QStringList emailComponents = result.split(charAt);
145  result = reverseListAndJoinWithChar(emailComponents, charDot);
146  break;
147  }
148  case KGpgSettings::EnumEmailSorting::Alphabetical:
150  break;
151  }
152 
153  return result;
154 }
155 
156 QVariant
157 KeyListProxyModelPrivate::dataSingleColumn(const QModelIndex &index, int role, const KGpgNode *node) const
158 {
159  Q_Q(const KeyListProxyModel);
160 
161  if (index.column() != 0)
162  return QVariant();
163 
164  switch (role) {
165  case Qt::DecorationRole:
166  if (node->getType() == ITYPE_UAT) {
167  if (m_previewsize > 0) {
168  const KGpgUatNode *nd = node->toUatNode();
169  return nd->getPixmap().scaled(m_previewsize + 5, m_previewsize, Qt::KeepAspectRatio);
170  } else {
171  return Images::photo();
172  }
173  } else {
174  return m_model->data(q->mapToSource(index), Qt::DecorationRole);
175  }
176  case Qt::DisplayRole: {
177  const QModelIndex srcidx(q->mapToSource(index));
178  const int srcrow = srcidx.row();
179 
180  const QModelIndex ididx(srcidx.sibling(srcrow, KEYCOLUMN_ID));
181  const QString id(m_model->data(ididx, Qt::DisplayRole).toString().right(m_idLength));
182 
183  const QModelIndex mailidx(srcidx.sibling(srcrow, KEYCOLUMN_EMAIL));
184  const QString mail(m_model->data(mailidx, Qt::DisplayRole).toString());
185 
186  const QModelIndex nameidx(srcidx.sibling(srcrow, KEYCOLUMN_NAME));
187  const QString name(m_model->data(nameidx, Qt::DisplayRole).toString());
188 
189  if (m_displaymode == KeyListProxyModel::SingleColumnIdFirst) {
190  if (mail.isEmpty())
191  return i18nc("ID: Name", "%1: %2", id, name);
192  else
193  return i18nc("ID: Name <Email>", "%1: %2 &lt;%3&gt;", id, name, mail);
194  } else {
195  if (mail.isEmpty())
196  return i18nc("Name: ID", "%1: %2", name, id);
197  else
198  return i18nc("Name <Email>: ID", "%1 &lt;%2&gt;: %3", name, mail, id);
199  }
200  }
201  case Qt::ToolTipRole: {
202  const QModelIndex srcidx(q->mapToSource(index));
203  const int srcrow = srcidx.row();
204 
205  const QModelIndex ididx(srcidx.sibling(srcrow, KEYCOLUMN_ID));
206  return m_model->data(ididx, Qt::DisplayRole);
207  }
208  default:
209  return QVariant();
210  }
211 }
212 
213 QVariant
214 KeyListProxyModelPrivate::dataMultiColumn(const QModelIndex &index, int role, const KGpgNode *node) const
215 {
216  Q_Q(const KeyListProxyModel);
217 
218  if ((node->getType() == ITYPE_UAT) && (role == Qt::DecorationRole) && (index.column() == 0)) {
219  if (m_previewsize > 0) {
220  const KGpgUatNode *nd = node->toUatNode();
221  return nd->getPixmap().scaled(m_previewsize + 5, m_previewsize, Qt::KeepAspectRatio);
222  } else {
223  return Images::photo();
224  }
225  } else if ((role == Qt::DisplayRole) && (index.column() == KEYCOLUMN_ID)) {
226  QString id = m_model->data(q->mapToSource(index), Qt::DisplayRole).toString();
227  return id.right(m_idLength);
228  }
229  return m_model->data(q->mapToSource(index), role);
230 }
231 
232 KeyListProxyModel::KeyListProxyModel(QObject *parent, const DisplayMode mode)
233  : QSortFilterProxyModel(parent),
234  d_ptr(new KeyListProxyModelPrivate(this, mode))
235 {
236  setFilterCaseSensitivity(Qt::CaseInsensitive);
237  setFilterKeyColumn(-1);
238  setDynamicSortFilter(true);
239 }
240 
241 KeyListProxyModel::~KeyListProxyModel()
242 {
243  delete d_ptr;
244 }
245 
246 bool
247 KeyListProxyModel::hasChildren(const QModelIndex &idx) const
248 {
249  return sourceModel()->hasChildren(mapToSource(idx));
250 }
251 
252 void
253 KeyListProxyModel::setKeyModel(KGpgItemModel *md)
254 {
255  Q_D(KeyListProxyModel);
256 
257  d->m_model = md;
258  setSourceModel(md);
259 }
260 
261 bool
262 KeyListProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
263 {
264  Q_D(const KeyListProxyModel);
265 
266  KGpgNode *l = d->m_model->nodeForIndex(left);
267  KGpgNode *r = d->m_model->nodeForIndex(right);
268 
269  return d->lessThan(l, r, left.column());
270 }
271 
272 bool
273 KeyListProxyModelPrivate::lessThan(const KGpgNode *left, const KGpgNode *right, const int column) const
274 {
275  const KGpgRootNode * const r = m_model->getRootNode();
276  Q_ASSERT(r != left);
277  Q_ASSERT(r != right);
278 
279  if (r == left->getParentKeyNode()) {
280  if (r == right->getParentKeyNode()) {
281  if (left->getType() == ITYPE_GROUP) {
282  if (right->getType() == ITYPE_GROUP)
283  return left->getName() < right->getName();
284  else
285  return true;
286  } else if (right->getType() == ITYPE_GROUP)
287  return false;
288 
289  // we don't need to care about group members here because they will never have root as parent
290  bool test1 = (left->getType() & ITYPE_PUBLIC) && !(left->getType() & ITYPE_SECRET); // only a public key
291  bool test2 = (right->getType() & ITYPE_PUBLIC) && !(right->getType() & ITYPE_SECRET); // only a public key
292 
293  // key-pair goes before simple public key
294  // extra check needed to get sorting by trust right
295  if (left->getType() == ITYPE_PAIR && test2) return (column != KEYCOLUMN_TRUST);
296  if (right->getType() == ITYPE_PAIR && test1) return (column == KEYCOLUMN_TRUST);
297 
298  return nodeLessThan(left, right, column);
299  } else {
300  return lessThan(left, right->getParentKeyNode(), column);
301  }
302  } else {
303  if (r == right->getParentKeyNode()) {
304  return lessThan(left->getParentKeyNode(), right, column);
305  } else if (left->getParentKeyNode() == right->getParentKeyNode()) {
306  if (left->getType() != right->getType())
307  return (left->getType() < right->getType());
308 
309  return nodeLessThan(left, right, column);
310  } else {
311  return lessThan(left->getParentKeyNode(), right->getParentKeyNode(), column);
312  }
313  }
314  return false;
315 }
316 
317 bool
318 KeyListProxyModelPrivate::nodeLessThan(const KGpgNode *left, const KGpgNode *right, const int column) const
319 {
320  Q_ASSERT(left->getType() == right->getType());
321 
322  switch (column) {
323  case KEYCOLUMN_NAME:
324  if (left->getType() == ITYPE_SIGN) {
325  if (left->getName().startsWith(QLatin1Char( '[' )) && !right->getName().startsWith(QLatin1Char( '[' )))
326  return false;
327  else if (!left->getName().startsWith(QLatin1Char( '[' )) && right->getName().startsWith(QLatin1Char( '[' )))
328  return true;
329  else if (left->getName().startsWith(QLatin1Char( '[' )) && right->getName().startsWith(QLatin1Char( '[' )))
330  return (left->getId() < right->getId());
331  }
332  return (left->getName().compare(right->getName().toLower(), Qt::CaseInsensitive) < 0);
333  case KEYCOLUMN_EMAIL:
335  return (reorderEmailComponents(left->getEmail()) < reorderEmailComponents(right->getEmail()));
336  case KEYCOLUMN_TRUST:
337  return (left->getTrust() < right->getTrust());
338  case KEYCOLUMN_EXPIR:
339  return (left->getExpiration() < right->getExpiration());
340  case KEYCOLUMN_SIZE:
341  if ((left->getType() & ITYPE_PAIR) && (right->getType() & ITYPE_PAIR)) {
342  unsigned int lsign, lenc, rsign, renc;
343 
344  if (left->getType() & ITYPE_GROUP) {
345  const KGpgGroupMemberNode *g = static_cast<const KGpgGroupMemberNode *>(left);
346 
347  lsign = g->getSignKeySize();
348  lenc = g->getEncryptionKeySize();
349  } else {
350  const KGpgKeyNode *g = static_cast<const KGpgKeyNode *>(left);
351 
352  lsign = g->getSignKeySize();
353  lenc = g->getEncryptionKeySize();
354  }
355 
356  if (right->getType() & ITYPE_GROUP) {
357  const KGpgGroupMemberNode *g = static_cast<const KGpgGroupMemberNode *>(right);
358 
359  rsign = g->getSignKeySize();
360  renc = g->getEncryptionKeySize();
361  } else {
362  const KGpgKeyNode *g = static_cast<const KGpgKeyNode *>(right);
363 
364  rsign = g->getSignKeySize();
365  renc = g->getEncryptionKeySize();
366  }
367 
368  if (lsign != rsign)
369  return lsign < rsign;
370  else
371  return lenc < renc;
372  } else {
373  return (left->getSize() < right->getSize());
374  }
375  case KEYCOLUMN_CREAT:
376  return (left->getCreation() < right->getCreation());
377  default:
378  Q_ASSERT(column == KEYCOLUMN_ID);
379  return (left->getId().right(m_idLength) < right->getId().right(m_idLength));
380  }
381 }
382 
383 bool
384 KeyListProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
385 {
386  Q_D(const KeyListProxyModel);
387  QModelIndex idx = d->m_model->index(source_row, 0, source_parent);
388  const KGpgNode *l = d->m_model->nodeForIndex(idx);
389 
390  if (l == d->m_model->getRootNode())
391  return false;
392 
393  if (d->m_onlysecret) {
394  switch (l->getType()) {
395  case ITYPE_PUBLIC:
396  case ITYPE_GPUBLIC:
397  case ITYPE_GROUP:
398  return false;
399  default:
400  break;
401  }
402  }
403 
404  switch (d->m_displaymode) {
405  case SingleColumnIdFirst:
406  case SingleColumnIdLast:
407  if (l->getType() == ITYPE_GROUP)
408  return false;
409  default:
410  break;
411  }
412 
413  if (l->getTrust() < d->m_mintrust)
414  return false;
415 
416  /* check for expired signatures */
417  if ((d->m_mintrust > TRUST_EXPIRED) && (l->getType() == ITYPE_SIGN)) {
418  const QDateTime expDate = l->toSignNode()->getExpiration();
419  if (expDate.isValid() && (expDate < QDateTime::currentDateTime()))
420  return false;
421  }
422 
423  if (l->getParentKeyNode() != d->m_model->getRootNode())
424  return true;
425 
426  if (d->m_encryptionKeys && ((l->getType() & ITYPE_GROUP) == 0)) {
427  if (!l->toKeyNode()->canEncrypt())
428  return false;
429  }
430 
431  if (l->getName().contains(filterRegExp()))
432  return true;
433 
434  if (l->getEmail().contains(filterRegExp()))
435  return true;
436 
437  if (l->getId().contains(filterRegExp()))
438  return true;
439 
440  return false;
441 }
442 
443 void
444 KeyListProxyModel::setOnlySecret(const bool b)
445 {
446  Q_D(KeyListProxyModel);
447 
448  d->m_onlysecret = b;
449  invalidateFilter();
450 }
451 
452 void
453 KeyListProxyModel::settingsChanged()
454 {
455  Q_D(KeyListProxyModel);
456 
457  const int newSort = KGpgSettings::emailSorting();
458 
459  if (newSort != d->m_emailSorting) {
460  d->m_emailSorting = newSort;
461  invalidate();
462  }
463 }
464 
465 void
466 KeyListProxyModel::setTrustFilter(const KgpgCore::KgpgKeyTrustFlag t)
467 {
468  Q_D(KeyListProxyModel);
469 
470  d->m_mintrust = t;
471  invalidateFilter();
472 }
473 
474 void
475 KeyListProxyModel::setEncryptionKeyFilter(bool b)
476 {
477  Q_D(KeyListProxyModel);
478 
479  d->m_encryptionKeys = b;
480  invalidateFilter();
481 }
482 
483 KGpgNode *
484 KeyListProxyModel::nodeForIndex(const QModelIndex &index) const
485 {
486  Q_D(const KeyListProxyModel);
487 
488  return d->m_model->nodeForIndex(mapToSource(index));
489 }
490 
491 QModelIndex
492 KeyListProxyModel::nodeIndex(KGpgNode *node)
493 {
494  Q_D(KeyListProxyModel);
495 
496  return mapFromSource(d->m_model->nodeIndex(node));
497 }
498 
499 void
500 KeyListProxyModel::setPreviewSize(const int pixel)
501 {
502  Q_D(KeyListProxyModel);
503 
504  emit layoutAboutToBeChanged();
505  d->m_previewsize = pixel;
506  emit layoutChanged();
507 }
508 
509 QVariant
510 KeyListProxyModel::data(const QModelIndex &index, int role) const
511 {
512  Q_D(const KeyListProxyModel);
513 
514  if (!index.isValid())
515  return QVariant();
516 
517  const KGpgNode *node = nodeForIndex(index);
518 
519  switch (d->m_displaymode) {
520  case MultiColumn:
521  return d->dataMultiColumn(index, role, node);
522  case SingleColumnIdFirst:
523  case SingleColumnIdLast:
524  return d->dataSingleColumn(index, role, node);
525  }
526 
527  Q_ASSERT(0);
528 
529  return QVariant();
530 }
531 
532 KGpgItemModel *
533 KeyListProxyModel::getModel() const
534 {
535  Q_D(const KeyListProxyModel);
536 
537  return d->m_model;
538 }
539 
540 int
541 KeyListProxyModel::idLength() const
542 {
543  Q_D(const KeyListProxyModel);
544 
545  return d->m_idLength;
546 }
547 
548 void
549 KeyListProxyModel::setIdLength(const int length)
550 {
551  Q_D(KeyListProxyModel);
552 
553  if (length == d->m_idLength)
554  return;
555 
556  d->m_idLength = length;
557  invalidate();
558 }
559 
560 bool
561 KeyListProxyModel::setData(const QModelIndex &index, const QVariant &value, int role)
562 {
563  Q_UNUSED(role);
564 
565  if (value.type() != QVariant::String)
566  return false;
567 
568  KGpgNode *node = nodeForIndex(index);
569 
570  if (!node)
571  return false;
572 
573  const QString newName = value.toString();
574 
575  if (newName.isEmpty() || (newName == node->getName()))
576  return false;
577 
578  node->toGroupNode()->rename(newName);
579 
580  return true;
581 }
582 
583 Qt::ItemFlags
584 KeyListProxyModel::flags(const QModelIndex &index) const
585 {
586  KGpgNode *node = nodeForIndex(index);
587  Qt::ItemFlags flags = QSortFilterProxyModel::flags(index);
588 
589  if ((node->getType() == ITYPE_GROUP) && (index.column() == KEYCOLUMN_NAME))
590  flags |= Qt::ItemIsEditable;
591 
592  return flags;
593 }
594 
595 #include "keylistproxymodel.moc"
QSortFilterProxyModel::invalidate
void invalidate()
KEYCOLUMN_SIZE
#define KEYCOLUMN_SIZE
Definition: kgpgitemmodel.h:34
KGpgItemModel
Definition: kgpgitemmodel.h:44
KgpgCore::KgpgKeyTrustFlag
KgpgKeyTrustFlag
trust levels of keys, uids and uats
Definition: kgpgkey.h:52
QModelIndex
KeyListProxyModel::DisplayMode
DisplayMode
Definition: keylistproxymodel.h:40
QString::append
QString & append(QChar ch)
KEYCOLUMN_TRUST
#define KEYCOLUMN_TRUST
Definition: kgpgitemmodel.h:32
QSortFilterProxyModel::setFilterCaseSensitivity
void setFilterCaseSensitivity(Qt::CaseSensitivity cs)
KGpgNode::getParentKeyNode
KGpgExpandableNode * getParentKeyNode() const
Returns the parent node in the key hierarchy.
Definition: KGpgNode.cpp:330
QSortFilterProxyModel::flags
virtual Qt::ItemFlags flags(const QModelIndex &index) const
QAbstractItemModel::layoutChanged
void layoutChanged()
KGpgSettings::EnumEmailSorting::DomainFirst
Definition: kgpgsettings.h:54
QSortFilterProxyModel::setSourceModel
virtual void setSourceModel(QAbstractItemModel *sourceModel)
KGpgSettings::EnumEmailSorting::Alphabetical
Definition: kgpgsettings.h:54
QChar
QString::split
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
KeyListProxyModel::~KeyListProxyModel
virtual ~KeyListProxyModel()
Definition: keylistproxymodel.cpp:241
QString::prepend
QString & prepend(QChar ch)
KGpgGroupMemberNode::getEncryptionKeySize
virtual unsigned int getEncryptionKeySize() const
Returns the size of the first encryption subkey.
Definition: KGpgGroupMemberNode.cpp:89
KeyListProxyModel::setEncryptionKeyFilter
void setEncryptionKeyFilter(bool b)
show only keys capable of encryption
Definition: keylistproxymodel.cpp:475
KgpgCore::ITYPE_GPUBLIC
public key as member of a key group
Definition: kgpgkey.h:96
KeyListProxyModel::nodeForIndex
KGpgNode * nodeForIndex(const QModelIndex &index) const
Definition: keylistproxymodel.cpp:484
KGpgUatNode
A user attribute (i.e.
Definition: KGpgUatNode.h:36
KgpgCore::Images::photo
QPixmap photo()
Definition: images.cpp:80
reverseListAndJoinWithChar
static QString reverseListAndJoinWithChar(const QStringList &list, const QChar &separator)
Reverses the list's order (this modifies the list) and returns a string containing the reversed list'...
Definition: keylistproxymodel.cpp:72
images.h
kgpgkey.h
QStringList::join
QString join(const QString &separator) const
KeyListProxyModel::setKeyModel
void setKeyModel(KGpgItemModel *)
Definition: keylistproxymodel.cpp:253
KGpgSignNode::getExpiration
virtual QDateTime getExpiration() const
Definition: KGpgSignNode.cpp:64
KeyListProxyModel::lessThan
virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const
Definition: keylistproxymodel.cpp:262
KGpgKeyNode
A public key with or without corresponding secret key.
Definition: KGpgKeyNode.h:33
KEYCOLUMN_CREAT
#define KEYCOLUMN_CREAT
Definition: kgpgitemmodel.h:35
QAbstractItemModel::layoutAboutToBeChanged
void layoutAboutToBeChanged()
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
KGpgSettings::emailSorting
static int emailSorting()
Get EmailSorting.
Definition: kgpgsettings.h:877
KGpgNode::getExpiration
virtual QDateTime getExpiration() const
Definition: KGpgNode.cpp:306
KGpgGroupMemberNode::getSignKeySize
virtual unsigned int getSignKeySize() const
Returns the size of the signing key.
Definition: KGpgGroupMemberNode.cpp:81
QList::count
int count(const T &value) const
KGpgRootNode
The parent of all key data objects.
Definition: KGpgRootNode.h:38
KeyListProxyModel::setTrustFilter
void setTrustFilter(const KgpgCore::KgpgKeyTrustFlag t)
set the minimum trust level to be shown
Definition: keylistproxymodel.cpp:466
KGpgNode::getSize
virtual QString getSize() const
Returns a string describing the size of this object.
Definition: KGpgNode.cpp:288
KGpgGroupNode::rename
void rename(const QString &newName)
Rename this group node.
Definition: KGpgGroupNode.cpp:173
KGpgSettings::EnumEmailSorting::FQDNFirst
Definition: kgpgsettings.h:54
KgpgCore::ITYPE_SECRET
secret key
Definition: kgpgkey.h:92
QObject
KeyListProxyModel::hasChildren
virtual bool hasChildren(const QModelIndex &idx) const
Definition: keylistproxymodel.cpp:247
kgpgitemmodel.h
KGpgKeyNode::canEncrypt
bool canEncrypt() const
return if this key can be used for encryption
Definition: KGpgKeyNode.cpp:355
QString::isEmpty
bool isEmpty() const
QModelIndex::row
int row() const
KgpgCore::ITYPE_PUBLIC
public key
Definition: kgpgkey.h:93
QString::startsWith
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
KGpgUatNode::getPixmap
const QPixmap & getPixmap() const
Definition: KGpgUatNode.cpp:148
KeyListProxyModel::idLength
int idLength() const
KgpgCore::Convert::toString
QString toString(const KgpgKeyAlgo algorithm)
Definition: convert.cpp:35
QSortFilterProxyModel::invalidateFilter
void invalidateFilter()
QSortFilterProxyModel::setDynamicSortFilter
void setDynamicSortFilter(bool enable)
QList::first
T & first()
QPixmap::scaled
QPixmap scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const
QString
KeyListProxyModel::flags
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Definition: keylistproxymodel.cpp:584
KgpgCore::ITYPE_GROUP
the element is a GnuPG key group
Definition: kgpgkey.h:91
QStringList
KeyListProxyModel::d_ptr
KeyListProxyModelPrivate *const d_ptr
Definition: keylistproxymodel.h:37
kgpgitemnode.h
QString::right
QString right(int n) const
KeyListProxyModel::setData
virtual bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
Definition: keylistproxymodel.cpp:561
QString::toLower
QString toLower() const
KeyListProxyModel::setIdLength
void setIdLength(const int length)
Definition: keylistproxymodel.cpp:549
KGpgKeyNode::getEncryptionKeySize
virtual unsigned int getEncryptionKeySize() const
Returns the size of the first encryption subkey.
Definition: KGpgKeyNode.cpp:205
KGpgNode
The abstract base class for all classes representing keyring data.
Definition: KGpgNode.h:42
KgpgCore::ITYPE_PAIR
key pair
Definition: kgpgkey.h:94
QString::contains
bool contains(QChar ch, Qt::CaseSensitivity cs) const
KGpgItemModel::getRootNode
KGpgRootNode * getRootNode() const
Definition: kgpgitemmodel.cpp:250
KgpgCore::TRUST_EXPIRED
key is beyond it's expiry date
Definition: kgpgkey.h:58
QLatin1Char
QSortFilterProxyModel
KEYCOLUMN_EXPIR
#define KEYCOLUMN_EXPIR
Definition: kgpgitemmodel.h:33
KGpgKeyNode::getSignKeySize
virtual unsigned int getSignKeySize() const
Returns the size of the signing key.
Definition: KGpgKeyNode.cpp:199
KeyListProxyModel::filterAcceptsRow
virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
Definition: keylistproxymodel.cpp:384
QDateTime::isValid
bool isValid() const
KeyListProxyModel::MultiColumn
Definition: keylistproxymodel.h:41
kgpgsettings.h
KgpgCore::ITYPE_SIGN
signature (to a key, uid or uat)
Definition: kgpgkey.h:102
KeyListProxyModel
Definition: keylistproxymodel.h:30
KeyListProxyModel::SingleColumnIdFirst
Definition: keylistproxymodel.h:42
KeyListProxyModel::SingleColumnIdLast
Definition: keylistproxymodel.h:43
KGpgNode::toUatNode
KGpgUatNode * toUatNode()
Definition: KGpgNode.cpp:160
QAbstractProxyModel::sourceModel
QAbstractItemModel * sourceModel() const
QSortFilterProxyModel::mapToSource
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const
QList::takeLast
T takeLast()
KGpgSettings
Definition: kgpgsettings.h:13
QDateTime::currentDateTime
QDateTime currentDateTime()
KGpgNode::toKeyNode
KGpgKeyNode * toKeyNode()
Definition: KGpgNode.cpp:94
QModelIndex::data
QVariant data(int role) const
KeyListProxyModel::getModel
KGpgItemModel * getModel() const
Definition: keylistproxymodel.cpp:533
KeyListProxyModel::setOnlySecret
void setOnlySecret(const bool b)
set if only secret keys should be shown
Definition: keylistproxymodel.cpp:444
QList::insert
void insert(int i, const T &value)
QAbstractItemModel::hasChildren
virtual bool hasChildren(const QModelIndex &parent) const
KGpgNode::getId
virtual QString getId() const
Definition: KGpgNode.cpp:318
QSortFilterProxyModel::mapFromSource
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const
KGpgGroupMemberNode
A member of a GnuPG group.
Definition: KGpgGroupMemberNode.h:35
KgpgCore::ITYPE_UAT
user attribute to a key (i.e. photo id)
Definition: kgpgkey.h:100
KGpgNode::toGroupNode
KGpgGroupNode * toGroupNode()
Definition: KGpgNode.cpp:176
QList::last
T & last()
KeyListProxyModel::KeyListProxyModel
KeyListProxyModel(QObject *parent=0, const DisplayMode mode=MultiColumn)
Definition: keylistproxymodel.cpp:232
KGpgNode::getEmail
virtual QString getEmail() const
Definition: KGpgNode.cpp:300
QModelIndex::column
int column() const
KGpgNode::toSignNode
KGpgSignNode * toSignNode()
Definition: KGpgNode.cpp:224
KGpgItemModel::nodeForIndex
KGpgNode * nodeForIndex(const QModelIndex &index) const
Definition: kgpgitemmodel.cpp:230
KGpgNode::getName
virtual QString getName() const
Definition: KGpgNode.cpp:294
KeyListProxyModel::data
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: keylistproxymodel.cpp:510
KeyListProxyModel::nodeIndex
QModelIndex nodeIndex(KGpgNode *node)
Definition: keylistproxymodel.cpp:492
KeyListProxyModel::setPreviewSize
void setPreviewSize(const int pixel)
Definition: keylistproxymodel.cpp:500
KgpgCore::TRUST_UNKNOWN
trust value unknown (i.e. no entry in gpg's trust database)
Definition: kgpgkey.h:60
QVariant::type
Type type() const
KGpgSettings::EnumEmailSorting::TLDfirst
Definition: kgpgsettings.h:54
QString::compare
int compare(const QString &other) const
KGpgNode::getTrust
virtual KgpgCore::KgpgKeyTrust getTrust() const
Definition: KGpgNode.cpp:282
QString::data
QChar * data()
QVariant::toString
QString toString() const
QSortFilterProxyModel::setFilterKeyColumn
void setFilterKeyColumn(int column)
KEYCOLUMN_EMAIL
#define KEYCOLUMN_EMAIL
Definition: kgpgitemmodel.h:31
KeyListProxyModel::settingsChanged
void settingsChanged()
call this when the settings have changed
Definition: keylistproxymodel.cpp:453
QDateTime
KEYCOLUMN_NAME
#define KEYCOLUMN_NAME
Definition: kgpgitemmodel.h:30
QSortFilterProxyModel::filterRegExp
QRegExp filterRegExp() const
KGpgNode::m_model
KGpgItemModel * m_model
Definition: KGpgNode.h:51
QVariant
KEYCOLUMN_ID
#define KEYCOLUMN_ID
Definition: kgpgitemmodel.h:36
Qt::ItemFlags
typedef ItemFlags
keylistproxymodel.h
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