[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kdecore
From:       Helge Deller <deller () kde ! org>
Date:       2005-02-19 17:45:22
Message-ID: 20050219174522.E0DA31D2F3 () office ! kde ! org
[Download RAW message or body]

CVS commit by deller: 

add PathList support


  M +22 -0     kconfigskeleton.cpp   1.18
  M +15 -1     kconfigskeleton.h   1.27


--- kdelibs/kdecore/kconfigskeleton.h  #1.26:1.27
@@ -373,5 +373,5 @@ public:
   {
   public:
-    enum Type { Normal, Password, Path };
+    enum Type { Normal, Password, Path, PathList };
 
     ItemString(const QString & group, const QString & key,
@@ -757,4 +757,18 @@ public:
 
   /**
+   * Class for handling a path list preferences item.
+   */
+  class KDECORE_EXPORT ItemPathList:public ItemStringList
+  {
+  public:
+    ItemPathList(const QString & group, const QString & key,
+                   QStringList & reference,
+                   const QStringList & defaultValue = QStringList());
+
+    void readConfig(KConfig * config);
+  };
+
+
+  /**
    * Class for handling an integer list preferences item.
    */

--- kdelibs/kdecore/kconfigskeleton.cpp  #1.17:1.18
@@ -57,4 +57,6 @@ void KConfigSkeleton::ItemString::writeC
     else if ( mType == Path )
       config->writePathEntry( mKey, mReference );
+    else if ( mType == PathList )
+      config->writePathEntry( mKey, mReference );
     else if ( mType == Password )
       config->writeEntry( mKey, KStringHandler::obscure( mReference ) );
@@ -814,4 +816,24 @@ QVariant KConfigSkeleton::ItemStringList
 
 
+KConfigSkeleton::ItemPathList::ItemPathList( const QString &group, const QString &key,
+                                            QStringList &reference,
+                                            const QStringList &defaultValue )
+  : ItemStringList( group, key, reference, defaultValue )
+{
+}
+
+void KConfigSkeleton::ItemPathList::readConfig( KConfig *config )
+{
+  config->setGroup( mGroup );
+  if ( !config->hasKey( mKey ) )
+    mReference = mDefault;
+  else
+    mReference = config->readPathListEntry( mKey );
+  mLoadedValue = mReference;
+
+  readImmutability( config );
+}
+
+
 KConfigSkeleton::ItemIntList::ItemIntList( const QString &group, const QString &key,
                                       QValueList<int> &reference,


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic