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

libkleo

  • kde-4.x
  • pim
  • libkleo
  • src
  • 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 <kleo_export.h>
39 
40 #include <gpgme++/global.h>
41 
42 #include <memory>
43 #include <string>
44 #include <vector>
45 
46 namespace GpgME
47 {
48 class Key;
49 class DecryptionResult;
50 class VerificationResult;
51 class KeyListResult;
52 class Subkey;
53 }
54 
55 namespace KMime
56 {
57 namespace Types
58 {
59 class Mailbox;
60 }
61 }
62 
63 namespace Kleo
64 {
65 
66 class FileSystemWatcher;
67 
68 class KLEO_EXPORT KeyCache : public QObject
69 {
70  Q_OBJECT
71 protected:
72  explicit KeyCache();
73 public:
74  static std::shared_ptr<const KeyCache> instance();
75  static std::shared_ptr<KeyCache> mutableInstance();
76 
77  ~KeyCache();
78 
79  void insert(const GpgME::Key &key);
80  void insert(const std::vector<GpgME::Key> &keys);
81 
82  void refresh(const std::vector<GpgME::Key> &keys);
83 
84  void remove(const GpgME::Key &key);
85  void remove(const std::vector<GpgME::Key> &keys);
86 
87  void addFileSystemWatcher(const std::shared_ptr<FileSystemWatcher> &watcher);
88 
89  void enableFileSystemWatcher(bool enable);
90 
91  void setRefreshInterval(int hours);
92  int refreshInterval() const;
93 
94  void enableRemarks(bool enable);
95  bool remarksEnabled() const;
96 
97  const std::vector<GpgME::Key> &keys() const;
98  std::vector<GpgME::Key> secretKeys() const;
99 
100  const GpgME::Key &findByFingerprint(const char *fpr) const;
101  const GpgME::Key &findByFingerprint(const std::string &fpr) const;
102 
103  std::vector<GpgME::Key> findByEMailAddress(const char *email) const;
104  std::vector<GpgME::Key> findByEMailAddress(const std::string &email) const;
105 
120  std::vector<GpgME::Key> findBestByMailBox(const char *addr, GpgME::Protocol proto,
121  bool needSign, bool needEncrypt) const;
122 
123  const GpgME::Key &findByShortKeyID(const char *id) const;
124  const GpgME::Key &findByShortKeyID(const std::string &id) const;
125 
126  const GpgME::Key &findByKeyIDOrFingerprint(const char *id) const;
127  const GpgME::Key &findByKeyIDOrFingerprint(const std::string &id) const;
128 
129  std::vector<GpgME::Key> findByKeyIDOrFingerprint(const std::vector<std::string> &ids) const;
130 
131  std::vector<GpgME::Subkey> findSubkeysByKeyID(const std::vector<std::string> &ids) const;
132 
133  std::vector<GpgME::Key> findRecipients(const GpgME::DecryptionResult &result) const;
134  std::vector<GpgME::Key> findSigners(const GpgME::VerificationResult &result) const;
135 
136  std::vector<GpgME::Key> findSigningKeysByMailbox(const QString &mb) const;
137  std::vector<GpgME::Key> findEncryptionKeysByMailbox(const QString &mb) const;
138 
142  std::vector<GpgME::Key> getGroupKeys(const QString &groupName) const;
143 
144  enum Option {
145  NoOption = 0,
146  RecursiveSearch = 1,
147  IncludeSubject = 2
148  };
149  Q_DECLARE_FLAGS(Options, Option)
150 
151  std::vector<GpgME::Key> findSubjects(const GpgME::Key &key, Options option = RecursiveSearch) const;
152  std::vector<GpgME::Key> findSubjects(const std::vector<GpgME::Key> &keys, Options options = RecursiveSearch) const;
153  std::vector<GpgME::Key> findSubjects(std::vector<GpgME::Key>::const_iterator first, std::vector<GpgME::Key>::const_iterator last, Options options = RecursiveSearch) const;
154 
155  std::vector<GpgME::Key> findIssuers(const GpgME::Key &key, Options options = RecursiveSearch) const;
156  std::vector<GpgME::Key> findIssuers(const std::vector<GpgME::Key> &keys, Options options = RecursiveSearch) const;
157  std::vector<GpgME::Key> findIssuers(std::vector<GpgME::Key>::const_iterator first, std::vector<GpgME::Key>::const_iterator last, Options options = RecursiveSearch) const;
158 
160  bool initialized() const;
161 
163  bool pgpOnly() const;
164 
165 public Q_SLOTS:
166  void clear();
167  void startKeyListing(GpgME::Protocol proto = GpgME::UnknownProtocol)
168  {
169  reload(proto);
170  }
171  void reload(GpgME::Protocol proto = GpgME::UnknownProtocol);
172  void cancelKeyListing();
173 
174 Q_SIGNALS:
175  //void changed( const GpgME::Key & key );
176  void aboutToRemove(const GpgME::Key &key);
177  void added(const GpgME::Key &key);
178  void keyListingDone(const GpgME::KeyListResult &result);
179  void keysMayHaveChanged();
180 
181 private:
182  class RefreshKeysJob;
183 
184  class Private;
185  QScopedPointer<Private> const d;
186 };
187 
188 }
189 
190 Q_DECLARE_OPERATORS_FOR_FLAGS(Kleo::KeyCache::Options)
191 
192 #endif /* __KLEOPATRA_MODELS_KEYCACHE_H__ */
Kleo::KeyCache
Definition: keycache.h:68
email
static std::string email(const UserID &uid)
Definition: keycache.cpp:740
QObject
QScopedPointer< Private >
Kleo::KeyCache::Option
Option
Definition: keycache.h:144
QString
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Fri Dec 13 2019 02:28:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libkleo

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

pim API Reference

Skip menu "pim API Reference"
  • akonadi-calendar-tools
  •   konsolekalendar
  • akregator
  •   src
  • kalarmcal
  •   src
  •     lib
  • kdepim-runtime
  •   agents
  •   src
  • kleopatra
  •   src
  • kmailtransport
  • knotes
  • kontact
  • kontactinterface
  • kpimtextedit
  • ksmtp
  • ktnef
  • libkgapi
  • libkleo
  •   src
  •     src
  •     src

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