00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __KMAIL_SIEVE_JOB_H__
00016 #define __KMAIL_SIEVE_JOB_H__
00017
00018 #include <tqobject.h>
00019 #include <tqvaluestack.h>
00020 #include <tqstring.h>
00021 #include <tqstringlist.h>
00022 #include <tqcstring.h>
00023
00024 #include <kurl.h>
00025 #include <kio/global.h>
00026
00027 class TQTextDecoder;
00028 namespace KIO {
00029 class Job;
00030 }
00031
00032 namespace KMail {
00033
00034 class SieveJob : public TQObject {
00035 Q_OBJECT
00036 TQ_OBJECT
00037 protected:
00038 enum Command { Get, Put, Activate, Deactivate, SearchActive, List, Delete };
00039 SieveJob( const KURL & url, const TQString & script,
00040 const TQValueStack<Command> & commands,
00041 TQObject * parent=0, const char * name=0 );
00042 SieveJob( const KURL & url, const TQString & script,
00043 const TQValueStack<Command> & commands,
00044 bool showProgressInfo,
00045 TQObject * parent=0, const char * name=0 );
00046 virtual ~SieveJob();
00047
00048 public:
00049 enum Existence { DontKnow, Yes, No };
00050
00055 static SieveJob * put( const KURL & dest, const TQString & script,
00056 bool makeActive, bool wasActive );
00057
00061 static SieveJob * get( const KURL & src, bool showProgressInfo=true );
00062
00066 static SieveJob * list( const KURL & url );
00067
00068 static SieveJob * del( const KURL & url );
00069
00070 static SieveJob * activate( const KURL & url );
00071
00072 static SieveJob * desactivate( const KURL & url );
00073
00074 void kill( bool quiet=true );
00075
00076 const TQStringList & sieveCapabilities() const {
00077 return mSieveCapabilities;
00078 }
00079
00080 bool fileExists() const {
00081 return mFileExists;
00082 }
00083
00084 signals:
00085 void gotScript( KMail::SieveJob * job, bool success,
00086 const TQString & script, bool active );
00087
00095 void gotList( KMail::SieveJob *job, bool success,
00096 const TQStringList &scriptList, const TQString &activeScript );
00097
00098 void result( KMail::SieveJob * job, bool success,
00099 const TQString & script, bool active );
00100
00101 void item( KMail::SieveJob * job, const TQString & filename, bool active );
00102
00103 protected:
00104 void schedule( Command command, bool showProgressInfo );
00105
00106 protected slots:
00107 void slotData( KIO::Job *, const TQByteArray & );
00108 void slotDataReq( KIO::Job *, TQByteArray & );
00109 void slotEntries( KIO::Job *, const KIO::UDSEntryList & );
00110 void slotResult( KIO::Job * );
00111
00112 protected:
00113 KURL mUrl;
00114 KIO::Job * mJob;
00115 TQTextDecoder * mDec;
00116 TQString mScript;
00117 TQString mActiveScriptName;
00118 Existence mFileExists;
00119 TQStringList mSieveCapabilities;
00120 TQValueStack<Command> mCommands;
00121 bool mShowProgressInfo;
00122
00123
00124 TQStringList mAvailableScripts;
00125 };
00126
00127 }
00128
00129 #endif // __KMAIL_SIEVE_JOB_H__
00130
00131
00132