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 #include <kdepimmacros.h>
00040 #include <kurl.h>
00041 #include <tqcstring.h>
00042 #include <tqptrlist.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 TQFile;
00069 class TQStringList;
00070 class TQLabel;
00071
00072 namespace GpgME {
00073 class ImportResult;
00074 class KeyListResult;
00075 class Error;
00076 class Key;
00077 }
00078
00079 class KDE_EXPORT CertManager : public KMainWindow {
00080 Q_OBJECT
00081 TQ_OBJECT
00082 public:
00083 CertManager( bool remote = false, const TQString& query = TQString(),
00084 const TQString& import=TQString(),
00085 TQWidget * parent=0, const char * name=0, WFlags f=0 );
00086 ~CertManager();
00087
00088 bool isRemote() const { return mRemote; }
00089
00090 signals:
00091 void stopOperations();
00092 void enableOperations( bool );
00093
00094 private slots:
00095 void slotStartCertificateDownload( const TQString & fingerprint, const TQString& displayName );
00096 void newCertificate();
00097 void revokeCertificate();
00098 void extendCertificate();
00099 void slotDeleteCertificate();
00100 void slotExportSecretKey();
00101 void slotExportCertificate();
00102 void slotUploadResult( KIO::Job* job );
00103
00104 void slotImportCertFromFile();
00105 void slotImportCertFromFile( const KURL & filename );
00106 void slotImportResult( KIO::Job* );
00107
00108 void slotCertificateImportResult( const GpgME::ImportResult & result );
00109 void slotCertificateDownloadResult( const GpgME::Error & error, const TQByteArray & keyData );
00110 void slotKeyListResult( const GpgME::KeyListResult & result );
00111 void slotDeleteResult( const GpgME::Error & error, const GpgME::Key & );
00112 void slotSecretKeyExportResult( const GpgME::Error & error, const TQByteArray & keyData );
00113 void slotCertificateExportResult( const GpgME::Error & error, const TQByteArray & keyData );
00114 void slotClearCRLsResult();
00115
00116 void importCRLFromFile();
00117 void importCRLFromLDAP();
00118 void slotImportCRLJobFinished( KIO::Job * );
00119
00120 void slotDirmngrExited();
00121 void slotStderr( KProcess*, char*, int );
00122
00123 void slotToggleRemote(int idx);
00124 void slotToggleHierarchicalView( bool );
00125
00126 void slotViewCRLs();
00127 void slotClearCRLs();
00128
00129 void slotViewDetails();
00130 void slotViewDetails( Kleo::KeyListViewItem * item );
00131 void slotSelectionChanged();
00132 void slotDownloadCertificate();
00133 void slotStartWatchGnuPG();
00134
00135 void slotEditKeybindings();
00136 void slotShowConfigurationDialog();
00137 void slotConfigureGpgME();
00138 void slotContextMenu(Kleo::KeyListViewItem*, const TQPoint& point);
00139 void slotDropped(const KURL::List&);
00142 void slotRepaint();
00145 void slotValidate() { startRedisplay( true ); }
00148 void slotRedisplay() { startRedisplay( false ); }
00151 void slotSearch();
00152
00153 void slotExpandAll();
00154 void slotCollapseAll();
00155 void slotRefreshKeys();
00156 void slotRefreshKeysResult( const GpgME::Error & );
00157
00158 private:
00159 void createStatusBar();
00160 void createActions();
00161 void updateStatusBarLabels();
00162 void updateImportActions( bool enable );
00163 void startKeyListing( bool, bool, const TQStringList & );
00164 void startKeyListing( bool, bool, const std::set<std::string> & );
00165 void startCertificateImport( const TQByteArray & keyData, const TQString& certDisplayName );
00166 void startImportCRL( const TQString& fileName, bool isTempFile );
00167 void startClearCRLs();
00168 void startSecretKeyExport( const TQString & fingerprint );
00169 void startCertificateExport( const TQStringList & fingerprints );
00170 bool connectAndStartDirmngr( const char*, const char* );
00171 void connectJobToStatusBarProgress( Kleo::Job * job, const TQString & initialText );
00172 void disconnectJobFromStatusBarProgress( const GpgME::Error & err );
00173 void importNextURLOrRedisplay();
00174 void startRedisplay( bool validating );
00175 TQString displayNameForJob( const Kleo::Job *job );
00176 void readConfig( bool noQueryGiven );
00177 void writeConfig();
00178
00179 private:
00180 Kleo::KeyListView * mKeyListView;
00181 CRLView * mCrlView;
00182 Kleo::ProgressBar * mProgressBar;
00183 TQLabel * mStatusLabel;
00184
00185 KProcess * mDirmngrProc;
00186 TQString mErrorbuffer;
00187 TQPtrList<Kleo::KeyListViewItem> mItemsToDelete;
00188 KURL::List mURLsToImport;
00189 typedef TQMap<const Kleo::Job *, TQString> JobsDisplayNameMap;
00190 JobsDisplayNameMap mJobsDisplayNameMap;
00191 HierarchyAnalyser * mHierarchyAnalyser;
00192
00193 LineEditAction * mLineEditAction;
00194 ComboAction * mComboAction;
00195 KAction * mFindAction;
00196 KAction * mImportCertFromFileAction;
00197 KAction * mImportCRLFromFileAction;
00198 KAction * mExportCertificateAction;
00199 KAction * mViewCertDetailsAction;
00200 KAction * mDeleteCertificateAction;
00201 #ifdef NOT_IMPLEMENTED_ANYWAY
00202 KAction * mRevokeCertificateAction;
00203 KAction * mExtendCertificateAction;
00204 #endif
00205 KAction * mExportSecretKeyAction;
00206 KAction * mDownloadCertificateAction;
00207 KAction * mValidateCertificateAction;
00208
00209 TQString mImportCRLTempFile;
00210 TQString mCurrentQuery;
00211 std::set<std::string> mPreviouslySelectedFingerprints;
00212 bool mNextFindRemote : 1;
00213 bool mRemote : 1;
00214 bool mDirMngrFound : 1;
00215 bool mHierarchicalView : 1;
00216 };
00217
00218 #endif // _CERTMANAGER_H_