kmail Library API Documentation

sievejob.h

00001 /*  -*- c++ -*-
00002     sievejob.h
00003 
00004     KMail, the KDE mail client.
00005     Copyright (c) 2002 Marc Mutz <mutz@kde.org>
00006 
00007     This program is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU General Public License,
00009     version 2.0, as published by the Free Software Foundation.
00010     You should have received a copy of the GNU General Public License
00011     along with this program; if not, write to the Free Software Foundation,
00012     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
00013 */
00014 
00015 #ifndef __KMAIL_SIEVE_JOB_H__
00016 #define __KMAIL_SIEVE_JOB_H__
00017 
00018 #include <qobject.h>
00019 #include <qvaluestack.h>
00020 #include <qstring.h>
00021 #include <qstringlist.h>
00022 #include <qcstring.h>
00023 
00024 #include <kurl.h>
00025 #include <kio/global.h>
00026 
00027 class QTextDecoder;
00028 namespace KIO {
00029   class Job;
00030 }
00031 
00032 namespace KMail {
00033 
00034   class SieveJob : public QObject {
00035     Q_OBJECT
00036   protected:
00037     enum Command { Get, Put, Activate, Deactivate, SearchActive };
00038     SieveJob( const KURL & url, const QString & script,
00039           const QValueStack<Command> & commands,
00040           QObject * parent=0, const char * name=0 );
00041     virtual ~SieveJob();
00042 
00043   public:
00044     enum Existence { DontKnow, Yes, No };
00045 
00046     static SieveJob * put( const KURL & dest, const QString & script,
00047                bool makeActive, bool wasActive );
00048     static SieveJob * get( const KURL & src );
00049 
00050     void kill( bool quiet=true );
00051 
00052     const QStringList & sieveCapabilities() const {
00053       return mSieveCapabilities;
00054     }
00055 
00056     bool fileExists() const {
00057       return mFileExists;
00058     }
00059 
00060   signals:
00061     void result( KMail::SieveJob * job, bool success,
00062          const QString & script, bool active );
00063 
00064   protected:
00065     void schedule( Command command );
00066 
00067   protected slots:
00068     void slotData( KIO::Job *, const QByteArray & ); // for get
00069     void slotDataReq( KIO::Job *, QByteArray & ); // for put
00070     void slotEntries( KIO::Job *, const KIO::UDSEntryList & ); // for listDir
00071     void slotResult( KIO::Job * ); // for all commands
00072 
00073   protected:
00074     KURL mUrl;
00075     KIO::Job * mJob;
00076     QTextDecoder * mDec;
00077     QString mScript;
00078     QString mActiveScriptName;
00079     Existence mFileExists;
00080     QStringList mSieveCapabilities;
00081     QValueStack<Command> mCommands;
00082   };
00083 
00084 } // namespace KMail
00085 
00086 #endif // __KMAIL_SIEVE_JOB_H__
KDE Logo
This file is part of the documentation for kmail Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:37:35 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003