[PATCH] Support for KUrl in KConfigXT and KCModule's
Andreas Pakulat
apaku at gmx.de
Mon Mar 19 15:49:59 GMT 2007
On 19.03.07 16:27:25, Andreas Pakulat wrote:
> Hi,
>
> as proposed I added support for KUrl to KConfigXT and
> KConfigDialogManager, the attached patch adds a new
> KConfigSkeletonItem and adds the two missing signals for
> change-notification to KConfigDialogManager. Luckily KUrlRequester
> already defines url/setUrl as user property and thus no further changes
> are needed. Also included is a proper change to kconfig_compiler to use
> the new KConfigSkeletonItem in the .kcfg files.
PS: Feedback welcome, unless I hear strong objections I'm going to
commit this next monday, including the attached test case for
kconfig_compiler.
Andreas
--
You have an ambitious nature and may make a name for yourself.
-------------- next part --------------
Index: kdecore/kconfig_compiler/tests/test10.kcfgc
===================================================================
--- kdecore/kconfig_compiler/tests/test10.kcfgc (Revision 0)
+++ kdecore/kconfig_compiler/tests/test10.kcfgc (Revision 0)
@@ -0,0 +1,4 @@
+# Code generation options for kconfig_compiler
+File=test10.kcfg
+ClassName=Test10
+Singleton=true
Index: kdecore/kconfig_compiler/tests/test10.cpp.ref
===================================================================
--- kdecore/kconfig_compiler/tests/test10.cpp.ref (Revision 0)
+++ kdecore/kconfig_compiler/tests/test10.cpp.ref (Revision 0)
@@ -0,0 +1,37 @@
+// This file is generated by kconfig_compiler from test10.kcfg.
+// All changes you do to this file will be lost.
+
+#include "test10.h"
+
+#include <kstaticdeleter.h>
+
+Test10 *Test10::mSelf = 0;
+static KStaticDeleter<Test10> staticTest10Deleter;
+
+Test10 *Test10::self()
+{
+ if ( !mSelf ) {
+ staticTest10Deleter.setObject( mSelf, new Test10() );
+ mSelf->readConfig();
+ }
+
+ return mSelf;
+}
+
+Test10::Test10( )
+ : KConfigSkeleton( QLatin1String( "test10rc" ) )
+{
+ mSelf = this;
+ setCurrentGroup( QLatin1String( "Foo" ) );
+
+ KConfigSkeleton::ItemUrl *itemFooBar;
+ itemFooBar = new KConfigSkeleton::ItemUrl( currentGroup(), QLatin1String( "foo bar" ), mFooBar );
+ addItem( itemFooBar, QLatin1String( "FooBar" ) );
+}
+
+Test10::~Test10()
+{
+ if ( mSelf == this )
+ staticTest10Deleter.setObject( mSelf, 0, false );
+}
+
Index: kdecore/kconfig_compiler/tests/test10main.cpp
===================================================================
--- kdecore/kconfig_compiler/tests/test10main.cpp (Revision 0)
+++ kdecore/kconfig_compiler/tests/test10main.cpp (Revision 0)
@@ -0,0 +1,30 @@
+/*
+Copyright (c) 2004 Waldo Bastian <bastian at kde.org>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "test10.h"
+#include "kcomponentdata.h"
+
+int main( int, char** )
+{
+ KComponentData i("test");
+ Test10 *t = Test10::self();
+ delete t;
+}
Index: kdecore/kconfig_compiler/tests/test10.h.ref
===================================================================
--- kdecore/kconfig_compiler/tests/test10.h.ref (Revision 0)
+++ kdecore/kconfig_compiler/tests/test10.h.ref (Revision 0)
@@ -0,0 +1,43 @@
+// This file is generated by kconfig_compiler from test10.kcfg.
+// All changes you do to this file will be lost.
+#ifndef TEST10_H
+#define TEST10_H
+
+#include <kconfigskeleton.h>
+#include <kdebug.h>
+
+class Test10 : public KConfigSkeleton
+{
+ public:
+
+ static Test10 *self();
+ ~Test10();
+
+
+ /**
+ Get foo bar
+ */
+ static
+ KUrl fooBar()
+ {
+ return self()->mFooBar;
+ }
+
+ static
+ void writeConfig()
+ {
+ static_cast<KConfigSkeleton*>(self())->writeConfig();
+ }
+ protected:
+ Test10();
+ static Test10 *mSelf;
+
+
+ // Foo
+ KUrl mFooBar;
+
+ private:
+};
+
+#endif
+
Index: kdecore/kconfig_compiler/tests/CMakeLists.txt
===================================================================
--- kdecore/kconfig_compiler/tests/CMakeLists.txt (Revision 642947)
+++ kdecore/kconfig_compiler/tests/CMakeLists.txt (Arbeitskopie)
@@ -144,6 +144,19 @@ target_link_libraries(test9 ${KDE4_KDEC
########### next target ###############
+set(test10_SRCS test10main.cpp )
+
+kde4_automoc(${test10_SRCS})
+
+gen_kcfg_test_source(test10 test10_SRCS)
+
+kde4_add_executable(test10 NOGUI ${test10_SRCS})
+
+target_link_libraries(test10 ${KDE4_KDECORE_LIBS} )
+
+
+########### next target ###############
+
set(test_dpointer_SRCS test_dpointer_main.cpp )
kde4_automoc(${test_dpointer_SRCS})
Index: kdecore/kconfig_compiler/tests/test10.kcfg
===================================================================
--- kdecore/kconfig_compiler/tests/test10.kcfg (Revision 0)
+++ kdecore/kconfig_compiler/tests/test10.kcfg (Revision 0)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+ <kcfgfile name="test10rc"/>
+
+ <group name="Foo">
+ <entry name="FooBar" key="foo bar" type="Url"/>
+ </group>
+
+</kcfg>
More information about the kde-core-devel
mailing list