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

List:       kde-commits
Subject:    kdelibs/kdecore/kconfig_compiler
From:       Helge Deller <deller () kde ! org>
Date:       2005-02-19 17:44:00
Message-ID: 20050219174400.5CD831D617 () office ! kde ! org
[Download RAW message or body]

CVS commit by deller: 

add PathList support to kconfig_compiler


  M +4 -2      example.cpp   1.2
  M +8 -0      example.kcfg   1.12
  M +1 -0      kcfg.xsd   1.7
  M +4 -1      kconfig_compiler.cpp   1.64


--- kdelibs/kdecore/kconfig_compiler/example.cpp  #1.1:1.2
@@ -46,5 +46,7 @@ int main( int argc, char **argv )
   prefs->setAnotherOption(17);
 
-  qWarning("Another Option = %d", prefs->anotherOption());
-  qWarning("Another Option2 = %d", prefs->anotherOption2());
+  kdWarning() << "Another Option  = " << prefs->anotherOption() << endl;
+  kdWarning() << "Another Option2 = " << prefs->anotherOption2() << endl;
+  kdWarning() << "MyPaths         = " << prefs->myPaths() << endl;
+  kdWarning() << "MyPaths2        = " << prefs->myPaths2() << endl;
 }

--- kdelibs/kdecore/kconfig_compiler/example.kcfg  #1.11:1.12
@@ -38,4 +38,12 @@
       <default code="true">QDir::homeDirPath()+QString::fromLatin1(".hidden_file")</default>
     </entry>
+    <entry name="MyPaths" type="PathList">
+      <label>This is a list of paths</label>
+      <default>/home,~</default>
+    </entry>
+    <entry name="MyPaths2" type="PathList">
+      <label>This is a list of paths (test2)</label>
+      <default code="true">QStringList(QDir::homeDirPath())</default>
+    </entry>
     <entry name="AnotherOption2" type="Int" key="Another Option">
       <label>Another option</label>

--- kdelibs/kdecore/kconfig_compiler/kcfg.xsd  #1.6:1.7
@@ -163,4 +163,5 @@
             <xsd:enumeration value="Enum"/>
             <xsd:enumeration value="Path"/>
+            <xsd:enumeration value="PathList"/>
             <xsd:enumeration value="Password"/>
         </xsd:restriction>

--- kdelibs/kdecore/kconfig_compiler/kconfig_compiler.cpp  #1.63:1.64
@@ -271,5 +271,5 @@ static void preProcessDefault( QString &
       defaultValue = literalString( defaultValue );
 
-    } else if ( type == "StringList" && !defaultValue.isEmpty() ) {
+    } else if ( (type == "StringList" || type == "PathList") && !defaultValue.isEmpty() ) {
       QTextStream cpp( &code, IO_WriteOnly | IO_Append );
       if (!code.isEmpty())
@@ -594,4 +594,5 @@ QString param( const QString &type )
     else if ( type == "Enum" )        return "int";
     else if ( type == "Path" )        return "const QString &";
+    else if ( type == "PathList" )    return "const QStringList &";
     else if ( type == "Password" )    return "const QString &";
     else {
@@ -623,4 +624,5 @@ QString cppType( const QString &type )
     else if ( type == "Enum" )        return "int";
     else if ( type == "Path" )        return "QString";
+    else if ( type == "PathList" )    return "QStringList";
     else if ( type == "Password" )    return "QString";
     else {
@@ -649,4 +651,5 @@ QString defaultValue( const QString &typ
     else if ( type == "Enum" )        return "0";
     else if ( type == "Path" )        return "\"\""; // Use empty string, not null string!
+    else if ( type == "PathList" )    return "QStringList()";
     else if ( type == "Password" )    return "\"\""; // Use empty string, not null string!
     else {


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

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