certmanager/lib

cryptoconfig.h
1 /*
2  cryptoconfig.h
3 
4  This file is part of libkleopatra, the KDE keymanagement library
5  Copyright (c) 2004 Klarälvdalens Datakonsult AB
6 
7  Libkleopatra is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of the
10  License, or (at your option) any later version.
11 
12  Libkleopatra is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  In addition, as a special exception, the copyright holders give
22  permission to link the code of this program with any edition of
23  the TQt library by Trolltech AS, Norway (or with modified versions
24  of TQt that use the same license as TQt), and distribute linked
25  combinations including the two. You must obey the GNU General
26  Public License in all respects for all of the code used other than
27  TQt. If you modify this file, you may extend this exception to
28  your version of the file, but you are not obligated to do so. If
29  you do not wish to do so, delete this exception statement from
30  your version.
31 */
32 
33 #ifndef CRYPTOCONFIG_H
34 #define CRYPTOCONFIG_H
35 
36 #ifdef __cplusplus
37 /* we read this file from a C compiler, and are only interested in the
38  * enums... */
39 
40 #include <kurl.h>
41 
42 /* Start reading this file from the bottom up :) */
43 
44 namespace Kleo {
45 
50 
51  public:
52 #endif /* __cplusplus */
58  enum Level { Level_Basic = 0,
59  Level_Advanced = 1,
60  Level_Expert = 2 };
61 
79  enum ArgType { ArgType_None = 0,
80  ArgType_String = 1,
81  ArgType_Int = 2,
82  ArgType_UInt = 3,
83  ArgType_Path = 4,
84  ArgType_URL = 5,
85  ArgType_LDAPURL = 6,
86  ArgType_DirPath = 7 };
87 
88 #ifdef __cplusplus
89  virtual ~CryptoConfigEntry() {}
90 
94  virtual TQString name() const = 0;
95 
99  virtual TQString description() const = 0;
100 
104  virtual bool isOptional() const = 0;
105 
109  virtual bool isReadOnly() const = 0;
110 
114  virtual bool isList() const = 0;
115 
119  virtual bool isRuntime() const = 0;
120 
124  virtual Level level() const = 0;
125 
129  virtual ArgType argType() const = 0;
130 
134  virtual bool isSet() const = 0;
135 
139  virtual bool boolValue() const = 0;
140 
145  virtual TQString stringValue() const = 0;
146 
150  virtual int intValue() const = 0;
151 
155  virtual unsigned int uintValue() const = 0;
156 
160  virtual KURL urlValue() const = 0;
161 
165  virtual unsigned int numberOfTimesSet() const = 0;
166 
170  virtual TQStringList stringValueList() const = 0;
171 
175  virtual TQValueList<int> intValueList() const = 0;
176 
180  virtual TQValueList<unsigned int> uintValueList() const = 0;
181 
185  virtual KURL::List urlValueList() const = 0;
186 
190  virtual void resetToDefault() = 0;
191 
196  virtual void setBoolValue( bool ) = 0;
197 
201  virtual void setStringValue( const TQString& ) = 0;
202 
206  virtual void setIntValue( int ) = 0;
207 
211  virtual void setUIntValue( unsigned int ) = 0;
212 
216  virtual void setURLValue( const KURL& ) = 0;
217 
221  virtual void setNumberOfTimesSet( unsigned int ) = 0;
222 
226  virtual void setStringValueList( const TQStringList& ) = 0;
227 
231  virtual void setIntValueList( const TQValueList<int>& ) = 0;
232 
236  virtual void setUIntValueList( const TQValueList<unsigned int>& ) = 0;
237 
241  virtual void setURLValueList( const KURL::List& ) = 0;
242 
246  virtual bool isDirty() const = 0;
247  };
248 
253 
254  public:
255  virtual ~CryptoConfigGroup() {}
256 
260  virtual TQString name() const = 0;
261 
265  virtual TQString iconName() const = 0;
266 
270  virtual TQString description() const = 0;
271 
275  virtual CryptoConfigEntry::Level level() const = 0;
276 
282  virtual TQStringList entryList() const = 0;
283 
289  virtual CryptoConfigEntry* entry( const TQString& name ) const = 0;
290  };
291 
296 
297  public:
298  virtual ~CryptoConfigComponent() {}
299 
303  virtual TQString name() const = 0;
304 
308  virtual TQString iconName() const = 0;
309 
313  virtual TQString description() const = 0;
314 
321  virtual TQStringList groupList() const = 0;
322 
327  virtual CryptoConfigGroup* group( const TQString& name ) const = 0;
328 
329  };
330 
334  class CryptoConfig {
335 
336  public:
337  virtual ~CryptoConfig() {}
338 
344  virtual TQStringList componentList() const = 0;
345 
350  virtual CryptoConfigComponent* component( const TQString& name ) const = 0;
351 
360  CryptoConfigEntry* entry( const TQString& componentName, const TQString& groupName, const TQString& entryName ) const {
361  const Kleo::CryptoConfigComponent* comp = component( componentName );
362  const Kleo::CryptoConfigGroup* group = comp ? comp->group( groupName ) : 0;
363  return group ? group->entry( entryName ) : 0;
364  }
365 
373  virtual void sync( bool runtime ) = 0;
374 
382  virtual void clear() = 0;
383  };
384 
385 }
386 #endif /* __cplusplus */
387 #endif /* CRYPTOCONFIG_H */
Crypto config for one component (e.g.
Definition: cryptoconfig.h:295
virtual TQString name() const =0
Return the internal name of this component.
virtual TQString iconName() const =0
Return the name of the icon for this component.
virtual TQString description() const =0
Return user-visible description of this component.
virtual TQStringList groupList() const =0
Returns the list of groups that are known about.
virtual CryptoConfigGroup * group(const TQString &name) const =0
Description of a single option.
Definition: cryptoconfig.h:49
virtual void setBoolValue(bool)=0
Define whether the option is set or not (only allowed for ArgType_None)
virtual bool isList() const =0
virtual ArgType argType() const =0
Argument type.
virtual TQValueList< int > intValueList() const =0
Return value as a list of signed ints.
virtual TQStringList stringValueList() const =0
Return value as a list of strings (mostly meaningful for String, Path and URL argtypes,...
virtual void setNumberOfTimesSet(unsigned int)=0
Set the number of times the option is set (only valid for ArgType_None, if isList())
virtual void setUIntValueList(const TQValueList< unsigned int > &)=0
Set a new list of unsigned int values.
virtual bool isDirty() const =0
virtual void setStringValueList(const TQStringList &)=0
Set a new string-list value (only allowed for String, Path and URL argtypes, if isList())
virtual bool isOptional() const =0
virtual KURL::List urlValueList() const =0
Return value as a list of URLs (only meaningful for Path and URL argtypes, if isList())
virtual TQString name() const =0
Return the internal name of this entry.
virtual void setURLValue(const KURL &)=0
Set value as a URL (only meaningful for Path (if local) and URL argtypes)
ArgType
Type of the argument.
Definition: cryptoconfig.h:79
virtual TQString stringValue() const =0
Return value as a string (available for all argtypes) The returned string can be empty (explicitely s...
virtual unsigned int uintValue() const =0
Return value as an unsigned int.
virtual void setUIntValue(unsigned int)=0
Set a new unsigned int value.
virtual Level level() const =0
User level.
virtual TQString description() const =0
virtual bool boolValue() const =0
Return value as a bool (only allowed for ArgType_None)
virtual int intValue() const =0
Return value as a signed int.
virtual KURL urlValue() const =0
Return value as a URL (only meaningful for Path and URL argtypes)
virtual TQValueList< unsigned int > uintValueList() const =0
Return value as a list of unsigned ints.
virtual unsigned int numberOfTimesSet() const =0
Return number of times the option is set (only valid for ArgType_None, if isList())
virtual bool isRuntime() const =0
virtual void setURLValueList(const KURL::List &)=0
Set value as a URL list (only meaningful for Path (if all URLs are local) and URL argtypes,...
virtual void setStringValue(const TQString &)=0
Set string value (allowed for all argtypes)
virtual void setIntValueList(const TQValueList< int > &)=0
Set a new list of signed int values.
virtual void resetToDefault()=0
Reset an option to its default value.
virtual bool isSet() const =0
Return true if the option is set, i.e.
virtual void setIntValue(int)=0
Set a new signed int value.
virtual bool isReadOnly() const =0
Group containing a set of config options.
Definition: cryptoconfig.h:252
virtual CryptoConfigEntry::Level level() const =0
User level.
virtual CryptoConfigEntry * entry(const TQString &name) const =0
virtual TQString description() const =0
virtual TQStringList entryList() const =0
Returns the list of entries that are known by this group.
virtual TQString iconName() const =0
Return the name of the icon for this group.
virtual TQString name() const =0
Return the internal name of this group.
Main interface to crypto configuration.
Definition: cryptoconfig.h:334
virtual void sync(bool runtime)=0
Write back changes.
virtual void clear()=0
Tells the CryptoConfig to discard any cached information, including all components,...
virtual TQStringList componentList() const =0
Returns the list of known components (e.g.
CryptoConfigEntry * entry(const TQString &componentName, const TQString &groupName, const TQString &entryName) const
Convenience method to get hold of a single configuration entry when its component,...
Definition: cryptoconfig.h:360
virtual CryptoConfigComponent * component(const TQString &name) const =0