kmail

vacation.h

Go to the documentation of this file.
00001 /*  -*- c++ -*-
00002     vacation.cpp
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
00013 */
00014 
00015 #ifndef __KMAIL_VACATION_H__
00016 #define __KMAIL_VACATION_H__
00017 
00018 #include <qobject.h>
00019 
00020 #include <kurl.h>
00021 
00022 class QString;
00023 class QStringList;
00024 template <typename T> class QValueList;
00025 namespace KMail {
00026   class SieveJob;
00027   class VacationDialog;
00028 }
00029 namespace KMime {
00030   namespace Types {
00031     struct AddrSpec;
00032     typedef QValueList<AddrSpec> AddrSpecList;
00033   }
00034 }
00035 
00036 namespace KMail {
00037 
00038   class Vacation : public QObject {
00039     Q_OBJECT
00040   public:
00041     Vacation( QObject * parent=0, bool checkOnly = false, const char * name=0 );
00042     virtual ~Vacation();
00043 
00044     bool isUsable() const { return !mUrl.isEmpty(); }
00045 
00046     static QString defaultMessageText();
00047     static int defaultNotificationInterval();
00048     static QStringList defaultMailAliases();
00049     static bool defaultSendForSpam();
00050     static QString defaultDomainName();
00051 
00052   protected:
00053     static QString composeScript( const QString & messageText,
00054                   int notificationInterval,
00055                   const KMime::Types::AddrSpecList & aliases,
00056                                   bool sendForSpam, const QString & excludeDomain );
00057     static bool parseScript( const QString & script, QString & messageText,
00058                  int & notificationInterval, QStringList & aliases,
00059                              bool & sendForSpam, QString & domainName );
00060     KURL findURL() const;
00061     void handlePutResult( KMail::SieveJob * job, bool success, bool );
00062 
00063 
00064   signals:
00065     void result( bool success );
00066     // indicates if the vaction script is active or not
00067     void scriptActive( bool active );
00068 
00069   protected slots:
00070     void slotDialogDefaults();
00071     void slotGetResult( KMail::SieveJob * job, bool success,
00072             const QString & script, bool active );
00073     void slotDialogOk();
00074     void slotDialogCancel();
00075     void slotPutActiveResult( KMail::SieveJob *, bool );
00076     void slotPutInactiveResult( KMail::SieveJob *, bool );
00077   protected:
00078     // IO:
00079     KMail::SieveJob * mSieveJob;
00080     KURL mUrl;
00081     // GUI:
00082     KMail::VacationDialog * mDialog;
00083     bool mWasActive;
00084     bool mCheckOnly;
00085   };
00086 
00087 } // namespace KMail
00088 
00089 #endif // __KMAIL_VACATION_H__