sieveconfig.h
00001 /* -*- c++ -*- 00002 sieveconfig.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US 00013 */ 00014 00015 #ifndef __KMAIL_SIEVECONFIG_H__ 00016 #define __KMAIL_SIEVECONFIG_H__ 00017 00018 #include <tqwidget.h> 00019 00020 #include <kurl.h> 00021 00022 class TQCheckBox; 00023 class TQLineEdit; 00024 class KIntSpinBox; 00025 class TDEConfigBase; 00026 00027 namespace KMail { 00028 00029 class SieveConfig { 00030 public: 00031 SieveConfig( bool managesieveSupported=false, bool reuseConfig=true, 00032 unsigned int port=2000, const KURL & alternateURL=KURL(), 00033 const TQString& vacationFileName = TQString() ) 00034 : mManagesieveSupported( managesieveSupported ), 00035 mReuseConfig( reuseConfig ), 00036 mPort( port ), 00037 mAlternateURL( alternateURL ), 00038 mVacationFileName( vacationFileName ) {} 00039 00040 SieveConfig( const SieveConfig & other ) 00041 : mManagesieveSupported( other.managesieveSupported() ), 00042 mReuseConfig( other.reuseConfig() ), 00043 mPort( other.port() ), 00044 mAlternateURL( other.alternateURL() ), 00045 mVacationFileName( other.vacationFileName() ) {} 00046 00047 bool managesieveSupported() const { 00048 return mManagesieveSupported; 00049 } 00050 void setManagesieveSupported( bool enable ) { 00051 mManagesieveSupported = enable; 00052 } 00053 00054 bool reuseConfig() const { 00055 return mReuseConfig; 00056 } 00057 void setReuseConfig( bool reuse ) { 00058 mReuseConfig = reuse; 00059 } 00060 00061 unsigned short port() const { 00062 return mPort; 00063 } 00064 void setPort( unsigned short port ) { 00065 mPort = port; 00066 } 00067 00068 KURL alternateURL() const { 00069 return mAlternateURL; 00070 } 00071 void setAlternateURL( const KURL & url ) { 00072 mAlternateURL = url; 00073 } 00074 00075 TQString vacationFileName() const { return mVacationFileName; } 00076 00077 void readConfig( const TDEConfigBase & config ); 00078 void writeConfig( TDEConfigBase & config ) const; 00079 00080 protected: 00081 bool mManagesieveSupported; 00082 bool mReuseConfig; 00083 unsigned short mPort; 00084 KURL mAlternateURL; 00085 TQString mVacationFileName; 00086 }; 00087 00088 class SieveConfigEditor : public TQWidget { 00089 Q_OBJECT 00090 00091 public: 00092 SieveConfigEditor( TQWidget * parent=0, const char * name=0 ); 00093 00094 bool managesieveSupported() const; 00095 virtual void setManagesieveSupported( bool enable ); 00096 00097 bool reuseConfig() const; 00098 virtual void setReuseConfig( bool reuse ); 00099 00100 unsigned short port() const; 00101 virtual void setPort( unsigned short port ); 00102 00103 KURL alternateURL() const; 00104 virtual void setAlternateURL( const KURL & url ); 00105 00106 TQString vacationFileName() const; 00107 virtual void setVacationFileName( const TQString & url ); 00108 00109 SieveConfig config() const { 00110 return SieveConfig( managesieveSupported(), reuseConfig(), 00111 port(), alternateURL(), vacationFileName() ); 00112 } 00113 00114 virtual void setConfig( const SieveConfig & config ); 00115 00116 protected slots: 00117 void slotEnableWidgets(); 00118 00119 protected: 00120 TQCheckBox * mManagesieveCheck; 00121 TQCheckBox * mSameConfigCheck; 00122 KIntSpinBox * mPortSpin; 00123 TQLineEdit * mAlternateURLEdit; 00124 TQString mVacationFileName; 00125 }; 00126 00127 } // namespace KMail 00128 00129 #endif // __KMAIL_SIEVECONFIG_H__