certmanager

certmanager.h

00001 /* -*- mode: c++; c-basic-offset:4 -*-
00002     certmanager.h
00003 
00004     This file is part of Kleopatra, the KDE keymanager
00005     Copyright (c) 2001,2002,2004 Klarälvdalens Datakonsult AB
00006 
00007     Kleopatra is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     Kleopatra 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  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 #ifndef _CERTMANAGER_H_
00034 #define _CERTMANAGER_H_
00035 
00036 //#include <gpgme.h>
00037 
00038 #include <kmainwindow.h>
00039 #include <kdepimmacros.h>
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 KDE_EXPORT 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, WFlags f=0 );
00085     ~CertManager();
00086 
00087     bool isRemote() const { return mRemote; }
00088 
00089 signals:
00090     void stopOperations();
00091     void enableOperations( bool );
00092 
00093 private slots:
00094     void slotStartCertificateDownload( const QString & fingerprint, const QString& displayName );
00095     void newCertificate();
00096     void revokeCertificate();
00097     void extendCertificate();
00098     void slotDeleteCertificate();
00099     void slotExportSecretKey();
00100     void slotExportCertificate();
00101     void slotUploadResult( KIO::Job* job );
00102 
00103     void slotImportCertFromFile();
00104     void slotImportCertFromFile( const KURL & filename );
00105     void slotImportResult( KIO::Job* );
00106 
00107     void slotCertificateImportResult( const GpgME::ImportResult & result );
00108     void slotCertificateDownloadResult( const GpgME::Error & error, const QByteArray & keyData );
00109     void slotKeyListResult( const GpgME::KeyListResult & result );
00110     void slotDeleteResult( const GpgME::Error & error, const GpgME::Key & );
00111     void slotSecretKeyExportResult( const GpgME::Error & error, const QByteArray & keyData );
00112     void slotCertificateExportResult( const GpgME::Error & error, const QByteArray & keyData );
00113     void slotClearCRLsResult();
00114 
00115     void importCRLFromFile();
00116     void importCRLFromLDAP();
00117     void slotImportCRLJobFinished( KIO::Job * );
00118 
00119     void slotDirmngrExited();
00120     void slotStderr( KProcess*, char*, int );
00121 
00122     void slotToggleRemote(int idx);
00123     void slotToggleHierarchicalView( bool );
00124 
00125     void slotViewCRLs();
00126     void slotClearCRLs();
00127 
00128     void slotViewDetails();
00129     void slotViewDetails( Kleo::KeyListViewItem * item );
00130     void slotSelectionChanged();
00131     void slotDownloadCertificate();
00132     void slotStartWatchGnuPG();
00133 
00134     void slotEditKeybindings();
00135     void slotShowConfigurationDialog();
00136     void slotConfigureGpgME();
00137     void slotContextMenu(Kleo::KeyListViewItem*, const QPoint& point);
00138     void slotDropped(const KURL::List&);
00141     void slotRepaint();
00144     void slotValidate() { startRedisplay( true ); }
00147     void slotRedisplay() { startRedisplay( false ); }
00150     void slotSearch();
00151 
00152     void slotExpandAll();
00153     void slotCollapseAll();
00154     void slotRefreshKeys();
00155     void slotRefreshKeysResult( const GpgME::Error & );
00156 
00157 private:
00158     void createStatusBar();
00159     void createActions();
00160     void updateStatusBarLabels();
00161     void updateImportActions( bool enable );
00162     void startKeyListing( bool, bool, const QStringList & );
00163     void startKeyListing( bool, bool, const std::set<std::string> & );
00164     void startCertificateImport( const QByteArray & keyData, const QString& certDisplayName );
00165     void startImportCRL( const QString& fileName, bool isTempFile );
00166     void startClearCRLs();
00167     void startSecretKeyExport( const QString & fingerprint );
00168     void startCertificateExport( const QStringList & fingerprints );
00169     bool connectAndStartDirmngr( const char*, const char* );
00170     void connectJobToStatusBarProgress( Kleo::Job * job, const QString & initialText );
00171     void disconnectJobFromStatusBarProgress( const GpgME::Error & err );
00172     void importNextURLOrRedisplay();
00173     void startRedisplay( bool validating );
00174     QString displayNameForJob( const Kleo::Job *job );
00175     void readConfig( bool noQueryGiven );
00176     void writeConfig();
00177 
00178 private:
00179     Kleo::KeyListView * mKeyListView;
00180     CRLView * mCrlView;
00181     Kleo::ProgressBar * mProgressBar;
00182     QLabel * mStatusLabel;
00183 
00184     KProcess * mDirmngrProc;
00185     QString mErrorbuffer;
00186     QPtrList<Kleo::KeyListViewItem> mItemsToDelete;
00187     KURL::List mURLsToImport;
00188     typedef QMap<const Kleo::Job *, QString> JobsDisplayNameMap;
00189     JobsDisplayNameMap mJobsDisplayNameMap;
00190     HierarchyAnalyser * mHierarchyAnalyser;
00191 
00192     LineEditAction * mLineEditAction;
00193     ComboAction * mComboAction;
00194     KAction * mFindAction;
00195     KAction * mImportCertFromFileAction;
00196     KAction * mImportCRLFromFileAction;
00197     KAction * mExportCertificateAction;
00198     KAction * mViewCertDetailsAction;
00199     KAction * mDeleteCertificateAction;
00200 #ifdef NOT_IMPLEMENTED_ANYWAY
00201     KAction * mRevokeCertificateAction;
00202     KAction * mExtendCertificateAction;
00203 #endif
00204     KAction * mExportSecretKeyAction;
00205     KAction * mDownloadCertificateAction;
00206     KAction * mValidateCertificateAction;
00207 
00208     QString mImportCRLTempFile;
00209     QString mCurrentQuery;
00210     std::set<std::string> mPreviouslySelectedFingerprints;
00211     bool     mNextFindRemote : 1; // state of the combo, i.e. whether the next find action will be remote
00212     bool     mRemote : 1; // whether the currently displayed items are from a remote listing
00213     bool     mDirMngrFound : 1;
00214     bool     mHierarchicalView : 1; // whether to display the list view in hierarchical mode
00215 };
00216 
00217 #endif // _CERTMANAGER_H_
KDE Home | KDE Accessibility Home | Description of Access Keys