certmanager Library API Documentation

keyrequester.h

00001 /* -*- c++ -*- 00002 keyrequester.h 00003 00004 This file is part of libkleopatra, the KDE keymanagement library 00005 Copyright (c) 2004 Klarälvdalens Datakonsult AB 00006 00007 Libkleopatra is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU General Public License as 00009 published by the Free Software Foundation; either version 2 of the 00010 License, or (at your option) any later version. 00011 00012 Libkleopatra 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 00033 Based on kpgpui.h 00034 Copyright (C) 2001,2002 the KPGP authors 00035 See file libkdenetwork/AUTHORS.kpgp for details 00036 00037 This file is part of KPGP, the KDE PGP/GnuPG support library. 00038 00039 KPGP is free software; you can redistribute it and/or modify 00040 it under the terms of the GNU General Public License as published by 00041 the Free Software Foundation; either version 2 of the License, or 00042 (at your option) any later version. 00043 00044 You should have received a copy of the GNU General Public License 00045 along with this program; if not, write to the Free Software Foundation, 00046 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00047 */ 00048 00049 #ifndef __KLEO_UI_KEYREQUESTER_H__ 00050 #define __KLEO_UI_KEYREQUESTER_H__ 00051 00052 #include <qwidget.h> 00053 #include <kleo/cryptobackend.h> 00054 00055 #include <vector> 00056 00057 namespace Kleo { 00058 class KeyListView; 00059 class KeyListViewItem; 00060 } 00061 00062 namespace GpgME { 00063 class Key; 00064 class KeyListResult; 00065 } 00066 00067 class QStringList; 00068 class QString; 00069 class QPushButton; 00070 class QLabel; 00071 00072 namespace Kleo { 00073 00075 class KeyRequester : public QWidget { 00076 Q_OBJECT 00077 public: 00078 KeyRequester( unsigned int allowedKeys, bool multipleKeys=false, 00079 QWidget * parent=0, const char * name=0 ); 00080 // Constructor for Qt Designer 00081 KeyRequester( QWidget * parent=0, const char * name=0 ); 00082 ~KeyRequester(); 00083 00084 const GpgME::Key & key() const; 00089 void setKey( const GpgME::Key & key ); 00090 00091 const std::vector<GpgME::Key> & keys() const; 00095 void setKeys( const std::vector<GpgME::Key> & keys ); 00096 00097 QString fingerprint() const; 00101 void setFingerprint( const QString & fingerprint ); 00102 00103 QStringList fingerprints() const; 00107 void setFingerprints( const QStringList & fingerprints ); 00108 00109 00110 QPushButton * eraseButton(); 00111 QPushButton * dialogButton(); 00112 00113 void setDialogCaption( const QString & caption ); 00114 void setDialogMessage( const QString & message ); 00115 00116 bool isMultipleKeysEnabled() const; 00117 void setMultipleKeysEnabled( bool enable ); 00118 00119 unsigned int allowedKeys() const; 00120 void setAllowedKeys( unsigned int allowed ); 00121 00122 void setInitialQuery( const QString & s ) { mInitialQuery = s; } 00123 const QString & initialQuery() const { return mInitialQuery; } 00124 00125 signals: 00126 void changed(); 00127 00128 private: 00129 void init(); 00130 void startKeyListJob( const QStringList & fingerprints ); 00131 void updateKeys(); 00132 00133 private slots: 00134 void slotNextKey( const GpgME::Key & key ); 00135 void slotKeyListResult( const GpgME::KeyListResult & result ); 00136 void slotDialogButtonClicked(); 00137 void slotEraseButtonClicked(); 00138 00139 private: 00140 const CryptoBackend::Protocol * mOpenPGPBackend; 00141 const CryptoBackend::Protocol * mSMIMEBackend; 00142 QLabel * mLabel; 00143 QPushButton * mEraseButton; 00144 QPushButton * mDialogButton; 00145 QString mDialogCaption, mDialogMessage, mInitialQuery; 00146 bool mMulti; 00147 unsigned int mKeyUsage; 00148 int mJobs; 00149 std::vector<GpgME::Key> mKeys; 00150 std::vector<GpgME::Key> mTmpKeys; 00151 00152 private: 00153 class Private; 00154 Private * d; 00155 protected: 00156 virtual void virtual_hook( int, void* ); 00157 }; 00158 00159 00160 class EncryptionKeyRequester : public KeyRequester { 00161 Q_OBJECT 00162 public: 00163 enum { OpenPGP = 1, SMIME = 2, AllProtocols = OpenPGP|SMIME }; 00164 00168 EncryptionKeyRequester( bool multipleKeys=false, unsigned int proto=AllProtocols, 00169 QWidget * parent=0, const char * name=0, 00170 bool onlyTrusted=true, bool onlyValid=true ); 00174 EncryptionKeyRequester( QWidget * parent=0, const char * name=0 ); 00175 ~EncryptionKeyRequester(); 00176 00177 void setAllowedKeys( unsigned int proto, bool onlyTrusted=true, bool onlyValid=true ); 00178 00179 private: 00180 class Private; 00181 Private * d; 00182 protected: 00183 virtual void virtual_hook( int, void* ); 00184 }; 00185 00186 00187 class SigningKeyRequester : public KeyRequester { 00188 Q_OBJECT 00189 public: 00190 enum { OpenPGP = 1, SMIME = 2, AllProtocols = OpenPGP|SMIME }; 00191 00200 SigningKeyRequester( bool multipleKeys=false, unsigned int proto=AllProtocols, 00201 QWidget * parent=0, const char * name=0, 00202 bool onlyTrusted=true, bool onlyValid=true ); 00206 SigningKeyRequester( QWidget * parent=0, const char * name=0 ); 00207 ~SigningKeyRequester(); 00208 00209 /* 00210 * Those parameters affect the parameters given to the key selection dialog. 00211 * @param proto the allowed protocols, OpenPGP and/or SMIME 00212 * @param onlyTrusted only show trusted keys 00213 * @param onlyValid only show valid keys 00214 */ 00215 void setAllowedKeys( unsigned int proto, bool onlyTrusted=true, bool onlyValid=true ); 00216 00217 private: 00218 class Private; 00219 Private * d; 00220 protected: 00221 virtual void virtual_hook( int, void* ); 00222 }; 00223 00224 } 00225 00226 #endif // __KLEO_UI_KEYREQUESTER_H__
KDE Logo
This file is part of the documentation for certmanager Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Oct 1 15:18:46 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003