00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
#ifndef _CERTMANAGER_H_
00034
#define _CERTMANAGER_H_
00035
00036
00037
00038
#include <kmainwindow.h>
00039
00040
#include <kurl.h>
00041
#include <qcstring.h>
00042
#include <qptrlist.h>
00043
00044
#include <set>
00045
#include <string>
00046
00047
namespace Kleo {
00048
class KeyListView;
00049
class KeyListViewItem;
00050
class ProgressBar;
00051
class Job;
00052 }
00053
00054
namespace KIO {
00055
class Job;
00056 }
00057
class KProcess;
00058
class KToolBar;
00059
class KAction;
00060
00061
class CRLView;
00062
class HierarchyAnalyser;
00063
00064
class LineEditAction;
00065
class ComboAction;
00066
00067
class KURL;
00068
class QFile;
00069
class QStringList;
00070
class QLabel;
00071
00072
namespace GpgME {
00073
class ImportResult;
00074
class KeyListResult;
00075
class Error;
00076
class Key;
00077 }
00078
00079
class CertManager :
public KMainWindow {
00080 Q_OBJECT
00081
public:
00082 CertManager(
bool remote =
false,
const QString& query = QString::null,
00083
const QString&
import=QString::null,
00084
QWidget* parent = 0,
const char* name = 0);
00085
00086
bool isRemote()
const {
return mRemote; }
00087
00088 signals:
00089
void stopOperations();
00090
void enableOperations(
bool );
00091
00092
private slots:
00093
void slotStartCertificateDownload(
const QString & fingerprint,
const QString& displayName );
00094
void newCertificate();
00095
void revokeCertificate();
00096
void extendCertificate();
00097
void slotDeleteCertificate();
00098
void slotExportSecretKey();
00099
void slotExportCertificate();
00100
void slotUploadResult( KIO::Job* job );
00101
00102
void slotImportCertFromFile();
00103
void slotImportCertFromFile(
const KURL & filename );
00104
void slotImportResult( KIO::Job* );
00105
00106
void slotCertificateImportResult(
const GpgME::ImportResult & result );
00107
void slotCertificateDownloadResult(
const GpgME::Error & error,
const QByteArray & keyData );
00108
void slotKeyListResult(
const GpgME::KeyListResult & result );
00109
void slotDeleteResult(
const GpgME::Error & error,
const GpgME::Key & );
00110
void slotSecretKeyExportResult(
const GpgME::Error & error,
const QByteArray & keyData );
00111
void slotCertificateExportResult(
const GpgME::Error & error,
const QByteArray & keyData );
00112
void slotClearCRLsResult();
00113
00114
void importCRLFromFile();
00115
void importCRLFromLDAP();
00116
void slotImportCRLJobFinished( KIO::Job * );
00117
00118
void slotDirmngrExited();
00119
void slotStderr( KProcess*,
char*,
int );
00120
00121
void slotToggleRemote(
int idx);
00122
void slotToggleHierarchicalView(
bool );
00123
00124
void slotViewCRLs();
00125
void slotClearCRLs();
00126
00127
void slotViewDetails();
00128
void slotViewDetails( Kleo::KeyListViewItem * item );
00129
void slotSelectionChanged();
00130
void slotDownloadCertificate();
00131
void slotStartWatchGnuPG();
00132
00133
void slotEditKeybindings();
00134
void slotShowConfigurationDialog();
00135
void slotConfigureGpgME();
00136
void slotContextMenu(Kleo::KeyListViewItem*,
const QPoint& point);
00137
void slotDropped(
const KURL::List&);
00140
void slotRepaint();
00143
void slotValidate() { startRedisplay(
true ); }
00146
void slotRedisplay() { startRedisplay(
false ); }
00149
void slotSearch();
00150
00151
void slotExpandAll();
00152
void slotCollapseAll();
00153
void slotRefreshKeys();
00154
void slotRefreshKeysResult(
const GpgME::Error & );
00155
00156
private:
00157
void createStatusBar();
00158
void createActions();
00159
void updateStatusBarLabels();
00160
void updateImportActions(
bool enable );
00161
void startKeyListing(
bool,
bool,
const QStringList & );
00162
void startKeyListing(
bool,
bool,
const std::set<std::string> & );
00163
void startCertificateImport(
const QByteArray & keyData,
const QString& certDisplayName );
00164
void startImportCRL(
const QString& fileName,
bool isTempFile );
00165
void startClearCRLs();
00166
void startSecretKeyExport(
const QString & fingerprint );
00167
void startCertificateExport(
const QStringList & fingerprints );
00168
bool connectAndStartDirmngr(
const char*,
const char* );
00169
void connectJobToStatusBarProgress(
Kleo::Job * job,
const QString & initialText );
00170
void disconnectJobFromStatusBarProgress(
const GpgME::Error & err );
00171
void importNextURLOrRedisplay();
00172
void startRedisplay(
bool validating );
00173
QString displayNameForJob(
const Kleo::Job *job );
00174
00175
private:
00176 Kleo::KeyListView * mKeyListView;
00177 CRLView * mCrlView;
00178
Kleo::ProgressBar * mProgressBar;
00179
QLabel * mStatusLabel;
00180
00181 KProcess * mDirmngrProc;
00182
QString mErrorbuffer;
00183
QPtrList<Kleo::KeyListViewItem> mItemsToDelete;
00184 KURL::List mURLsToImport;
00185
typedef QMap<const Kleo::Job *, QString> JobsDisplayNameMap;
00186 JobsDisplayNameMap mJobsDisplayNameMap;
00187 HierarchyAnalyser * mHierarchyAnalyser;
00188
00189 LineEditAction * mLineEditAction;
00190 ComboAction * mComboAction;
00191 KAction * mFindAction;
00192 KAction * mImportCertFromFileAction;
00193 KAction * mImportCRLFromFileAction;
00194 KAction * mExportCertificateAction;
00195 KAction * mViewCertDetailsAction;
00196 KAction * mDeleteCertificateAction;
00197
#ifdef NOT_IMPLEMENTED_ANYWAY
00198
KAction * mRevokeCertificateAction;
00199 KAction * mExtendCertificateAction;
00200
#endif
00201
KAction * mExportSecretKeyAction;
00202 KAction * mDownloadCertificateAction;
00203 KAction * mValidateCertificateAction;
00204
00205
QString mImportCRLTempFile;
00206
QString mCurrentQuery;
00207 std::set<std::string> mPreviouslySelectedFingerprints;
00208
bool mNextFindRemote : 1;
00209
bool mRemote : 1;
00210
bool mDirMngrFound : 1;
00211 };
00212
00213
#endif // _CERTMANAGER_H_