kmail

vacation.h

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