4 KMail, the KDE mail client.
5 Copyright (c) 2002 Marc Mutz <mutz@kde.org>
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
15 #ifndef __KMAIL_SIEVE_JOB_H__
16 #define __KMAIL_SIEVE_JOB_H__
21 #include <QStringList>
24 #include <kio/global.h>
25 #include <kio/udsentry.h>
35 class SieveJob
: public QObject
{
38 enum Command
{ Get
, Put
, Activate
, Deactivate
, SearchActive
, List
, Delete
};
39 SieveJob( const KUrl
& url
, const QString
& script
,
40 const QStack
<Command
> & commands
,
41 QObject
* parent
=0, const char * name
=0 );
45 enum Existence
{ DontKnow
, Yes
, No
};
48 * Store a Sieve script. If @param makeActive is set, also mark the
51 static SieveJob
* put( const KUrl
& dest
, const QString
& script
,
52 bool makeActive
, bool wasActive
);
55 * Get a specific Sieve script
57 static SieveJob
* get( const KUrl
& src
);
60 * List all available scripts
62 static SieveJob
* list( const KUrl
& url
);
64 static SieveJob
* del( const KUrl
& url
);
66 static SieveJob
* activate( const KUrl
& url
);
68 static SieveJob
* desactivate( const KUrl
& url
);
70 void kill( KJob::KillVerbosity verbosity
= KJob::Quietly
);
72 void setInteractive( bool interactive
);
74 const QStringList
& sieveCapabilities() const {
75 return mSieveCapabilities
;
78 bool fileExists() const {
83 void gotScript( KMail::SieveJob
* job
, bool success
,
84 const QString
& script
, bool active
);
87 * We got the list of available scripts
89 * @param scriptList is the list of script filenames
90 * @param activeScript lists the filename of the active script, or an
91 * empty string if no script is active.
93 void gotList( KMail::SieveJob
*job
, bool success
,
94 const QStringList
&scriptList
, const QString
&activeScript
);
96 void result( KMail::SieveJob
* job
, bool success
,
97 const QString
& script
, bool active
);
99 void item( KMail::SieveJob
* job
, const QString
& filename
, bool active
);
102 void schedule( Command command
);
105 void slotData( KIO::Job
*, const QByteArray
& ); // for get
106 void slotDataReq( KIO::Job
*, QByteArray
& ); // for put
107 void slotEntries( KIO::Job
*, const KIO::UDSEntryList
& ); // for listDir
108 void slotResult( KJob
* ); // for all commands
115 QString mActiveScriptName
;
116 Existence mFileExists
;
117 QStringList mSieveCapabilities
;
118 QStack
<Command
> mCommands
;
120 // List of Sieve scripts on the server, used by @ref list()
121 QStringList mAvailableScripts
;
126 #endif // __KMAIL_SIEVE_JOB_H__
128 // vim: set noet sts=2 ts=8 sw=2: