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

kleopatra

  • sources
  • kde-4.14
  • kdepim
  • kleopatra
  • models
keycache.h
Go to the documentation of this file.
1 /* -*- mode: c++; c-basic-offset:4 -*-
2  models/keycache.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 
33 #ifndef __KLEOPATRA_MODELS_KEYCACHE_H__
34 #define __KLEOPATRA_MODELS_KEYCACHE_H__
35 
36 #include <QObject>
37 
38 #include <utils/pimpl_ptr.h>
39 
40 #include <gpgme++/global.h>
41 
42 #ifndef Q_MOC_RUN
43 #include <boost/shared_ptr.hpp>
44 #endif
45 
46 #include <string>
47 #include <vector>
48 
49 namespace GpgME {
50  class Key;
51  class DecryptionResult;
52  class VerificationResult;
53  class KeyListResult;
54  class Subkey;
55 }
56 
57 namespace KMime {
58 namespace Types {
59  class Mailbox;
60 }
61 }
62 
63 namespace Kleo {
64 
65  class FileSystemWatcher;
66 
67  class KeyCache : public QObject {
68  Q_OBJECT
69  protected:
70  explicit KeyCache();
71  public:
72  static boost::shared_ptr<const KeyCache> instance();
73  static boost::shared_ptr<KeyCache> mutableInstance();
74 
75  ~KeyCache();
76 
77  void insert( const GpgME::Key & key );
78  void insert( const std::vector<GpgME::Key> & keys );
79 
80  void refresh( const std::vector<GpgME::Key> & keys );
81 
82  void remove( const GpgME::Key & key );
83  void remove( const std::vector<GpgME::Key> & keys );
84 
85  void addFileSystemWatcher( const boost::shared_ptr<FileSystemWatcher>& watcher );
86 
87  void enableFileSystemWatcher( bool enable );
88 
89  const std::vector<GpgME::Key> & keys() const;
90  std::vector<GpgME::Key> secretKeys() const;
91 
92  const GpgME::Key & findByFingerprint( const char * fpr ) const;
93  const GpgME::Key & findByFingerprint( const std::string & fpr ) const {
94  return findByFingerprint( fpr.c_str() );
95  }
96 
97  std::vector<GpgME::Key> findByFingerprint( const std::vector<std::string> & fprs ) const;
98 
99  std::vector<GpgME::Key> findByEMailAddress( const char * email ) const;
100  std::vector<GpgME::Key> findByEMailAddress( const std::string & email ) const;
101 
102  const GpgME::Key & findByShortKeyID( const char * id ) const;
103  const GpgME::Key & findByShortKeyID( const std::string & id ) const {
104  return findByShortKeyID( id.c_str() );
105  }
106 
107  const GpgME::Key & findByKeyIDOrFingerprint( const char * id ) const;
108  const GpgME::Key & findByKeyIDOrFingerprint( const std::string & id ) const {
109  return findByKeyIDOrFingerprint( id.c_str() );
110  }
111  std::vector<GpgME::Key> findByKeyIDOrFingerprint( const std::vector<std::string> & ids ) const;
112 
113  std::vector<GpgME::Subkey> findSubkeysByKeyID( const std::vector<std::string> & ids ) const;
114 
115  std::vector<GpgME::Key> findRecipients( const GpgME::DecryptionResult & result ) const;
116  std::vector<GpgME::Key> findSigners( const GpgME::VerificationResult & result ) const;
117 
118  std::vector<GpgME::Key> findSigningKeysByMailbox( const KMime::Types::Mailbox & mb ) const;
119  std::vector<GpgME::Key> findEncryptionKeysByMailbox( const KMime::Types::Mailbox & mb ) const;
120 
121  enum Option {
122  NoOption = 0,
123  RecursiveSearch = 1,
124  IncludeSubject = 2
125  };
126  Q_DECLARE_FLAGS( Options, Option )
127 
128  std::vector<GpgME::Key> findSubjects( const GpgME::Key & key, Options option=RecursiveSearch ) const;
129  std::vector<GpgME::Key> findSubjects( const std::vector<GpgME::Key> & keys, Options options=RecursiveSearch ) const;
130  std::vector<GpgME::Key> findSubjects( std::vector<GpgME::Key>::const_iterator first, std::vector<GpgME::Key>::const_iterator last, Options options=RecursiveSearch ) const;
131 
132  std::vector<GpgME::Key> findIssuers( const GpgME::Key & key, Options options=RecursiveSearch ) const;
133  std::vector<GpgME::Key> findIssuers( const std::vector<GpgME::Key> & keys, Options options=RecursiveSearch ) const;
134  std::vector<GpgME::Key> findIssuers( std::vector<GpgME::Key>::const_iterator first, std::vector<GpgME::Key>::const_iterator last, Options options=RecursiveSearch ) const;
135 
136  public Q_SLOTS:
137  void clear();
138  void startKeyListing( GpgME::Protocol proto=GpgME::UnknownProtocol ) {
139  reload( proto );
140  }
141  void reload( GpgME::Protocol proto=GpgME::UnknownProtocol );
142  void cancelKeyListing();
143 
144  Q_SIGNALS:
145  //void changed( const GpgME::Key & key );
146  void aboutToRemove( const GpgME::Key & key );
147  void added( const GpgME::Key & key );
148  void keyListingDone( const GpgME::KeyListResult & result );
149  void keysMayHaveChanged();
150 
151  private:
152  class RefreshKeysJob;
153 
154  class Private;
155  kdtools::pimpl_ptr<Private> d;
156  Q_PRIVATE_SLOT( d, void refreshJobDone( GpgME::KeyListResult ) )
157  };
158 
159 }
160 
161 Q_DECLARE_OPERATORS_FOR_FLAGS( Kleo::KeyCache::Options )
162 
163 #endif /* __KLEOPATRA_MODELS_KEYCACHE_H__ */
Kleo::KeyCache::findSigners
std::vector< GpgME::Key > findSigners(const GpgME::VerificationResult &result) const
Definition: keycache.cpp:391
Kleo::KeyCache
Definition: keycache.h:67
kdtools::pimpl_ptr< Private >
pimpl_ptr.h
Kleo::KeyCache::insert
void insert(const GpgME::Key &key)
Kleo::KeyCache::findByFingerprint
const GpgME::Key & findByFingerprint(const std::string &fpr) const
Definition: keycache.h:93
Kleo::KeyCache::addFileSystemWatcher
void addFileSystemWatcher(const boost::shared_ptr< FileSystemWatcher > &watcher)
Definition: keycache.cpp:239
email
static std::string email(const UserID &uid)
Definition: keycache.cpp:594
Kleo::KeyCache::findByKeyIDOrFingerprint
const GpgME::Key & findByKeyIDOrFingerprint(const char *id) const
Definition: keycache.cpp:309
Kleo::KeyCache::findByShortKeyID
const GpgME::Key & findByShortKeyID(const std::string &id) const
Definition: keycache.h:103
Kleo::KeyCache::added
void added(const GpgME::Key &key)
Kleo::KeyCache::findIssuers
std::vector< GpgME::Key > findIssuers(const GpgME::Key &key, Options options=RecursiveSearch) const
Kleo::KeyCache::cancelKeyListing
void cancelKeyListing()
Definition: keycache.cpp:232
Kleo::KeyCache::refresh
void refresh(const std::vector< GpgME::Key > &keys)
Definition: keycache.cpp:698
option
const char * option
Definition: kleopatraapplication.cpp:93
Kleo::KeyCache::findSubjects
std::vector< GpgME::Key > findSubjects(const GpgME::Key &key, Options option=RecursiveSearch) const
Definition: keycache.cpp:473
Kleo::KeyCache::RecursiveSearch
Definition: keycache.h:123
Kleo::KeyCache::startKeyListing
void startKeyListing(GpgME::Protocol proto=GpgME::UnknownProtocol)
Definition: keycache.h:138
boost::shared_ptr
Definition: encryptemailcontroller.h:51
d
#define d
Definition: adduseridcommand.cpp:89
Kleo::KeyCache::KeyCache
KeyCache()
Definition: keycache.cpp:205
QObject
Kleo::KeyCache::findSigningKeysByMailbox
std::vector< GpgME::Key > findSigningKeysByMailbox(const KMime::Types::Mailbox &mb) const
Definition: keycache.cpp:399
Kleo::KeyCache::findRecipients
std::vector< GpgME::Key > findRecipients(const GpgME::DecryptionResult &result) const
Definition: keycache.cpp:376
Kleo::KeyCache::secretKeys
std::vector< GpgME::Key > secretKeys() const
Definition: keycache.cpp:691
Kleo::KeyCache::Option
Option
Definition: keycache.h:121
Kleo::KeyCache::findByEMailAddress
std::vector< GpgME::Key > findByEMailAddress(const char *email) const
Definition: keycache.cpp:284
Kleo::KeyCache::findByKeyIDOrFingerprint
const GpgME::Key & findByKeyIDOrFingerprint(const std::string &id) const
Definition: keycache.h:108
Kleo::KeyCache::keyListingDone
void keyListingDone(const GpgME::KeyListResult &result)
Kleo::KeyCache::findByFingerprint
const GpgME::Key & findByFingerprint(const char *fpr) const
Definition: keycache.cpp:258
Kleo::KeyCache::IncludeSubject
Definition: keycache.h:124
Kleo::KeyCache::findByShortKeyID
const GpgME::Key & findByShortKeyID(const char *id) const
Definition: keycache.cpp:301
Kleo::KeyCache::clear
void clear()
Definition: keycache.cpp:835
string
const char * string
Definition: verifychecksumscontroller.cpp:510
Kleo::KeyCache::NoOption
Definition: keycache.h:122
Kleo::KeyCache::~KeyCache
~KeyCache()
Definition: keycache.cpp:211
Kleo::KeyCache::aboutToRemove
void aboutToRemove(const GpgME::Key &key)
Kleo::KeyCache::enableFileSystemWatcher
void enableFileSystemWatcher(bool enable)
Definition: keycache.cpp:213
Kleo::KeyCache::reload
void reload(GpgME::Protocol proto=GpgME::UnknownProtocol)
Definition: keycache.cpp:219
Kleo::KeyCache::instance
static boost::shared_ptr< const KeyCache > instance()
Definition: keycache.cpp:190
Kleo::KeyCache::keysMayHaveChanged
void keysMayHaveChanged()
Kleo::KeyCache::findEncryptionKeysByMailbox
std::vector< GpgME::Key > findEncryptionKeysByMailbox(const KMime::Types::Mailbox &mb) const
Definition: keycache.cpp:403
Kleo::KeyCache::keys
const std::vector< GpgME::Key > & keys() const
Definition: keycache.cpp:686
Kleo::KeyCache::findSubkeysByKeyID
std::vector< GpgME::Subkey > findSubkeysByKeyID(const std::vector< std::string > &ids) const
Definition: keycache.cpp:360
Kleo::KeyCache::mutableInstance
static boost::shared_ptr< KeyCache > mutableInstance()
Definition: keycache.cpp:194
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:33:11 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
  • pimprint

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