kmail

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 <qwidget.h>
00019 
00020 #include <kurl.h>
00021 
00022 class QCheckBox;
00023 class QLineEdit;
00024 class KIntSpinBox;
00025 class KConfigBase;
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       : mManagesieveSupported( managesieveSupported ),
00034     mReuseConfig( reuseConfig ),
00035     mPort( port ),
00036     mAlternateURL( alternateURL ) {}
00037 
00038     SieveConfig( const SieveConfig & other )
00039       : mManagesieveSupported( other.managesieveSupported() ),
00040     mReuseConfig( other.reuseConfig() ),
00041     mPort( other.port() ),
00042     mAlternateURL( other.alternateURL() ),
00043     mVacationFileName( other.vacationFileName() ) {}
00044 
00045     bool managesieveSupported() const {
00046       return mManagesieveSupported;
00047     }
00048     void setManagesieveSupported( bool enable ) {
00049       mManagesieveSupported = enable;
00050     }
00051 
00052     bool reuseConfig() const {
00053       return mReuseConfig;
00054     }
00055     void setReuseConfig( bool reuse ) {
00056       mReuseConfig = reuse;
00057     }
00058 
00059     unsigned short port() const {
00060       return mPort;
00061     }
00062     void setPort( unsigned short port ) {
00063       mPort = port;
00064     }
00065 
00066     KURL alternateURL() const {
00067       return mAlternateURL;
00068     }
00069     void setAlternateURL( const KURL & url ) {
00070       mAlternateURL = url;
00071     }
00072 
00073     QString vacationFileName() const { return mVacationFileName; }
00074 
00075     void readConfig( const KConfigBase & config );
00076     void writeConfig( KConfigBase & config ) const;
00077 
00078   protected:
00079     bool mManagesieveSupported;
00080     bool mReuseConfig;
00081     unsigned short mPort;
00082     KURL mAlternateURL;
00083     QString mVacationFileName;
00084   };
00085 
00086   class SieveConfigEditor : public QWidget {
00087     Q_OBJECT
00088   public:
00089     SieveConfigEditor( QWidget * parent=0, const char * name=0 );
00090 
00091     bool managesieveSupported() const;
00092     virtual void setManagesieveSupported( bool enable );
00093 
00094     bool reuseConfig() const;
00095     virtual void setReuseConfig( bool reuse );
00096 
00097     unsigned short port() const;
00098     virtual void setPort( unsigned short port );
00099 
00100     KURL alternateURL() const;
00101     virtual void setAlternateURL( const KURL & url );
00102 
00103     SieveConfig config() const {
00104       return SieveConfig( managesieveSupported(), reuseConfig(),
00105               port(), alternateURL() );
00106     }
00107 
00108     virtual void setConfig( const SieveConfig & config );
00109 
00110   protected slots:
00111     void slotEnableWidgets();
00112 
00113   protected:
00114     QCheckBox * mManagesieveCheck;
00115     QCheckBox * mSameConfigCheck;
00116     KIntSpinBox * mPortSpin;
00117     QLineEdit * mAlternateURLEdit;
00118   };
00119 
00120 } // namespace KMail
00121 
00122 #endif // __KMAIL_SIEVECONFIG_H__
KDE Home | KDE Accessibility Home | Description of Access Keys