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

kleopatra

  • sources
  • kde-4.12
  • kdepim
  • kleopatra
  • models
keylistmodel.h
Go to the documentation of this file.
1 /* -*- mode: c++; c-basic-offset:4 -*-
2  models/keylistmodel.h
3 
4  This file is part of Kleopatra, the KDE keymanager
5  Copyright (c) 2007 Klarälvdalens Datakonsult AB
6 
7  Kleopatra is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  Kleopatra 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 GNU
15  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, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  In addition, as a special exception, the copyright holders give
22  permission to link the code of this program with any edition of
23  the Qt library by Trolltech AS, Norway (or with modified versions
24  of Qt that use the same license as Qt), and distribute linked
25  combinations including the two. You must obey the GNU General
26  Public License in all respects for all of the code used other than
27  Qt. If you modify this file, you may extend this exception to
28  your version of the file, but you are not obligated to do so. If
29  you do not wish to do so, delete this exception statement from
30  your version.
31 */
32 #ifndef __KLEOPATRA_MODELS_KEYLISTMODEL_H__
33 #define __KLEOPATRA_MODELS_KEYLISTMODEL_H__
34 
35 #include <QAbstractItemModel>
36 
37 #include <models/keylistmodelinterface.h>
38 
39 #include <utils/pimpl_ptr.h>
40 
41 #include <vector>
42 
43 namespace GpgME {
44  class Key;
45 }
46 
47 namespace Kleo {
48 
49  class AbstractKeyListModel : public QAbstractItemModel, public KeyListModelInterface {
50  Q_OBJECT
51  public:
52  explicit AbstractKeyListModel( QObject * parent=0 );
53  ~AbstractKeyListModel();
54 
55  static AbstractKeyListModel * createFlatKeyListModel( QObject * parent=0 );
56  static AbstractKeyListModel * createHierarchicalKeyListModel( QObject * parent=0 );
57 
58  /* reimp */ GpgME::Key key( const QModelIndex & idx ) const;
59  /* reimp */ std::vector<GpgME::Key> keys( const QList<QModelIndex> & indexes ) const;
60 
61  using QAbstractItemModel::index;
62  /* reimp */ QModelIndex index( const GpgME::Key & key ) const {
63  return index( key, 0 );
64  }
65  QModelIndex index( const GpgME::Key & key, int col ) const;
66  /* reimp */ QList<QModelIndex> indexes( const std::vector<GpgME::Key> & keys ) const;
67 
68  Q_SIGNALS:
69  void rowAboutToBeMoved( const QModelIndex & old_parent, int old_row );
70  void rowMoved( const QModelIndex & new_parent, int new_row );
71 
72  public Q_SLOTS:
73  void setKeys( const std::vector<GpgME::Key> & keys );
74  QModelIndex addKey( const GpgME::Key & key );
75  QList<QModelIndex> addKeys( const std::vector<GpgME::Key> & keys );
76  void removeKey( const GpgME::Key & key );
77  void clear();
78 
79  public:
80  /* reimp */ int columnCount( const QModelIndex & pidx ) const;
81  /* reimp */ QVariant headerData( int section, Qt::Orientation o, int role=Qt::DisplayRole ) const;
82  /* reimp */ QVariant data( const QModelIndex & index, int role=Qt::DisplayRole ) const;
83 
88  int toolTipOptions() const;
89 
90  void setToolTipOptions( int opts );
91 
92  private:
93  virtual GpgME::Key doMapToKey( const QModelIndex & index ) const = 0;
94  virtual QModelIndex doMapFromKey( const GpgME::Key & key, int column ) const = 0;
95  virtual QList<QModelIndex> doAddKeys( const std::vector<GpgME::Key> & keys ) = 0;
96  virtual void doRemoveKey( const GpgME::Key & key ) = 0;
97  virtual void doClear() = 0;
98 
99  private:
100  class Private;
101  kdtools::pimpl_ptr<Private> d;
102  };
103 
104 }
105 
106 #endif /* __KLEOPATRA_MODELS_KEYLISTMODEL_H__ */
Kleo::AbstractKeyListModel::rowMoved
void rowMoved(const QModelIndex &new_parent, int new_row)
Kleo::AbstractKeyListModel::data
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: keylistmodel.cpp:280
Kleo::AbstractKeyListModel::addKey
QModelIndex addKey(const GpgME::Key &key)
Definition: keylistmodel.cpp:216
Kleo::AbstractKeyListModel::columnCount
int columnCount(const QModelIndex &pidx) const
Definition: keylistmodel.cpp:245
kdtools::pimpl_ptr< Private >
pimpl_ptr.h
Kleo::AbstractKeyListModel::rowAboutToBeMoved
void rowAboutToBeMoved(const QModelIndex &old_parent, int old_row)
Kleo::AbstractKeyListModel::indexes
QList< QModelIndex > indexes(const std::vector< GpgME::Key > &keys) const
Definition: keylistmodel.cpp:201
Kleo::AbstractKeyListModel::clear
void clear()
Definition: keylistmodel.cpp:239
Kleo::AbstractKeyListModel::setToolTipOptions
void setToolTipOptions(int opts)
Definition: keylistmodel.cpp:167
Kleo::AbstractKeyListModel::~AbstractKeyListModel
~AbstractKeyListModel()
Definition: keylistmodel.cpp:165
Kleo::AbstractKeyListModel::createHierarchicalKeyListModel
static AbstractKeyListModel * createHierarchicalKeyListModel(QObject *parent=0)
Definition: keylistmodel.cpp:886
d
#define d
Definition: adduseridcommand.cpp:90
Kleo::AbstractKeyListModel::index
QModelIndex index(const GpgME::Key &key) const
Definition: keylistmodel.h:62
Kleo::AbstractKeyListModel::AbstractKeyListModel
AbstractKeyListModel(QObject *parent=0)
Definition: keylistmodel.cpp:159
Kleo::AbstractKeyListModel::addKeys
QList< QModelIndex > addKeys(const std::vector< GpgME::Key > &keys)
Definition: keylistmodel.cpp:229
QAbstractItemModel
Kleo::AbstractKeyListModel
Definition: keylistmodel.h:49
Kleo::KeyListModelInterface
Definition: keylistmodelinterface.h:47
Kleo::AbstractKeyListModel::toolTipOptions
int toolTipOptions() const
defines which information is displayed in tooltips see Kleo::Formatting::ToolTipOption ...
Definition: keylistmodel.cpp:172
Kleo::AbstractKeyListModel::headerData
QVariant headerData(int section, Qt::Orientation o, int role=Qt::DisplayRole) const
Definition: keylistmodel.cpp:249
Kleo::AbstractKeyListModel::key
GpgME::Key key(const QModelIndex &idx) const
Definition: keylistmodel.cpp:177
Kleo::AbstractKeyListModel::keys
std::vector< GpgME::Key > keys(const QList< QModelIndex > &indexes) const
Definition: keylistmodel.cpp:184
Kleo::AbstractKeyListModel::createFlatKeyListModel
static AbstractKeyListModel * createFlatKeyListModel(QObject *parent=0)
Definition: keylistmodel.cpp:877
Kleo::AbstractKeyListModel::removeKey
void removeKey(const GpgME::Key &key)
Definition: keylistmodel.cpp:222
keylistmodelinterface.h
Kleo::AbstractKeyListModel::setKeys
void setKeys(const std::vector< GpgME::Key > &keys)
Definition: keylistmodel.cpp:211
QList
Definition: commands/command.h:46
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kleopatra

Skip menu "kleopatra"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

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