• 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
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 #include <boost/shared_ptr.hpp>
43 
44 #include <string>
45 #include <vector>
46 
47 namespace GpgME {
48  class Key;
49  class DecryptionResult;
50  class VerificationResult;
51  class KeyListResult;
52  class Subkey;
53 }
54 
55 namespace KMime {
56 namespace Types {
57  class Mailbox;
58 }
59 }
60 
61 namespace Kleo {
62 
63  class FileSystemWatcher;
64 
65  class KeyCache : public QObject {
66  Q_OBJECT
67  protected:
68  explicit KeyCache();
69  public:
70  static boost::shared_ptr<const KeyCache> instance();
71  static boost::shared_ptr<KeyCache> mutableInstance();
72 
73  ~KeyCache();
74 
75  void insert( const GpgME::Key & key );
76  void insert( const std::vector<GpgME::Key> & keys );
77 
78  void refresh( const std::vector<GpgME::Key> & keys );
79 
80  void remove( const GpgME::Key & key );
81  void remove( const std::vector<GpgME::Key> & keys );
82 
83  void addFileSystemWatcher( const boost::shared_ptr<FileSystemWatcher>& watcher );
84 
85  void enableFileSystemWatcher( bool enable );
86 
87  const std::vector<GpgME::Key> & keys() const;
88  std::vector<GpgME::Key> secretKeys() const;
89 
90  const GpgME::Key & findByFingerprint( const char * fpr ) const;
91  const GpgME::Key & findByFingerprint( const std::string & fpr ) const {
92  return findByFingerprint( fpr.c_str() );
93  }
94 
95  std::vector<GpgME::Key> findByFingerprint( const std::vector<std::string> & fprs ) const;
96 
97  std::vector<GpgME::Key> findByEMailAddress( const char * email ) const;
98  std::vector<GpgME::Key> findByEMailAddress( const std::string & email ) const;
99 
100  const GpgME::Key & findByShortKeyID( const char * id ) const;
101  const GpgME::Key & findByShortKeyID( const std::string & id ) const {
102  return findByShortKeyID( id.c_str() );
103  }
104 
105  const GpgME::Key & findByKeyIDOrFingerprint( const char * id ) const;
106  const GpgME::Key & findByKeyIDOrFingerprint( const std::string & id ) const {
107  return findByKeyIDOrFingerprint( id.c_str() );
108  }
109  std::vector<GpgME::Key> findByKeyIDOrFingerprint( const std::vector<std::string> & ids ) const;
110 
111  std::vector<GpgME::Subkey> findSubkeysByKeyID( const std::vector<std::string> & ids ) const;
112 
113  std::vector<GpgME::Key> findRecipients( const GpgME::DecryptionResult & result ) const;
114  std::vector<GpgME::Key> findSigners( const GpgME::VerificationResult & result ) const;
115 
116  std::vector<GpgME::Key> findSigningKeysByMailbox( const KMime::Types::Mailbox & mb ) const;
117  std::vector<GpgME::Key> findEncryptionKeysByMailbox( const KMime::Types::Mailbox & mb ) const;
118 
119  enum Option {
120  NoOption = 0,
121  RecursiveSearch = 1,
122  IncludeSubject = 2
123  };
124  Q_DECLARE_FLAGS( Options, Option )
125 
126  std::vector<GpgME::Key> findSubjects( const GpgME::Key & key, Options option=RecursiveSearch ) const;
127  std::vector<GpgME::Key> findSubjects( const std::vector<GpgME::Key> & keys, Options options=RecursiveSearch ) const;
128  std::vector<GpgME::Key> findSubjects( std::vector<GpgME::Key>::const_iterator first, std::vector<GpgME::Key>::const_iterator last, Options options=RecursiveSearch ) const;
129 
130  std::vector<GpgME::Key> findIssuers( const GpgME::Key & key, Options options=RecursiveSearch ) const;
131  std::vector<GpgME::Key> findIssuers( const std::vector<GpgME::Key> & keys, Options options=RecursiveSearch ) const;
132  std::vector<GpgME::Key> findIssuers( std::vector<GpgME::Key>::const_iterator first, std::vector<GpgME::Key>::const_iterator last, Options options=RecursiveSearch ) const;
133 
134  public Q_SLOTS:
135  void clear();
136  void startKeyListing( GpgME::Protocol proto=GpgME::UnknownProtocol ) {
137  reload( proto );
138  }
139  void reload( GpgME::Protocol proto=GpgME::UnknownProtocol );
140  void cancelKeyListing();
141 
142  Q_SIGNALS:
143  //void changed( const GpgME::Key & key );
144  void aboutToRemove( const GpgME::Key & key );
145  void added( const GpgME::Key & key );
146  void keyListingDone( const GpgME::KeyListResult & result );
147  void keysMayHaveChanged();
148 
149  private:
150  class RefreshKeysJob;
151 
152  class Private;
153  kdtools::pimpl_ptr<Private> d;
154  Q_PRIVATE_SLOT( d, void refreshJobDone( GpgME::KeyListResult ) )
155  };
156 
157 }
158 
159 Q_DECLARE_OPERATORS_FOR_FLAGS( Kleo::KeyCache::Options )
160 
161 #endif /* __KLEOPATRA_MODELS_KEYCACHE_H__ */
Kleo::KeyCache::findSigners
std::vector< GpgME::Key > findSigners(const GpgME::VerificationResult &result) const
Definition: keycache.cpp:390
Kleo::KeyCache
Definition: keycache.h:65
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:91
Kleo::KeyCache::addFileSystemWatcher
void addFileSystemWatcher(const boost::shared_ptr< FileSystemWatcher > &watcher)
Definition: keycache.cpp:238
email
static std::string email(const UserID &uid)
Definition: keycache.cpp:593
Kleo::KeyCache::findByKeyIDOrFingerprint
const GpgME::Key & findByKeyIDOrFingerprint(const char *id) const
Definition: keycache.cpp:308
Kleo::KeyCache::findByShortKeyID
const GpgME::Key & findByShortKeyID(const std::string &id) const
Definition: keycache.h:101
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:231
Kleo::KeyCache::refresh
void refresh(const std::vector< GpgME::Key > &keys)
Definition: keycache.cpp:697
option
const char * option
Definition: kleopatraapplication.cpp:91
Kleo::KeyCache::findSubjects
std::vector< GpgME::Key > findSubjects(const GpgME::Key &key, Options option=RecursiveSearch) const
Definition: keycache.cpp:472
Kleo::KeyCache::RecursiveSearch
Definition: keycache.h:121
Kleo::KeyCache::startKeyListing
void startKeyListing(GpgME::Protocol proto=GpgME::UnknownProtocol)
Definition: keycache.h:136
boost::shared_ptr
Definition: encryptemailcontroller.h:51
d
#define d
Definition: adduseridcommand.cpp:90
Kleo::KeyCache::KeyCache
KeyCache()
Definition: keycache.cpp:204
Kleo::KeyCache::findSigningKeysByMailbox
std::vector< GpgME::Key > findSigningKeysByMailbox(const KMime::Types::Mailbox &mb) const
Definition: keycache.cpp:398
Kleo::KeyCache::findRecipients
std::vector< GpgME::Key > findRecipients(const GpgME::DecryptionResult &result) const
Definition: keycache.cpp:375
Kleo::KeyCache::secretKeys
std::vector< GpgME::Key > secretKeys() const
Definition: keycache.cpp:690
Kleo::KeyCache::Option
Option
Definition: keycache.h:119
Kleo::KeyCache::findByEMailAddress
std::vector< GpgME::Key > findByEMailAddress(const char *email) const
Definition: keycache.cpp:283
Kleo::KeyCache::findByKeyIDOrFingerprint
const GpgME::Key & findByKeyIDOrFingerprint(const std::string &id) const
Definition: keycache.h:106
Kleo::KeyCache::keyListingDone
void keyListingDone(const GpgME::KeyListResult &result)
Kleo::KeyCache::findByFingerprint
const GpgME::Key & findByFingerprint(const char *fpr) const
Definition: keycache.cpp:257
Kleo::KeyCache::IncludeSubject
Definition: keycache.h:122
Kleo::KeyCache::findByShortKeyID
const GpgME::Key & findByShortKeyID(const char *id) const
Definition: keycache.cpp:300
Kleo::KeyCache::clear
void clear()
Definition: keycache.cpp:834
string
const char * string
Definition: verifychecksumscontroller.cpp:511
Kleo::KeyCache::NoOption
Definition: keycache.h:120
Kleo::KeyCache::~KeyCache
~KeyCache()
Definition: keycache.cpp:210
Kleo::KeyCache::aboutToRemove
void aboutToRemove(const GpgME::Key &key)
Kleo::KeyCache::enableFileSystemWatcher
void enableFileSystemWatcher(bool enable)
Definition: keycache.cpp:212
Kleo::KeyCache::reload
void reload(GpgME::Protocol proto=GpgME::UnknownProtocol)
Definition: keycache.cpp:218
Kleo::KeyCache::instance
static boost::shared_ptr< const KeyCache > instance()
Definition: keycache.cpp:189
Kleo::KeyCache::keysMayHaveChanged
void keysMayHaveChanged()
Kleo::KeyCache::findEncryptionKeysByMailbox
std::vector< GpgME::Key > findEncryptionKeysByMailbox(const KMime::Types::Mailbox &mb) const
Definition: keycache.cpp:402
Kleo::KeyCache::keys
const std::vector< GpgME::Key > & keys() const
Definition: keycache.cpp:685
Kleo::KeyCache::findSubkeysByKeyID
std::vector< GpgME::Subkey > findSubkeysByKeyID(const std::vector< std::string > &ids) const
Definition: keycache.cpp:359
Kleo::KeyCache::mutableInstance
static boost::shared_ptr< KeyCache > mutableInstance()
Definition: keycache.cpp:193
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