qgpgmejob.h
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 __KLEO_QGPGMEJOB_H__
00034 #define __KLEO_QGPGMEJOB_H__
00035
00036 #include <gpgmepp/interfaces/progressprovider.h>
00037 #include <gpgmepp/interfaces/passphraseprovider.h>
00038
00039 #include <gpgmepp/key.h>
00040
00041 #include <qcstring.h>
00042
00043 #include <vector>
00044
00045 namespace GpgME {
00046 class Error;
00047 class Context;
00048 class Data;
00049 }
00050
00051 namespace Kleo {
00052 class Job;
00053 }
00054
00055 namespace QGpgME {
00056 class QByteArrayDataProvider;
00057 }
00058
00059 class QString;
00060 class QStringList;
00061
00062 namespace Kleo {
00063
00077 class QGpgMEJob : public GpgME::ProgressProvider, public GpgME::PassphraseProvider {
00078 public:
00079 QGpgMEJob( Kleo::Job * _this, GpgME::Context * context );
00080 ~QGpgMEJob();
00081
00082 protected:
00085 virtual void doOperationDoneEvent( const GpgME::Error & e ) = 0;
00087 void hookupContextToEventLoopInteractor();
00089 void setPatterns( const QStringList & sl, bool allowEmpty=false );
00091 unsigned int numPatterns() const { return mNumPatterns; }
00093 const char* * nextChunk();
00095 const char* * patterns() const;
00097 void setChunkSize( unsigned int size );
00099 unsigned int chunkSize() const { return mChunkSize; }
00101 void createOutData();
00104 void createInData( const QByteArray & in );
00106 GpgME::Error setSigningKeys( const std::vector<GpgME::Key> & signers );
00108 void doSlotOperationDoneEvent( GpgME::Context * context, const GpgME::Error & e );
00109
00110
00111
00112
00113
00114 protected:
00115 virtual void doEmitProgressSignal( const QString & what, int current, int total ) = 0;
00116 virtual void doEmitDoneSignal() = 0;
00117 void doSlotCancel();
00118
00119 private:
00121 void showProgress( const char * what, int type, int current, int total );
00122 char * getPassphrase( const char * useridHint, const char * description,
00123 bool previousWasBad, bool & canceled );
00124 void deleteAllPatterns();
00125
00126 public:
00127 void checkInvariants() const;
00128
00129 protected:
00130 Kleo::Job * mThis;
00131 GpgME::Context * mCtx;
00132 GpgME::Data * mInData;
00133 QGpgME::QByteArrayDataProvider * mInDataDataProvider;
00134 GpgME::Data * mOutData;
00135 QGpgME::QByteArrayDataProvider * mOutDataDataProvider;
00136 private:
00137 const char* * mPatterns;
00138
00139
00140 const char * mReplacedPattern;
00141 unsigned int mNumPatterns;
00142 unsigned int mChunkSize;
00143 unsigned int mPatternStartIndex, mPatternEndIndex;
00144 };
00145
00146 }
00147
00148 #define make_slot_cancel private: void slotCancel() { QGpgMEJob::doSlotCancel(); }
00149 #define make_progress_emitter private: void doEmitProgressSignal( const QString & what, int cur, int tot ) { emit progress( what, cur, tot ); }
00150 #define make_done_emitter private: void doEmitDoneSignal() { emit done(); }
00151 #define QGPGME_JOB make_slot_cancel make_progress_emitter make_done_emitter
00152
00153 #endif // __KLEO_QGPGMEJOB_H__
This file is part of the documentation for certmanager/lib Library Version 3.3.2.