certmanager Library API Documentation

cryptoconfigmodule.h

00001 /*
00002     cryptoconfigmodule.h
00003 
00004     This file is part of kgpgcertmanager
00005     Copyright (c) 2004 Klarälvdalens Datakonsult AB
00006 
00007     Libkleopatra is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU General Public License,
00009     version 2, as published by the Free Software Foundation.
00010 
00011     Libkleopatra is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020     In addition, as a special exception, the copyright holders give
00021     permission to link the code of this program with any edition of
00022     the Qt library by Trolltech AS, Norway (or with modified versions
00023     of Qt that use the same license as Qt), and distribute linked
00024     combinations including the two.  You must obey the GNU General
00025     Public License in all respects for all of the code used other than
00026     Qt.  If you modify this file, you may extend this exception to
00027     your version of the file, but you are not obligated to do so.  If
00028     you do not wish to do so, delete this exception statement from
00029     your version.
00030 */
00031 
00032 #ifndef CRYPTOCONFIGMODULE_H
00033 #define CRYPTOCONFIGMODULE_H
00034 
00035 #include <kjanuswidget.h>
00036 #include <qgroupbox.h>
00037 #include <qtabwidget.h>
00038 #include <qhbox.h>
00039 #include <qcheckbox.h>
00040 #include <kurl.h>
00041 
00042 class KLineEdit;
00043 class KIntNumInput;
00044 class QPushButton;
00045 
00046 namespace Kleo {
00047 
00048   class CryptoConfig;
00049   class CryptoConfigComponent;
00050   class CryptoConfigGroup;
00051   class CryptoConfigEntry;
00052   class CryptoConfigComponentGUI;
00053   class CryptoConfigGroupGUI;
00054   class CryptoConfigEntryGUI;
00055 
00060   class CryptoConfigModule : public KJanusWidget {
00061     Q_OBJECT
00062   public:
00063     CryptoConfigModule( Kleo::CryptoConfig* config, QWidget * parent=0, const char * name=0 );
00064 
00065     void save();
00066     void reset(); // i.e. reload current settings, discarding user input
00067     void defaults();
00068     void cancel();
00069 
00070   signals:
00071     void changed();
00072 
00073   private:
00074     Kleo::CryptoConfig* mConfig;
00075     QValueList<CryptoConfigComponentGUI *> mComponentGUIs;
00076   };
00077 
00081   class CryptoConfigComponentGUI : public QWidget {
00082     Q_OBJECT
00083 
00084   public:
00085     CryptoConfigComponentGUI( CryptoConfigModule* module, Kleo::CryptoConfigComponent* component,
00086                               QWidget* parent, const char* name = 0 );
00087 
00088     bool save();
00089     void load();
00090     void defaults();
00091 
00092   private:
00093     Kleo::CryptoConfigComponent* mComponent;
00094     QValueList<CryptoConfigGroupGUI *> mGroupGUIs;
00095   };
00096 
00100   class CryptoConfigGroupGUI : public QGroupBox {
00101     Q_OBJECT
00102 
00103   public:
00104     CryptoConfigGroupGUI( CryptoConfigModule* module, Kleo::CryptoConfigGroup* group,
00105                           QWidget* parent, const char* name = 0 );
00106 
00107     bool save();
00108     void load();
00109     void defaults();
00110 
00111   private:
00112     Kleo::CryptoConfigGroup* mGroup;
00113     QValueList<CryptoConfigEntryGUI *> mEntryGUIs;
00114   };
00115 
00120   class CryptoConfigEntryGUIFactory {
00121   public:
00122     static CryptoConfigEntryGUI* createEntryGUI(
00123       CryptoConfigModule* module,
00124       Kleo::CryptoConfigEntry* entry, const QString& entryName,
00125       QWidget* parent, const char* name = 0 );
00126   };
00127 
00131   class CryptoConfigEntryGUI : public QHBox {
00132     Q_OBJECT
00133   public:
00134     CryptoConfigEntryGUI( CryptoConfigModule* module,
00135                           Kleo::CryptoConfigEntry* entry,
00136                           const QString& entryName,
00137                           QWidget* parent, const char* name = 0 );
00138     virtual ~CryptoConfigEntryGUI() {}
00139 
00140     void load() { doLoad(); mChanged = false; }
00141     void save() { Q_ASSERT( mChanged ); doSave(); mChanged = false; }
00142     void resetToDefault();
00143 
00144     QString description() const;
00145     bool isChanged() const { return mChanged; }
00146 
00147   signals:
00148     void changed();
00149 
00150   protected slots:
00151     void slotChanged() {
00152       mChanged = true;
00153       emit changed();
00154     }
00155 
00156   protected:
00157     virtual void doSave() = 0;
00158     virtual void doLoad() = 0;
00159 
00160     Kleo::CryptoConfigEntry* mEntry;
00161     QString mName;
00162     bool mChanged;
00163   };
00164 
00168   class CryptoConfigEntryLineEdit : public CryptoConfigEntryGUI {
00169     Q_OBJECT
00170 
00171   public:
00172     CryptoConfigEntryLineEdit( CryptoConfigModule* module,
00173                                Kleo::CryptoConfigEntry* entry,
00174                                const QString& entryName,
00175                                QWidget* parent, const char* name = 0 );
00176 
00177     virtual void doSave();
00178     virtual void doLoad();
00179   private:
00180     KLineEdit* mLineEdit;
00181   };
00182 
00186   class CryptoConfigEntrySpinBox : public CryptoConfigEntryGUI {
00187     Q_OBJECT
00188 
00189   public:
00190     CryptoConfigEntrySpinBox( CryptoConfigModule* module,
00191                               Kleo::CryptoConfigEntry* entry,
00192                               const QString& entryName,
00193                               QWidget* parent, const char* name = 0 );
00194     virtual void doSave();
00195     virtual void doLoad();
00196   private:
00197     enum { Int, UInt, ListOfNone } mKind;
00198     KIntNumInput* mNumInput;
00199   };
00200 
00204   class CryptoConfigEntryCheckBox : public CryptoConfigEntryGUI {
00205     Q_OBJECT
00206 
00207   public:
00208     CryptoConfigEntryCheckBox( CryptoConfigModule* module,
00209                                Kleo::CryptoConfigEntry* entry,
00210                                const QString& entryName,
00211                                QWidget* parent, const char* name = 0 );
00212     virtual void doSave();
00213     virtual void doLoad();
00214   private:
00215     QCheckBox* mCheckBox;
00216   };
00217 
00221   class CryptoConfigEntryLDAPURL : public CryptoConfigEntryGUI {
00222     Q_OBJECT
00223 
00224   public:
00225     CryptoConfigEntryLDAPURL( CryptoConfigModule* module,
00226                               Kleo::CryptoConfigEntry* entry,
00227                               const QString& entryName,
00228                               QWidget* parent, const char* name = 0 );
00229     virtual void doSave();
00230     virtual void doLoad();
00231   private slots:
00232     void slotOpenDialog();
00233   private:
00234     void setURLList( const KURL::List& urlList );
00235     QLabel* mLabel;
00236     QPushButton* mPushButton;
00237     KURL::List mURLList;
00238   };
00239 }
00240 
00241 #endif
KDE Logo
This file is part of the documentation for certmanager Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 22:39:32 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003