certmanager/lib

cryptoconfig.h

00001 /*
00002     cryptoconfig.h
00003 
00004     This file is part of libkleopatra, the KDE keymanagement library
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 as
00009     published by the Free Software Foundation; either version 2 of the
00010     License, or (at your option) any later version.
00011 
00012     Libkleopatra is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021     In addition, as a special exception, the copyright holders give
00022     permission to link the code of this program with any edition of
00023     the Qt library by Trolltech AS, Norway (or with modified versions
00024     of Qt that use the same license as Qt), and distribute linked
00025     combinations including the two.  You must obey the GNU General
00026     Public License in all respects for all of the code used other than
00027     Qt.  If you modify this file, you may extend this exception to
00028     your version of the file, but you are not obligated to do so.  If
00029     you do not wish to do so, delete this exception statement from
00030     your version.
00031 */
00032 
00033 #ifndef CRYPTOCONFIG_H
00034 #define CRYPTOCONFIG_H
00035 
00036 #ifdef __cplusplus
00037 /* we read this file from a C compiler, and are only interested in the
00038  * enums... */
00039 
00040 #include <kurl.h>
00041 
00042 /* Start reading this file from the bottom up :) */
00043 
00044 namespace Kleo {
00045 
00049   class CryptoConfigEntry {
00050 
00051   public:
00052 #endif /* __cplusplus */
00053 
00058     enum Level { Level_Basic = 0,
00059                  Level_Advanced = 1,
00060                  Level_Expert = 2 };
00061 
00079     enum ArgType { ArgType_None = 0,
00080                    ArgType_String = 1,
00081                    ArgType_Int = 2,
00082                    ArgType_UInt = 3,
00083                    ArgType_Path = 4,
00084                    ArgType_URL = 5,
00085                    ArgType_LDAPURL = 6,
00086                    ArgType_DirPath = 7 };
00087 
00088 #ifdef __cplusplus
00089     virtual ~CryptoConfigEntry() {}
00090 
00094     virtual QString name() const = 0;
00095 
00099     virtual QString description() const = 0;
00100 
00104     virtual bool isOptional() const = 0;
00105 
00109     virtual bool isList() const = 0;
00110 
00114     virtual bool isRuntime() const = 0;
00115 
00119     virtual Level level() const = 0;
00120 
00124     virtual ArgType argType() const = 0;
00125 
00129     virtual bool isSet() const = 0;
00130 
00134     virtual bool boolValue() const = 0;
00135 
00140     virtual QString stringValue() const = 0;
00141 
00145     virtual int intValue() const = 0;
00146 
00150     virtual unsigned int uintValue() const = 0;
00151 
00155     virtual KURL urlValue() const = 0;
00156 
00160     virtual unsigned int numberOfTimesSet() const = 0;
00161 
00165     virtual QStringList stringValueList() const = 0;
00166 
00170     virtual QValueList<int> intValueList() const = 0;
00171 
00175     virtual QValueList<unsigned int> uintValueList() const = 0;
00176 
00180     virtual KURL::List urlValueList() const = 0;
00181 
00185     virtual void resetToDefault() = 0;
00186 
00191     virtual void setBoolValue( bool ) = 0;
00192 
00196     virtual void setStringValue( const QString& ) = 0;
00197 
00201     virtual void setIntValue( int ) = 0;
00202 
00206     virtual void setUIntValue( unsigned int ) = 0;
00207 
00211     virtual void setURLValue( const KURL& ) = 0;
00212 
00216     virtual void setNumberOfTimesSet( unsigned int ) = 0;
00217 
00221     virtual void setStringValueList( const QStringList& ) = 0;
00222 
00226     virtual void setIntValueList( const QValueList<int>& ) = 0;
00227 
00231     virtual void setUIntValueList( const QValueList<unsigned int>& ) = 0;
00232 
00236     virtual void setURLValueList( const KURL::List& ) = 0;
00237 
00241     virtual bool isDirty() const = 0;
00242   };
00243 
00247   class CryptoConfigGroup {
00248 
00249   public:
00250     virtual ~CryptoConfigGroup() {}
00251 
00255     virtual QString name() const = 0;
00256 
00260     virtual QString iconName() const = 0;
00261 
00265     virtual QString description() const = 0;
00266 
00270     virtual CryptoConfigEntry::Level level() const = 0;
00271 
00277     virtual QStringList entryList() const = 0;
00278 
00284     virtual CryptoConfigEntry* entry( const QString& name ) const = 0;
00285   };
00286 
00290   class CryptoConfigComponent {
00291 
00292   public:
00293     virtual ~CryptoConfigComponent() {}
00294 
00298     virtual QString name() const = 0;
00299 
00303     virtual QString iconName() const = 0;
00304 
00308     virtual QString description() const = 0;
00309 
00316     virtual QStringList groupList() const = 0;
00317 
00322     virtual CryptoConfigGroup* group( const QString& name ) const = 0;
00323 
00324   };
00325 
00329   class CryptoConfig {
00330 
00331   public:
00332     virtual ~CryptoConfig() {}
00333 
00339     virtual QStringList componentList() const = 0;
00340 
00345     virtual CryptoConfigComponent* component( const QString& name ) const = 0;
00346 
00355     CryptoConfigEntry* entry( const QString& componentName, const QString& groupName, const QString& entryName ) const {
00356       const Kleo::CryptoConfigComponent* comp = component( componentName );
00357       const Kleo::CryptoConfigGroup* group = comp ? comp->group( groupName ) : 0;
00358       return group ? group->entry( entryName ) : 0;
00359     }
00360 
00368     virtual void sync( bool runtime ) = 0;
00369 
00377     virtual void clear() = 0;
00378   };
00379 
00380 }
00381 #endif /* __cplusplus */
00382 #endif /* CRYPTOCONFIG_H */
KDE Home | KDE Accessibility Home | Description of Access Keys