kmail Library API Documentation

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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 
00044     bool managesieveSupported() const {
00045       return mManagesieveSupported;
00046     }
00047     void setManagesieveSupported( bool enable ) {
00048       mManagesieveSupported = enable;
00049     }
00050 
00051     bool reuseConfig() const {
00052       return mReuseConfig;
00053     }
00054     void setReuseConfig( bool reuse ) {
00055       mReuseConfig = reuse;
00056     }
00057 
00058     unsigned short port() const {
00059       return mPort;
00060     }
00061     void setPort( unsigned short port ) {
00062       mPort = port;
00063     }
00064 
00065     KURL alternateURL() const {
00066       return mAlternateURL;
00067     }
00068     void setAlternateURL( const KURL & url ) {
00069       mAlternateURL = url;
00070     }
00071 
00072     void readConfig( const KConfigBase & config );
00073     void writeConfig( KConfigBase & config ) const;
00074 
00075   protected:
00076     bool mManagesieveSupported;
00077     bool mReuseConfig;
00078     unsigned short mPort;
00079     KURL mAlternateURL;
00080   };
00081 
00082   class SieveConfigEditor : public QWidget {
00083     Q_OBJECT
00084   public:
00085     SieveConfigEditor( QWidget * parent=0, const char * name=0 );
00086 
00087     bool managesieveSupported() const;
00088     virtual void setManagesieveSupported( bool enable );
00089 
00090     bool reuseConfig() const;
00091     virtual void setReuseConfig( bool reuse );
00092 
00093     unsigned short port() const;
00094     virtual void setPort( unsigned short port );
00095 
00096     KURL alternateURL() const;
00097     virtual void setAlternateURL( const KURL & url );
00098 
00099     SieveConfig config() const {
00100       return SieveConfig( managesieveSupported(), reuseConfig(),
00101               port(), alternateURL() );
00102     }
00103 
00104     virtual void setConfig( const SieveConfig & config );
00105 
00106   protected slots:
00107     void slotEnableWidgets();
00108     
00109   protected:
00110     QCheckBox * mManagesieveCheck;
00111     QCheckBox * mSameConfigCheck;
00112     KIntSpinBox * mPortSpin;
00113     QLineEdit * mAlternateURLEdit;
00114   };
00115 
00116 } // namespace KMail
00117 
00118 #endif // __KMAIL_SIEVECONFIG_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