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

libkleo

  • sources
  • kde-4.12
  • kdepim
  • libkleo
  • ui
keyselectiondialog.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  keyselectiondialog.h
3 
4  This file is part of libkleopatra, the KDE keymanagement library
5  Copyright (c) 2004 Klarälvdalens Datakonsult AB
6 
7  Based on kpgpui.h
8  Copyright (C) 2001,2002 the KPGP authors
9  See file libkdenetwork/AUTHORS.kpgp for details
10 
11  Libkleopatra is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 2 of the
14  License, or (at your option) any later version.
15 
16  Libkleopatra is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 
25  In addition, as a special exception, the copyright holders give
26  permission to link the code of this program with any edition of
27  the Qt library by Trolltech AS, Norway (or with modified versions
28  of Qt that use the same license as Qt), and distribute linked
29  combinations including the two. You must obey the GNU General
30  Public License in all respects for all of the code used other than
31  Qt. If you modify this file, you may extend this exception to
32  your version of the file, but you are not obligated to do so. If
33  you do not wish to do so, delete this exception statement from
34  your version.
35 */
36 
37 #ifndef __KLEO_UI_KEYSELECTIONDIALOG_H__
38 #define __KLEO_UI_KEYSELECTIONDIALOG_H__
39 
40 #include "kleo/kleo_export.h"
41 #include "kleo/cryptobackend.h"
42 
43 #include <gpgme++/key.h>
44 
45 #include <kdialog.h>
46 
47 #include <QPixmap>
48 
49 #include <vector>
50 
51 class QVBoxLayout;
52 class QCheckBox;
53 class QPixmap;
54 class QTimer;
55 class QRegExp;
56 class QPoint;
57 
58 namespace Kleo {
59  class KeyListView;
60  class KeyListViewItem;
61 }
62 
63 namespace GpgME {
64  class KeyListResult;
65 }
66 
67 namespace Kleo {
68 
69  class KLEO_EXPORT KeySelectionDialog : public KDialog {
70  Q_OBJECT
71  public:
72 
73  enum KeyUsage {
74  PublicKeys = 1,
75  SecretKeys = 2,
76  EncryptionKeys = 4,
77  SigningKeys = 8,
78  ValidKeys = 16,
79  TrustedKeys = 32,
80  CertificationKeys = 64,
81  AuthenticationKeys = 128,
82  OpenPGPKeys = 256,
83  SMIMEKeys = 512,
84  AllKeys = PublicKeys | SecretKeys | OpenPGPKeys | SMIMEKeys,
85  ValidEncryptionKeys = AllKeys | EncryptionKeys | ValidKeys,
86  ValidTrustedEncryptionKeys = AllKeys | EncryptionKeys | ValidKeys | TrustedKeys
87  };
88 
89  KeySelectionDialog( const QString & title,
90  const QString & text,
91  const std::vector<GpgME::Key> & selectedKeys=std::vector<GpgME::Key>(),
92  unsigned int keyUsage=AllKeys,
93  bool extendedSelection=false,
94  bool rememberChoice=false,
95  QWidget * parent=0,
96  bool modal=true );
97  KeySelectionDialog( const QString & title,
98  const QString & text,
99  const QString & initialPattern,
100  const std::vector<GpgME::Key> & selectedKeys,
101  unsigned int keyUsage=AllKeys,
102  bool extendedSelection=false,
103  bool rememberChoice=false,
104  QWidget * parent=0,
105  bool modal=true );
106  KeySelectionDialog( const QString & title,
107  const QString & text,
108  const QString & initialPattern,
109  unsigned int keyUsage=AllKeys,
110  bool extendedSelection=false,
111  bool rememberChoice=false,
112  QWidget * parent=0,
113  bool modal=true );
114  ~KeySelectionDialog();
115 
118  const GpgME::Key & selectedKey() const;
119 
120  QString fingerprint() const;
121 
123  const std::vector<GpgME::Key> & selectedKeys() const { return mSelectedKeys; }
124 
126  QStringList fingerprints() const;
127 
129  QStringList pgpKeyFingerprints() const;
131  QStringList smimeFingerprints() const;
132 
133  bool rememberSelection() const;
134 
135  // Could be used by derived classes to insert their own widget
136  QVBoxLayout* topLayout() const { return mTopLayout; }
137 
138  private Q_SLOTS:
139  void slotRereadKeys();
140  void slotStartCertificateManager( const QString &query = QString() );
141  void slotStartSearchForExternalCertificates() {
142  slotStartCertificateManager( mInitialQuery );
143  }
144  void slotKeyListResult( const GpgME::KeyListResult & );
145  void slotSelectionChanged();
146  void slotCheckSelection() { slotCheckSelection( 0 ); }
147  void slotCheckSelection( Kleo::KeyListViewItem * );
148  void slotRMB( Kleo::KeyListViewItem *, const QPoint & );
149  void slotRecheckKey();
150  void slotTryOk();
151  void slotOk();
152  void slotCancel();
153  void slotSearch( const QString & text );
154  void slotSearch();
155  void slotFilter();
156 
157  private:
158  void filterByKeyID( const QString & keyID );
159  void filterByKeyIDOrUID( const QString & keyID );
160  void filterByUID( const QString & uid );
161  void showAllItems();
162  bool anyChildMatches( const Kleo::KeyListViewItem * item, QRegExp & rx ) const;
163 
164  void connectSignals();
165  void disconnectSignals();
166 
167  void startKeyListJobForBackend( const Kleo::CryptoBackend::Protocol *, const std::vector<GpgME::Key> &, bool );
168  void startValidatingKeyListing();
169 
170  void init( bool, bool, const QString &, const QString & );
171 
172  private:
173  QVBoxLayout* mTopLayout;
174  Kleo::KeyListView * mKeyListView;
175  const Kleo::CryptoBackend::Protocol * mOpenPGPBackend;
176  const Kleo::CryptoBackend::Protocol * mSMIMEBackend;
177  QCheckBox * mRememberCB;
178  std::vector<GpgME::Key> mSelectedKeys, mKeysToCheck;
179  unsigned int mKeyUsage;
180  QTimer * mCheckSelectionTimer;
181  QTimer * mStartSearchTimer;
182  // cross-eventloop temporaries:
183  QString mSearchText;
184  const QString mInitialQuery;
185  Kleo::KeyListViewItem * mCurrentContextMenuItem;
186  int mTruncated, mListJobCount, mSavedOffsetY;
187  };
188 
189 }
190 
191 #endif // __KLEO_UI_KEYSELECTIONDIALOG_H__
QWidget
KDialog
QString
cryptobackend.h
Kleo::KeySelectionDialog
Definition: keyselectiondialog.h:69
Kleo::KeySelectionDialog::KeyUsage
KeyUsage
Definition: keyselectiondialog.h:73
KLEO_EXPORT
#define KLEO_EXPORT
Definition: kleo_export.h:41
Kleo::KeyListView
Definition: keylistview.h:101
Kleo::KeySelectionDialog::selectedKeys
const std::vector< GpgME::Key > & selectedKeys() const
Returns a list of selected key IDs.
Definition: keyselectiondialog.h:123
Kleo::KeyListViewItem
Definition: keylistview.h:69
kleo_export.h
Kleo::KeySelectionDialog::topLayout
QVBoxLayout * topLayout() const
Definition: keyselectiondialog.h:136
Kleo::CryptoBackend::Protocol
Definition: cryptobackend.h:99
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:57:48 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

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