kmail

sievejob.h
1 /*
2  sievejob.h
3 
4  KMail, the KDE mail client.
5  Copyright (c) 2002 Marc Mutz <mutz@kde.org>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License,
9  version 2.0, as published by the Free Software Foundation.
10  You should have received a copy of the GNU General Public License
11  along with this program; if not, write to the Free Software Foundation,
12  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
13 */
14 
15 #ifndef __KMAIL_SIEVE_JOB_H__
16 #define __KMAIL_SIEVE_JOB_H__
17 
18 #include <tqobject.h>
19 #include <tqvaluestack.h>
20 #include <tqstring.h>
21 #include <tqstringlist.h>
22 #include <tqcstring.h>
23 
24 #include <kurl.h>
25 #include <tdeio/global.h>
26 
27 class TQTextDecoder;
28 namespace TDEIO {
29  class Job;
30 }
31 
32 namespace KMail {
33 
34  class SieveJob : public TQObject {
35  TQ_OBJECT
36 
37  protected:
38  enum Command { Get, Put, Activate, Deactivate, SearchActive, List, Delete };
39  SieveJob( const KURL & url, const TQString & script,
40  const TQValueStack<Command> & commands,
41  TQObject * parent=0, const char * name=0 );
42  SieveJob( const KURL & url, const TQString & script,
43  const TQValueStack<Command> & commands,
44  bool showProgressInfo,
45  TQObject * parent=0, const char * name=0 );
46  virtual ~SieveJob();
47 
48  public:
49  enum Existence { DontKnow, Yes, No };
50 
55  static SieveJob * put( const KURL & dest, const TQString & script,
56  bool makeActive, bool wasActive );
57 
61  static SieveJob * get( const KURL & src, bool showProgressInfo=true );
62 
66  static SieveJob * list( const KURL & url );
67 
68  static SieveJob * del( const KURL & url );
69 
70  static SieveJob * activate( const KURL & url );
71 
72  static SieveJob * desactivate( const KURL & url );
73 
74  void kill( bool quiet=true );
75 
76  const TQStringList & sieveCapabilities() const {
77  return mSieveCapabilities;
78  }
79 
80  bool fileExists() const {
81  return mFileExists;
82  }
83 
84  signals:
85  void gotScript( KMail::SieveJob * job, bool success,
86  const TQString & script, bool active );
87 
95  void gotList( KMail::SieveJob *job, bool success,
96  const TQStringList &scriptList, const TQString &activeScript );
97 
98  void result( KMail::SieveJob * job, bool success,
99  const TQString & script, bool active );
100 
101  void item( KMail::SieveJob * job, const TQString & filename, bool active );
102 
103  protected:
104  void schedule( Command command, bool showProgressInfo );
105 
106  protected slots:
107  void slotData( TDEIO::Job *, const TQByteArray & ); // for get
108  void slotDataReq( TDEIO::Job *, TQByteArray & ); // for put
109  void slotEntries( TDEIO::Job *, const TDEIO::UDSEntryList & ); // for listDir
110  void slotResult( TDEIO::Job * ); // for all commands
111 
112  protected:
113  KURL mUrl;
114  TDEIO::Job * mJob;
115  TQTextDecoder * mDec;
116  TQString mScript;
117  TQString mActiveScriptName;
118  Existence mFileExists;
119  TQStringList mSieveCapabilities;
120  TQValueStack<Command> mCommands;
121  bool mShowProgressInfo;
122 
123  // List of Sieve scripts on the server, used by @ref list()
124  TQStringList mAvailableScripts;
125  };
126 
127 } // namespace KMail
128 
129 #endif // __KMAIL_SIEVE_JOB_H__
folderdiaquotatab.h
Definition: aboutdata.cpp:40