• 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.h
Go to the documentation of this file.
1 /* Copyright 2008,2009,2010,2011,2012 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 #ifndef KGPGITEMMODEL_H
20 #define KGPGITEMMODEL_H
21 
22 #include "core/kgpgkey.h"
23 #include "core/KGpgKeyNode.h"
24 #include "core/KGpgNode.h"
25 
26 #include <QAbstractItemModel>
27 #include <QString>
28 #include <QStringList>
29 
30 #define KEYCOLUMN_NAME 0
31 #define KEYCOLUMN_EMAIL 1
32 #define KEYCOLUMN_TRUST 2
33 #define KEYCOLUMN_EXPIR 3
34 #define KEYCOLUMN_SIZE 4
35 #define KEYCOLUMN_CREAT 5
36 #define KEYCOLUMN_ID 6
37 
38 class KGpgExpandableNode;
39 class KGpgGroupNode;
40 class KGpgGroupMemberNode;
41 class KGpgRootNode;
42 class QColor;
43 
44 class KGpgItemModel : public QAbstractItemModel
45 {
46  Q_OBJECT
47 
48 private:
49  KGpgRootNode *m_root;
50  QString m_default;
51 
52 public:
53 
54  explicit KGpgItemModel(QObject *parent = 0);
55  virtual ~KGpgItemModel();
56 
57  virtual QModelIndex index(int row, int column,
58  const QModelIndex &parent = QModelIndex()) const;
59  virtual QModelIndex parent(const QModelIndex &child) const;
60 
61  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
62  virtual int columnCount(const QModelIndex & /*parent = QModelIndex()*/ ) const
63  { return 7; }
64 
65  virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
66  virtual bool hasChildren(const QModelIndex &parent) const;
67  virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
68 
69  KGpgNode *nodeForIndex(const QModelIndex &index) const;
70  KGpgKeyNode *findKeyNode(const QString &id) const;
71 
72  KGpgRootNode *getRootNode() const;
73  QString statusCountMessage() const;
74  static QString statusCountMessageString(const unsigned int keys, const unsigned int groups);
75  bool isDefaultKey(const KGpgNode *node) const;
76 
77 public Q_SLOTS:
78  KGpgGroupNode *addGroup(const QString &name, const KGpgKeyNode::List &keys);
79  void delNode(KGpgNode *node);
80  void changeGroup(KGpgGroupNode *node, const KGpgNode::List &keys);
81  void deleteFromGroup(KGpgGroupNode *group, KGpgGroupMemberNode *member);
82  void setDefaultKey(KGpgKeyNode *def);
83  QModelIndex nodeIndex(KGpgNode *node, const int column = 0);
84  void refreshKey(const QString &id);
85  void refreshKey(KGpgKeyNode *nd);
86  void refreshKeys(const QStringList &ids = QStringList());
87  void refreshKeys(KGpgKeyNode::List keys);
88  void refreshGroups();
89  void invalidateIndexes(KGpgNode *nd);
90  void refreshTrust(const KgpgCore::KgpgKeyTrust trust, const QColor &color);
91 
92 protected:
93  int rowForNode(KGpgNode *node) const;
94  void refreshKeyIds(const QStringList &id);
95  void refreshKeyIds(KGpgKeyNode::List &nodes);
96  void updateNodeTrustColor(KGpgExpandableNode *node, const KgpgCore::KgpgKeyTrust trust, const QColor &color);
97 };
98 
99 #endif
QObject::child
QObject * child(const char *objName, const char *inheritsClass, bool recursiveSearch) const
KGpgItemModel
Definition: kgpgitemmodel.h:44
QModelIndex
KGpgItemModel::isDefaultKey
bool isDefaultKey(const KGpgNode *node) const
Definition: kgpgitemmodel.cpp:515
KGpgGroupNode
A GnuPG group of public keys.
Definition: KGpgGroupNode.h:33
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
KGpgItemModel::refreshKey
void refreshKey(const QString &id)
Definition: kgpgitemmodel.cpp:429
kgpgkey.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
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
KGpgKeyNode
A public key with or without corresponding secret key.
Definition: KGpgKeyNode.h:33
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
QObject::name
const char * name() const
KGpgRootNode
The parent of all key data objects.
Definition: KGpgRootNode.h:38
KGpgItemModel::findKeyNode
KGpgKeyNode * findKeyNode(const QString &id) const
Definition: kgpgitemmodel.cpp:238
QObject
KGpgItemModel::refreshGroups
void refreshGroups()
Definition: kgpgitemmodel.cpp:491
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
QString
QList
QColor
QStringList
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
KGpgItemModel::getRootNode
KGpgRootNode * getRootNode() const
Definition: kgpgitemmodel.cpp:250
KgpgCore::Images::group
QPixmap group()
Definition: images.cpp:48
KGpgItemModel::headerData
virtual QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
Definition: kgpgitemmodel.cpp:363
KGpgExpandableNode
The abstract base class for all classes that may have child objects.
Definition: KGpgExpandableNode.h:34
KGpgItemModel::refreshKeys
void refreshKeys(const QStringList &ids=QStringList())
Definition: kgpgitemmodel.cpp:441
KGpgGroupMemberNode
A member of a GnuPG group.
Definition: KGpgGroupMemberNode.h:35
KGpgKeyNode.h
QAbstractItemModel
KGpgItemModel::nodeForIndex
KGpgNode * nodeForIndex(const QModelIndex &index) const
Definition: kgpgitemmodel.cpp:230
KGpgItemModel::nodeIndex
QModelIndex nodeIndex(KGpgNode *node, const int column=0)
Definition: kgpgitemmodel.cpp:406
KGpgItemModel::deleteFromGroup
void deleteFromGroup(KGpgGroupNode *group, KGpgGroupMemberNode *member)
Definition: kgpgitemmodel.cpp:348
KGpgItemModel::setDefaultKey
void setDefaultKey(KGpgKeyNode *def)
Definition: kgpgitemmodel.cpp:384
KGpgNode.h
QObject::parent
QObject * parent() const
KGpgItemModel::columnCount
virtual int columnCount(const QModelIndex &) const
Definition: kgpgitemmodel.h:62
QVariant
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