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

kleopatra

keylistmodel.h

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset:4 -*-
00002     models/keylistmodel.h
00003 
00004     This file is part of Kleopatra, the KDE keymanager
00005     Copyright (c) 2007 Klarälvdalens Datakonsult AB
00006 
00007     Kleopatra is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     Kleopatra is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021     In addition, as a special exception, the copyright holders give
00022     permission to link the code of this program with any edition of
00023     the Qt library by Trolltech AS, Norway (or with modified versions
00024     of Qt that use the same license as Qt), and distribute linked
00025     combinations including the two.  You must obey the GNU General
00026     Public License in all respects for all of the code used other than
00027     Qt.  If you modify this file, you may extend this exception to
00028     your version of the file, but you are not obligated to do so.  If
00029     you do not wish to do so, delete this exception statement from
00030     your version.
00031 */
00032 #ifndef __KLEOPATRA_MODELS_KEYLISTMODEL_H__
00033 #define __KLEOPATRA_MODELS_KEYLISTMODEL_H__
00034 
00035 #include <QAbstractItemModel>
00036 
00037 #include <models/keylistmodelinterface.h>
00038 
00039 #include <utils/pimpl_ptr.h>
00040 
00041 #include <vector>
00042 
00043 namespace GpgME {
00044     class Key;
00045 }
00046 
00047 namespace Kleo {
00048 
00049     class AbstractKeyListModel : public QAbstractItemModel, public KeyListModelInterface {
00050         Q_OBJECT
00051     public:
00052         explicit AbstractKeyListModel( QObject * parent=0 );
00053         ~AbstractKeyListModel();
00054 
00055         static AbstractKeyListModel * createFlatKeyListModel( QObject * parent=0 );
00056         static AbstractKeyListModel * createHierarchicalKeyListModel( QObject * parent=0 );
00057 
00058         enum Columns {
00059             PrettyName,
00060             PrettyEMail,
00061             ValidFrom,
00062             ValidUntil,
00063             TechnicalDetails,
00064             Fingerprint,
00065 #if 0
00066             /* OpenPGP only, really */
00067             LongKeyID,
00068             ShortKeyID,
00069             /* X509 only, really */
00070             Issuer,
00071             Subject,
00072             SerialNumber,
00073 #endif
00074 
00075             NumColumns,
00076             Icon = PrettyName // which column shall the icon be displayed in?
00077         };
00078 
00079         /* reimp */ GpgME::Key key( const QModelIndex & idx ) const;
00080         /* reimp */ std::vector<GpgME::Key> keys( const QList<QModelIndex> & indexes ) const;
00081 
00082         using QAbstractItemModel::index;
00083         /* reimp */ QModelIndex index( const GpgME::Key & key ) const {
00084             return index( key, 0 );
00085         }
00086         QModelIndex index( const GpgME::Key & key, int col ) const;
00087         /* reimp */ QList<QModelIndex> indexes( const std::vector<GpgME::Key> & keys ) const;
00088 
00089     Q_SIGNALS:
00090         void rowAboutToBeMoved( const QModelIndex & old_parent, int old_row );
00091         void rowMoved( const QModelIndex & new_parent, int new_row );
00092 
00093     public Q_SLOTS:
00094         void setKeys( const std::vector<GpgME::Key> & keys );
00095         QModelIndex addKey( const GpgME::Key & key );
00096         QList<QModelIndex> addKeys( const std::vector<GpgME::Key> & keys );
00097         void removeKey( const GpgME::Key & key );
00098         void clear();
00099 
00100     public:
00101         /* reimp */ int columnCount( const QModelIndex & pidx ) const;
00102         /* reimp */ QVariant headerData( int section, Qt::Orientation o, int role=Qt::DisplayRole ) const;
00103         /* reimp */ QVariant data( const QModelIndex & index, int role=Qt::DisplayRole ) const;
00104 
00109         int toolTipOptions() const;
00110 
00111         void setToolTipOptions( int opts );
00112 
00113     private:
00114         virtual GpgME::Key doMapToKey( const QModelIndex & index ) const = 0;
00115         virtual QModelIndex doMapFromKey( const GpgME::Key & key, int column ) const = 0;
00116         virtual QList<QModelIndex> doAddKeys( const std::vector<GpgME::Key> & keys ) = 0;
00117         virtual void doRemoveKey( const GpgME::Key & key ) = 0;
00118         virtual void doClear() = 0;
00119 
00120     private:
00121         class Private;
00122         kdtools::pimpl_ptr<Private> d;
00123     };
00124 
00125 }
00126 
00127 #endif /* __KLEOPATRA_MODELS_KEYLISTMODEL_H__ */

kleopatra

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

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal