diff options
Diffstat (limited to 'tdecore/kconfig_compiler/tests')
58 files changed, 3592 insertions, 0 deletions
diff --git a/tdecore/kconfig_compiler/tests/Makefile.am b/tdecore/kconfig_compiler/tests/Makefile.am new file mode 100644 index 000000000..0b47449fa --- /dev/null +++ b/tdecore/kconfig_compiler/tests/Makefile.am @@ -0,0 +1,134 @@ +AM_CPPFLAGS = -I$(top_srcdir)/tdecore -I$(top_srcdir)/kunittest $(all_includes) -DQT_NO_CAST_ASCII -DSRCDIR=\"$(srcdir)\" + +check_PROGRAMS = test1 test2 test3 test4 test5 test6 test7 test8 test9 test_dpointer + +CLEANFILES = test1.cpp test1.h \ + test2.cpp test2.h \ + test3.cpp test3.h \ + test4.cpp test4.h \ + test5.cpp test5.h \ + test6.cpp test6.h \ + test7.cpp test7.h \ + test8a.cpp test8a.h test8b.cpp test8b.h \ + test9.cpp test9.h \ + test_dpointer.cpp test_dpointer.h \ + md5sums + +test1_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor +test1_LDADD = $(LIB_KDECORE) +test1_SOURCES = test1main.cpp test1.cpp + +test2_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor +test2_LDADD = $(LIB_KDECORE) +test2_SOURCES = test2main.cpp test2.cpp + +test3_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor +test3_LDADD = $(LIB_KDECORE) +test3_SOURCES = test3main.cpp test3.cpp + +test4_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor +test4_LDADD = $(LIB_KDECORE) +test4_SOURCES = test4main.cpp test4.cpp + +test5_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor +test5_LDADD = $(LIB_KDECORE) +test5_SOURCES = test5main.cpp test5.cpp + +test6_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor +test6_LDADD = $(LIB_KDECORE) +test6_SOURCES = test6main.cpp test6.cpp + +test7_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor +test7_LDADD = $(LIB_KDECORE) +test7_SOURCES = test7main.cpp test7.cpp + +test8_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor +test8_LDADD = $(LIB_KDECORE) +test8_SOURCES = test8main.cpp test8a.cpp test8b.cpp + +test9_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor +test9_LDADD = $(LIB_KDECORE) +test9_SOURCES = test9main.cpp test9.cpp + +test_dpointer_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_KDECORE) $(LIB_KDEUI) -ltdefx $(LIB_KIO) -lktexteditor +test_dpointer_LDADD = $(LIB_KDECORE) +test_dpointer_SOURCES = test_dpointer_main.cpp test_dpointer.cpp + +check_LTLIBRARIES = kunittest_kconfigcompiler_test.la + +kunittest_kconfigcompiler_test_la_SOURCES = kconfigcompiler_test.cpp +kunittest_kconfigcompiler_test_la_LIBADD = \ + $(top_builddir)/kunittest/libkunittest.la +kunittest_kconfigcompiler_test_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) \ + $(all_libraries) + + +test1main.o test1.o: test1.h +# avoid running the below command in parallel +test1.cpp: test1.h +test1.cpp test1.h: $(srcdir)/test1.kcfg ../kconfig_compiler $(srcdir)/test1.kcfgc + ../kconfig_compiler $(srcdir)/test1.kcfg $(srcdir)/test1.kcfgc + +test2main.o test2.o: test2.h +# avoid running the below command in parallel +test2.cpp: test2.h +test2.cpp test2.h: $(srcdir)/test2.kcfg ../kconfig_compiler $(srcdir)/test2.kcfgc + ../kconfig_compiler $(srcdir)/test2.kcfg $(srcdir)/test2.kcfgc + +test3main.o test3.o: test3.h +# avoid running the below command in parallel +test3.cpp: test3.h +test3.cpp test3.h: $(srcdir)/test3.kcfg ../kconfig_compiler $(srcdir)/test3.kcfgc + ../kconfig_compiler $(srcdir)/test3.kcfg $(srcdir)/test3.kcfgc + +test4main.o test4.o: test4.h +# avoid running the below command in parallel +test4.cpp: test4.h +test4.cpp test4.h: $(srcdir)/test4.kcfg ../kconfig_compiler $(srcdir)/test4.kcfgc + ../kconfig_compiler $(srcdir)/test4.kcfg $(srcdir)/test4.kcfgc + +test5main.o test5.o: test5.h +# avoid running the below command in parallel +test5.cpp: test5.h +test5.cpp test5.h: $(srcdir)/test5.kcfg ../kconfig_compiler $(srcdir)/test5.kcfgc + ../kconfig_compiler $(srcdir)/test5.kcfg $(srcdir)/test5.kcfgc + +test6main.o test6.o: test6.h +# avoid running the below command in parallel +test6.cpp: test6.h +test6.cpp test6.h: $(srcdir)/test6.kcfg ../kconfig_compiler $(srcdir)/test6.kcfgc + ../kconfig_compiler $(srcdir)/test6.kcfg $(srcdir)/test6.kcfgc + +test7main.o test7.o: test7.h +# avoid running the below command in parallel +test7.cpp: test7.h +test7.cpp test7.h: $(srcdir)/test7.kcfg ../kconfig_compiler $(srcdir)/test7.kcfgc + ../kconfig_compiler $(srcdir)/test7.kcfg $(srcdir)/test7.kcfgc + +test8main.o test8a.o test8b.o: test8a.h test8b.h +# avoid running the below command in parallel +test8a.cpp: test8a.h +test8a.cpp test8a.h: $(srcdir)/test8a.kcfg ../kconfig_compiler $(srcdir)/test8a.kcfgc + ../kconfig_compiler $(srcdir)/test8a.kcfg $(srcdir)/test8a.kcfgc +test8b.cpp: test8b.h +test8b.cpp test8b.h: $(srcdir)/test8b.kcfg ../kconfig_compiler $(srcdir)/test8b.kcfgc + ../kconfig_compiler $(srcdir)/test8b.kcfg $(srcdir)/test8b.kcfgc + +test9main.o test9.o: test9.h +# avoid running the below command in parallel +test9.cpp: test9.h +test9.cpp test9.h: $(srcdir)/test9.kcfg ../kconfig_compiler $(srcdir)/test9.kcfgc + ../kconfig_compiler $(srcdir)/test9.kcfg $(srcdir)/test9.kcfgc + +test_dpointer_main.o test_dpointer.o: test_dpointer.h +# avoid running the below command in parallel +test_dpointer.cpp: test_dpointer.h +test_dpointer.cpp test_dpointer.h: $(srcdir)/test_dpointer.kcfg ../kconfig_compiler $(srcdir)/test_dpointer.kcfgc + ../kconfig_compiler $(srcdir)/test_dpointer.kcfg $(srcdir)/test_dpointer.kcfgc + +md5sums: + $(MD5SUM) $(srcdir)/test*.ref | sed -e "s,$(srcdir)/,,; s,\.ref$$,," > md5sums + +md5check: test1.cpp test2.cpp test3.cpp test4.cpp test5.cpp test6.cpp test7.cpp test8a.cpp test8b.cpp test9.cpp md5sums + $(MD5SUM) -c md5sums + diff --git a/tdecore/kconfig_compiler/tests/kconfigcompiler_test.cpp b/tdecore/kconfig_compiler/tests/kconfigcompiler_test.cpp new file mode 100644 index 000000000..3dd197b34 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/kconfigcompiler_test.cpp @@ -0,0 +1,96 @@ +/* + Tests for KConfig Compiler + + Copyright (c) 2005 by Duncan Mac-Vicar <duncan@kde.org> + + ************************************************************************* + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + ************************************************************************* +*/ + +#include <tqfile.h> +#include <tqstring.h> +#include <kdebug.h> +#include <kunittest/module.h> +#include "kconfigcompiler_test.h" + +using namespace KUnitTest; + +KUNITTEST_MODULE( kunittest_kconfigcompiler_test, "KConfigXT") +KUNITTEST_MODULE_REGISTER_TESTER( KConfigCompiler_Test ) + +typedef const char * CompilerTestSet[]; + +static CompilerTestSet testCases = +{ + "test1.cpp", "test1.h", + "test2.cpp", "test2.h", + "test3.cpp", "test3.h", + "test4.cpp", "test4.h", + "test5.cpp", "test5.h", + "test6.cpp", "test6.h", + "test7.cpp", "test7.h", + "test8a.cpp", "test8a.h", + "test8b.cpp", "test8b.h", + "test9.h", "test9.cpp", + "test_dpointer.cpp", "test_dpointer.h", + NULL +}; + +static CompilerTestSet willFailCases = +{ + // where is that TQDir comming from? + //"test9.cpp", NULL + NULL +}; + + +void KConfigCompiler_Test::allTests() +{ + testExpectedOutput(); +} + +void KConfigCompiler_Test::testExpectedOutput() +{ + uint i = 0; + // Known to pass test cases + while (testCases[ i ]) + { + performCompare(TQString::tqfromLatin1(testCases[ i ])); + ++i; + } + + // broken test cases + i= 0; + while (willFailCases[ i ]) + { + performCompare(TQString::tqfromLatin1(willFailCases[ i ]), true); + ++i; + } +} + +void KConfigCompiler_Test::performCompare(const TQString &fileName, bool fail) +{ + TQFile file(fileName); + TQFile fileRef(TQString::tqfromLatin1(SRCDIR) + TQString::tqfromLatin1("/") + fileName + TQString::tqfromLatin1(".ref")); + + if ( file.open(IO_ReadOnly) && fileRef.open(IO_ReadOnly) ) + { + TQString content = file.readAll(); + TQString contentRef = fileRef.readAll(); + + if (!fail) + CHECK( content, contentRef); + else + XFAIL( content, contentRef); + } + else + { + SKIP("Can't open file for comparision"); + } +} diff --git a/tdecore/kconfig_compiler/tests/kconfigcompiler_test.h b/tdecore/kconfig_compiler/tests/kconfigcompiler_test.h new file mode 100644 index 000000000..36b33cd47 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/kconfigcompiler_test.h @@ -0,0 +1,35 @@ +/* + Tests for KConfig Compiler + + Copyright (c) 2005 by Duncan Mac-Vicar <duncan@kde.org> + + ************************************************************************* + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2 of the License, or (at your option) any later version. * + * * + ************************************************************************* +*/ + +#ifndef KCONFIGCOMPILER_TEST_H +#define KCONFIGCOMPILER_TEST_H + +#include <kunittest/tester.h> + +class TQString; + +// change to SlotTester when it works +class KConfigCompiler_Test : public KUnitTest::Tester +{ +public: + void allTests(); +public slots: + void testExpectedOutput(); +private: + void performCompare(const TQString &fileName, bool fail=false); +}; + +#endif + diff --git a/tdecore/kconfig_compiler/tests/myprefs.h b/tdecore/kconfig_compiler/tests/myprefs.h new file mode 100644 index 000000000..ebef89c08 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/myprefs.h @@ -0,0 +1,7 @@ +#include <kconfigskeleton.h> + +class MyPrefs : public KConfigSkeleton +{ + public: + MyPrefs( const TQString &a ) : KConfigSkeleton( a ) {} +}; diff --git a/tdecore/kconfig_compiler/tests/test1.cpp.ref b/tdecore/kconfig_compiler/tests/test1.cpp.ref new file mode 100644 index 000000000..f8c4c1189 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test1.cpp.ref @@ -0,0 +1,72 @@ +// This file is generated by kconfig_compiler from test1.kcfg. +// All changes you do to this file will be lost. + +#include "test1.h" + +Test1::Test1( const TQString & transport, const TQString & folder ) + : KConfigSkeleton( TQString::tqfromLatin1( "examplerc" ) ) + , mParamtransport(transport) + , mParamfolder(folder) +{ + setCurrentGroup( TQString::tqfromLatin1( "General-%1" ).arg( mParamfolder ) ); + + KConfigSkeleton::ItemBool *itemOneOption; + itemOneOption = new KConfigSkeleton::ItemBool( currentGroup(), TQString::tqfromLatin1( "OneOption" ), mOneOption, true ); + addItem( itemOneOption, TQString::tqfromLatin1( "OneOption" ) ); + KConfigSkeleton::ItemInt *itemAnotherOption; + itemAnotherOption = new KConfigSkeleton::ItemInt( currentGroup(), TQString::tqfromLatin1( "Another Option" ), mAnotherOption, 5 ); + addItem( itemAnotherOption, TQString::tqfromLatin1( "AnotherOption" ) ); + TQValueList<KConfigSkeleton::ItemEnum::Choice> valuesListOption; + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "One" ); + valuesListOption.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "Two" ); + valuesListOption.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "Three" ); + valuesListOption.append( choice ); + } + KConfigSkeleton::ItemEnum *itemListOption; + itemListOption = new KConfigSkeleton::ItemEnum( currentGroup(), TQString::tqfromLatin1( "ListOption" ), mListOption, valuesListOption, EnumListOption::One ); + addItem( itemListOption, TQString::tqfromLatin1( "ListOption" ) ); + + setCurrentGroup( TQString::tqfromLatin1( "MyOptions" ) ); + + KConfigSkeleton::ItemString *itemMyString; + itemMyString = new KConfigSkeleton::ItemString( currentGroup(), TQString::tqfromLatin1( "MyString" ), mMyString, TQString::tqfromLatin1( "Default String" ) ); + addItem( itemMyString, TQString::tqfromLatin1( "MyString" ) ); + KConfigSkeleton::ItemPath *itemMyPath; + itemMyPath = new KConfigSkeleton::ItemPath( currentGroup(), TQString::tqfromLatin1( "MyPath" ), mMyPath, TQDir::homeDirPath()+TQString::tqfromLatin1(".hidden_file") ); + addItem( itemMyPath, TQString::tqfromLatin1( "MyPath" ) ); + KConfigSkeleton::ItemInt *itemAnotherOption2; + itemAnotherOption2 = new KConfigSkeleton::ItemInt( currentGroup(), TQString::tqfromLatin1( "Another Option" ), mAnotherOption2, 10 ); + addItem( itemAnotherOption2, TQString::tqfromLatin1( "AnotherOption2" ) ); + TQStringList defaultMyStringList; + defaultMyStringList.append( TQString::fromUtf8( "up" ) ); + defaultMyStringList.append( TQString::fromUtf8( "down" ) ); + + KConfigSkeleton::ItemStringList *itemMyStringList; + itemMyStringList = new KConfigSkeleton::ItemStringList( currentGroup(), TQString::tqfromLatin1( "MyStringList" ), mMyStringList, defaultMyStringList ); + addItem( itemMyStringList, TQString::tqfromLatin1( "MyStringList" ) ); + TQStringList defaultMyStringListHidden; + defaultMyStringListHidden.append( TQString::fromUtf8( "up" ) ); + defaultMyStringListHidden.append( TQString::fromUtf8( "down" ) ); + + KConfigSkeleton::ItemStringList *itemMyStringListHidden; + itemMyStringListHidden = new KConfigSkeleton::ItemStringList( currentGroup(), TQString::tqfromLatin1( "MyStringListHidden" ), mMyStringListHidden, defaultMyStringListHidden ); + addItem( itemMyStringListHidden, TQString::tqfromLatin1( "MyStringListHidden" ) ); + KConfigSkeleton::ItemInt *itemMyNumber; + itemMyNumber = new KConfigSkeleton::ItemInt( currentGroup(), TQString::tqfromLatin1( "List-%1-%2" ).arg( mParamtransport ).arg( mParamfolder ), mMyNumber, 1 ); + addItem( itemMyNumber, TQString::tqfromLatin1( "MyNumber" ) ); +} + +Test1::~Test1() +{ +} + diff --git a/tdecore/kconfig_compiler/tests/test1.h.ref b/tdecore/kconfig_compiler/tests/test1.h.ref new file mode 100644 index 000000000..b5a66b5cd --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test1.h.ref @@ -0,0 +1,196 @@ +// This file is generated by kconfig_compiler from test1.kcfg. +// All changes you do to this file will be lost. +#ifndef TEST1_H +#define TEST1_H + +#include <kconfigskeleton.h> +#include <kdebug.h> + +#include <tqdir.h> +class Test1 : public KConfigSkeleton +{ + public: + class EnumListOption + { + public: + enum type { One, Two, Three, COUNT }; + }; + + Test1( const TQString & transport, const TQString & folder ); + ~Test1(); + + /** + Set One option + */ + void setOneOption( bool v ) + { + if (!isImmutable( TQString::tqfromLatin1( "OneOption" ) )) + mOneOption = v; + } + + /** + Get One option + */ + bool oneOption() const + { + return mOneOption; + } + + /** + Set Another option + */ + void setAnotherOption( int v ) + { + if (!isImmutable( TQString::tqfromLatin1( "AnotherOption" ) )) + mAnotherOption = v; + } + + /** + Get Another option + */ + int anotherOption() const + { + return mAnotherOption; + } + + /** + Set This is some funky option + */ + void setListOption( int v ) + { + if (!isImmutable( TQString::tqfromLatin1( "ListOption" ) )) + mListOption = v; + } + + /** + Get This is some funky option + */ + int listOption() const + { + return mListOption; + } + + /** + Set This is a string + */ + void setMyString( const TQString & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "MyString" ) )) + mMyString = v; + } + + /** + Get This is a string + */ + TQString myString() const + { + return mMyString; + } + + /** + Set This is a path + */ + void setMyPath( const TQString & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "MyPath" ) )) + mMyPath = v; + } + + /** + Get This is a path + */ + TQString myPath() const + { + return mMyPath; + } + + /** + Set Another option + */ + void setAnotherOption2( int v ) + { + if (!isImmutable( TQString::tqfromLatin1( "AnotherOption2" ) )) + mAnotherOption2 = v; + } + + /** + Get Another option + */ + int anotherOption2() const + { + return mAnotherOption2; + } + + /** + Set MyStringList + */ + void setMyStringList( const TQStringList & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "MyStringList" ) )) + mMyStringList = v; + } + + /** + Get MyStringList + */ + TQStringList myStringList() const + { + return mMyStringList; + } + + /** + Set MyStringListHidden + */ + void setMyStringListHidden( const TQStringList & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "MyStringListHidden" ) )) + mMyStringListHidden = v; + } + + /** + Get MyStringListHidden + */ + TQStringList myStringListHidden() const + { + return mMyStringListHidden; + } + + /** + Set List Number + */ + void setMyNumber( int v ) + { + if (!isImmutable( TQString::tqfromLatin1( "MyNumber" ) )) + mMyNumber = v; + } + + /** + Get List Number + */ + int myNumber() const + { + return mMyNumber; + } + + protected: + TQString mParamtransport; + TQString mParamfolder; + + // General-$(folder) + bool mOneOption; + int mAnotherOption; + int mListOption; + + // MyOptions + TQString mMyString; + TQString mMyPath; + int mAnotherOption2; + TQStringList mMyStringList; + TQStringList mMyStringListHidden; + int mMyNumber; + + private: +}; + +#endif + diff --git a/tdecore/kconfig_compiler/tests/test1.kcfg b/tdecore/kconfig_compiler/tests/test1.kcfg new file mode 100644 index 000000000..ce42aebfb --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test1.kcfg @@ -0,0 +1,55 @@ +<?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" > + <include>qdir.h</include> + <kcfgfile name="examplerc"> + <parameter name="transport" /> + <parameter name="folder" /> + </kcfgfile> + <group name="General-$(folder)"> + <entry name="OneOption" type="Bool"> + <label>One option</label> + <default>true</default> + </entry> + <entry name="AnotherOption" type="Int" key="Another Option"> + <label>Another option</label> + <default>5</default> + </entry> + <entry name="ListOption" type="Enum"> + <label>This is some funky option</label> + <whatsthis>And this is a longer description of this option. Just wondering, how will the translations of those be handled?</whatsthis> + <choices> + <choice name="One"/> + <choice name="Two"/> + <choice name="Three"/> + </choices> + <default>One</default> + </entry> + </group> + <group name="MyOptions"> + <entry name="MyString" type="String"> + <label>This is a string</label> + <default>Default String</default> + </entry> + <entry name="MyPath" type="Path"> + <label>This is a path</label> + <default code="true">QDir::homeDirPath()+QString::fromLatin1(".hidden_file")</default> + </entry> + <entry name="AnotherOption2" type="Int" key="Another Option"> + <label>Another option</label> + <default>10</default> + </entry> + <entry name="MyStringList" type="StringList"> + <default>up,down</default> + </entry> + <entry name="MyStringListHidden" hidden="true" type="StringList"> + <default>up,down</default> + </entry> + <entry name="MyNumber" type="Int" key="List-$(transport)-$(folder)"> + <label>List Number</label> + <default>1</default> + </entry> + </group> +</kcfg> diff --git a/tdecore/kconfig_compiler/tests/test1.kcfgc b/tdecore/kconfig_compiler/tests/test1.kcfgc new file mode 100644 index 000000000..3b74d7c51 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test1.kcfgc @@ -0,0 +1,18 @@ +# Code generation options for kconfig_compiler +ClassName=Test1 +# +# Singleton=false +# +# Inherits=KConfigSkeleton +# +# IncludeFiles=libtdepim/kpimprefs.h +# +# MemberVariables=public +# +### The following line includes the file exampleprefs_base_addon.h +### It can be used to add extra functions and variables to the +### class. +# CustomAdditions=true +# +### Provide setFooBar(int) style functions +Mutators=true diff --git a/tdecore/kconfig_compiler/tests/test1main.cpp b/tdecore/kconfig_compiler/tests/test1main.cpp new file mode 100644 index 000000000..976a7bbd6 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test1main.cpp @@ -0,0 +1,29 @@ +/* +Copyright (c) 2003 Cornelius Schumacher <schumacher@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 "test1.h" +#include "kinstance.h" + +int main( int, char*[] ) +{ + KInstance i("test"); + Test1 *t = new Test1( TQString::null, TQString::null ); + delete t; +} diff --git a/tdecore/kconfig_compiler/tests/test2.cpp.ref b/tdecore/kconfig_compiler/tests/test2.cpp.ref new file mode 100644 index 000000000..af8db588d --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test2.cpp.ref @@ -0,0 +1,98 @@ +// This file is generated by kconfig_compiler from test2.kcfg. +// All changes you do to this file will be lost. + +#include "test2.h" + +#include <klocale.h> + +Test2::Test2( ) + : MyPrefs( TQString::tqfromLatin1( "korganizerrc" ) ) +{ + setCurrentGroup( TQString::tqfromLatin1( "General" ) ); + + mAutoSaveItem = new KConfigSkeleton::ItemBool( currentGroup(), TQString::tqfromLatin1( "Auto Save" ), mAutoSave, false ); + mAutoSaveItem->setLabel( i18n("Enable automatic saving of calendar") ); + mAutoSaveItem->setWhatsThis( i18n("WhatsThis text for AutoSave option") ); + addItem( mAutoSaveItem, TQString::tqfromLatin1( "AutoSave" ) ); + mAutoSaveIntervalItem = new KConfigSkeleton::ItemInt( currentGroup(), TQString::tqfromLatin1( "Auto Save Interval" ), mAutoSaveInterval, 10 ); + mAutoSaveIntervalItem->setLabel( i18n("Auto Save Interval") ); + addItem( mAutoSaveIntervalItem, TQString::tqfromLatin1( "AutoSaveInterval" ) ); + mConfirmItem = new KConfigSkeleton::ItemBool( currentGroup(), TQString::tqfromLatin1( "Confirm Deletes" ), mConfirm, true ); + mConfirmItem->setLabel( i18n("Confirm deletes") ); + addItem( mConfirmItem, TQString::tqfromLatin1( "Confirm" ) ); + mArchiveFileItem = new KConfigSkeleton::ItemString( currentGroup(), TQString::tqfromLatin1( "Archive File" ), mArchiveFile ); + mArchiveFileItem->setLabel( i18n("Archive File") ); + addItem( mArchiveFileItem, TQString::tqfromLatin1( "ArchiveFile" ) ); + TQValueList<KConfigSkeleton::ItemEnum::Choice> valuesDestination; + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "standardDestination" ); + valuesDestination.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "askDestination" ); + valuesDestination.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "argl1" ); + choice.label = i18n("Argl1 Label"); + valuesDestination.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "argl2" ); + choice.whatsThis = i18n("Argl2 Whatsthis"); + valuesDestination.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "argl3" ); + choice.label = i18n("Argl3 Label"); + choice.whatsThis = i18n("Argl3 Whatsthis"); + valuesDestination.append( choice ); + } + mDestinationItem = new KConfigSkeleton::ItemEnum( currentGroup(), TQString::tqfromLatin1( "Destination" ), mDestination, valuesDestination, standardDestination ); + mDestinationItem->setLabel( i18n("New Events/Todos Should") ); + addItem( mDestinationItem, TQString::tqfromLatin1( "Destination" ) ); + + setCurrentGroup( TQString::tqfromLatin1( "Views" ) ); + + mHourSizeItem = new KConfigSkeleton::ItemInt( currentGroup(), TQString::tqfromLatin1( "Hour Size" ), mHourSize, 10 ); + mHourSizeItem->setLabel( i18n("Hour Size") ); + addItem( mHourSizeItem, TQString::tqfromLatin1( "HourSize" ) ); + mSelectionStartsEditorItem = new KConfigSkeleton::ItemBool( currentGroup(), TQString::tqfromLatin1( "SelectionStartsEditor" ), mSelectionStartsEditor, false ); + mSelectionStartsEditorItem->setLabel( i18n("Time range selection in agenda view starts event editor") ); + addItem( mSelectionStartsEditorItem, TQString::tqfromLatin1( "SelectionStartsEditor" ) ); + + setCurrentGroup( TQString::tqfromLatin1( "KOrganizer Plugins" ) ); + + TQStringList defaultSelectedPlugins; + defaultSelectedPlugins.append( TQString::fromUtf8( "holidays" ) ); + defaultSelectedPlugins.append( TQString::fromUtf8( "webexport" ) ); + + mSelectedPluginsItem = new KConfigSkeleton::ItemStringList( currentGroup(), TQString::tqfromLatin1( "SelectedPlugins" ), mSelectedPlugins, defaultSelectedPlugins ); + mSelectedPluginsItem->setLabel( i18n("SelectedPlugins") ); + addItem( mSelectedPluginsItem, TQString::tqfromLatin1( "SelectedPlugins" ) ); + + setCurrentGroup( TQString::tqfromLatin1( "Colors" ) ); + + mHighlightColorItem = new KConfigSkeleton::ItemColor( currentGroup(), TQString::tqfromLatin1( "Highlight Color" ), mHighlightColor, TQColor( 100, 100, 255 ) ); + mHighlightColorItem->setLabel( i18n("Highlight color") ); + addItem( mHighlightColorItem, TQString::tqfromLatin1( "HighlightColor" ) ); + mAgendaBgColorItem = new KConfigSkeleton::ItemColor( currentGroup(), TQString::tqfromLatin1( "Agenda Background Color" ), mAgendaBgColor, TQColor( 255, 255, 255 ) ); + mAgendaBgColorItem->setLabel( i18n("Agenda view background color") ); + addItem( mAgendaBgColorItem, TQString::tqfromLatin1( "AgendaBgColor" ) ); + + setCurrentGroup( TQString::tqfromLatin1( "Fonts" ) ); + + mTimeBarFontItem = new KConfigSkeleton::ItemFont( currentGroup(), TQString::tqfromLatin1( "TimeBar Font" ), mTimeBarFont ); + mTimeBarFontItem->setLabel( i18n("Time bar") ); + addItem( mTimeBarFontItem, TQString::tqfromLatin1( "TimeBarFont" ) ); +} + +Test2::~Test2() +{ +} + diff --git a/tdecore/kconfig_compiler/tests/test2.h.ref b/tdecore/kconfig_compiler/tests/test2.h.ref new file mode 100644 index 000000000..075f48bde --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test2.h.ref @@ -0,0 +1,333 @@ +// This file is generated by kconfig_compiler from test2.kcfg. +// All changes you do to this file will be lost. +#ifndef TEST2_H +#define TEST2_H + +#include <myprefs.h> + +#include <kconfigskeleton.h> +#include <kdebug.h> + +class Test2 : public MyPrefs +{ + public: + enum { standardDestination, askDestination, argl1, argl2, argl3 }; + + Test2( ); + ~Test2(); + + /** + Set Enable automatic saving of calendar + */ + void setAutoSave( bool v ) + { + if (!isImmutable( TQString::tqfromLatin1( "AutoSave" ) )) + mAutoSave = v; + } + + /** + Get Enable automatic saving of calendar + */ + bool autoSave() const + { + return mAutoSave; + } + + /** + Get Item object corresponding to AutoSave() + */ + ItemBool *autoSaveItem() + { + return mAutoSaveItem; + } + + /** + Set Auto Save Interval + */ + void setAutoSaveInterval( int v ) + { + if (!isImmutable( TQString::tqfromLatin1( "AutoSaveInterval" ) )) + mAutoSaveInterval = v; + } + + /** + Get Auto Save Interval + */ + int autoSaveInterval() const + { + return mAutoSaveInterval; + } + + /** + Get Item object corresponding to AutoSaveInterval() + */ + ItemInt *autoSaveIntervalItem() + { + return mAutoSaveIntervalItem; + } + + /** + Set Confirm deletes + */ + void setConfirm( bool v ) + { + if (!isImmutable( TQString::tqfromLatin1( "Confirm" ) )) + mConfirm = v; + } + + /** + Get Confirm deletes + */ + bool confirm() const + { + return mConfirm; + } + + /** + Get Item object corresponding to Confirm() + */ + ItemBool *confirmItem() + { + return mConfirmItem; + } + + /** + Set Archive File + */ + void setArchiveFile( const TQString & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "ArchiveFile" ) )) + mArchiveFile = v; + } + + /** + Get Archive File + */ + TQString archiveFile() const + { + return mArchiveFile; + } + + /** + Get Item object corresponding to ArchiveFile() + */ + ItemString *archiveFileItem() + { + return mArchiveFileItem; + } + + /** + Set New Events/Todos Should + */ + void setDestination( int v ) + { + if (!isImmutable( TQString::tqfromLatin1( "Destination" ) )) + mDestination = v; + } + + /** + Get New Events/Todos Should + */ + int destination() const + { + return mDestination; + } + + /** + Get Item object corresponding to Destination() + */ + ItemEnum *destinationItem() + { + return mDestinationItem; + } + + /** + Set Hour Size + */ + void setHourSize( int v ) + { + if (!isImmutable( TQString::tqfromLatin1( "HourSize" ) )) + mHourSize = v; + } + + /** + Get Hour Size + */ + int hourSize() const + { + return mHourSize; + } + + /** + Get Item object corresponding to HourSize() + */ + ItemInt *hourSizeItem() + { + return mHourSizeItem; + } + + /** + Set Time range selection in agenda view starts event editor + */ + void setSelectionStartsEditor( bool v ) + { + if (!isImmutable( TQString::tqfromLatin1( "SelectionStartsEditor" ) )) + mSelectionStartsEditor = v; + } + + /** + Get Time range selection in agenda view starts event editor + */ + bool selectionStartsEditor() const + { + return mSelectionStartsEditor; + } + + /** + Get Item object corresponding to SelectionStartsEditor() + */ + ItemBool *selectionStartsEditorItem() + { + return mSelectionStartsEditorItem; + } + + /** + Set SelectedPlugins + */ + void setSelectedPlugins( const TQStringList & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "SelectedPlugins" ) )) + mSelectedPlugins = v; + } + + /** + Get SelectedPlugins + */ + TQStringList selectedPlugins() const + { + return mSelectedPlugins; + } + + /** + Get Item object corresponding to SelectedPlugins() + */ + ItemStringList *selectedPluginsItem() + { + return mSelectedPluginsItem; + } + + /** + Set Highlight color + */ + void setHighlightColor( const TQColor & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "HighlightColor" ) )) + mHighlightColor = v; + } + + /** + Get Highlight color + */ + TQColor highlightColor() const + { + return mHighlightColor; + } + + /** + Get Item object corresponding to HighlightColor() + */ + ItemColor *highlightColorItem() + { + return mHighlightColorItem; + } + + /** + Set Agenda view background color + */ + void setAgendaBgColor( const TQColor & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "AgendaBgColor" ) )) + mAgendaBgColor = v; + } + + /** + Get Agenda view background color + */ + TQColor agendaBgColor() const + { + return mAgendaBgColor; + } + + /** + Get Item object corresponding to AgendaBgColor() + */ + ItemColor *agendaBgColorItem() + { + return mAgendaBgColorItem; + } + + /** + Set Time bar + */ + void setTimeBarFont( const TQFont & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "TimeBarFont" ) )) + mTimeBarFont = v; + } + + /** + Get Time bar + */ + TQFont timeBarFont() const + { + return mTimeBarFont; + } + + /** + Get Item object corresponding to TimeBarFont() + */ + ItemFont *timeBarFontItem() + { + return mTimeBarFontItem; + } + + protected: + public: + + // General + bool mAutoSave; + int mAutoSaveInterval; + bool mConfirm; + TQString mArchiveFile; + int mDestination; + + // Views + int mHourSize; + bool mSelectionStartsEditor; + + // KOrganizer Plugins + TQStringList mSelectedPlugins; + + // Colors + TQColor mHighlightColor; + TQColor mAgendaBgColor; + + // Fonts + TQFont mTimeBarFont; + + private: + ItemBool *mAutoSaveItem; + ItemInt *mAutoSaveIntervalItem; + ItemBool *mConfirmItem; + ItemString *mArchiveFileItem; + ItemEnum *mDestinationItem; + ItemInt *mHourSizeItem; + ItemBool *mSelectionStartsEditorItem; + ItemStringList *mSelectedPluginsItem; + ItemColor *mHighlightColorItem; + ItemColor *mAgendaBgColorItem; + ItemFont *mTimeBarFontItem; +}; + +#endif + diff --git a/tdecore/kconfig_compiler/tests/test2.kcfg b/tdecore/kconfig_compiler/tests/test2.kcfg new file mode 100644 index 000000000..3b19e270e --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test2.kcfg @@ -0,0 +1,78 @@ +<?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="korganizerrc"/> + + <group name="General"> + <entry type="Bool" key="Auto Save"> + <label>Enable automatic saving of calendar</label> + <whatsthis>WhatsThis text for AutoSave option</whatsthis> + <default>false</default> + </entry> + <entry type="Int" key="Auto Save Interval"> + <default>10</default> + </entry> + <entry type="Bool" key="Confirm Deletes" name="Confirm"> + <label>Confirm deletes</label> + <default>true</default> + </entry> + <entry type="String" key="Archive File"> + </entry> + <entry type="Enum" key="Destination" name="Destination"> + <label>New Events/Todos Should</label> + <choices> + <choice name="standardDestination"> + </choice> + <choice name="askDestination"> + </choice> + <choice name="argl1"> + <label>Argl1 Label</label> + </choice> + <choice name="argl2"> + <whatsthis>Argl2 Whatsthis</whatsthis> + </choice> + <choice name="argl3"> + <label>Argl3 Label</label> + <whatsthis>Argl3 Whatsthis</whatsthis> + </choice> + </choices> + <default>standardDestination</default> + </entry> + </group> + + <group name="Views"> + <entry type="Int" key="Hour Size"> + <default>10</default> + </entry> + <entry type="Bool" name="SelectionStartsEditor"> + <label>Time range selection in agenda view starts event editor</label> + <default>false</default> + </entry> + </group> + + <group name="KOrganizer Plugins"> + <entry type="StringList" name="SelectedPlugins"> + <default>holidays,webexport</default> + </entry> + </group> + + <group name="Colors"> + <entry type="Color" key="Highlight Color"> + <label>Highlight color</label> + <default>100, 100, 255</default> + </entry> + <entry type="Color" key="Agenda Background Color" name="AgendaBgColor"> + <label>Agenda view background color</label> + <default>255, 255, 255</default> + </entry> + </group> + + <group name="Fonts"> + <entry type="Font" key="TimeBar Font"> + <label>Time bar</label> + </entry> + </group> + +</kcfg> diff --git a/tdecore/kconfig_compiler/tests/test2.kcfgc b/tdecore/kconfig_compiler/tests/test2.kcfgc new file mode 100644 index 000000000..56620d2f4 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test2.kcfgc @@ -0,0 +1,11 @@ +# Code generation options for kconfig_compiler +File=test2.kcfg +ClassName=Test2 +Singleton=false +Mutators=true +Inherits=MyPrefs +IncludeFiles=myprefs.h +MemberVariables=public +GlobalEnums=true +ItemAccessors=true +SetUserTexts=true diff --git a/tdecore/kconfig_compiler/tests/test2main.cpp b/tdecore/kconfig_compiler/tests/test2main.cpp new file mode 100644 index 000000000..904c57270 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test2main.cpp @@ -0,0 +1,29 @@ +/* +Copyright (c) 2003 Cornelius Schumacher <schumacher@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 "test2.h" +#include "kinstance.h" + +int main( int, char*[] ) +{ + KInstance i("test"); + Test2 *t = new Test2(); + delete t; +} diff --git a/tdecore/kconfig_compiler/tests/test3.cpp.ref b/tdecore/kconfig_compiler/tests/test3.cpp.ref new file mode 100644 index 000000000..a47fd5213 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test3.cpp.ref @@ -0,0 +1,29 @@ +// This file is generated by kconfig_compiler from test3.kcfg. +// All changes you do to this file will be lost. + +#include "test3.h" + +using namespace TestNameSpace; + +Test3::Test3( ) + : KConfigSkeleton( TQString::tqfromLatin1( "test3rc" ) ) +{ + setCurrentGroup( TQString::tqfromLatin1( "General" ) ); + + mAutoSaveItem = new KConfigSkeleton::ItemBool( currentGroup(), TQString::tqfromLatin1( "Auto Save" ), mAutoSave, false ); + addItem( mAutoSaveItem, TQString::tqfromLatin1( "AutoSave" ) ); + + setCurrentGroup( TQString::tqfromLatin1( "Blah" ) ); + + mBlubbItem = new KConfigSkeleton::ItemInt( currentGroup(), TQString::tqfromLatin1( "Blubb" ), mBlubb, 10 ); + addItem( mBlubbItem, TQString::tqfromLatin1( "Blubb" ) ); + mBlahBlahItem = new KConfigSkeleton::ItemString( currentGroup(), TQString::tqfromLatin1( "BlahBlah" ), mBlahBlah, TQString::tqfromLatin1( "a string" ) ); + addItem( mBlahBlahItem, TQString::tqfromLatin1( "BlahBlah" ) ); + mMyPasswordItem = new KConfigSkeleton::ItemPassword( currentGroup(), TQString::tqfromLatin1( "MyPassword" ), mMyPassword ); + addItem( mMyPasswordItem, TQString::tqfromLatin1( "MyPassword" ) ); +} + +Test3::~Test3() +{ +} + diff --git a/tdecore/kconfig_compiler/tests/test3.h.ref b/tdecore/kconfig_compiler/tests/test3.h.ref new file mode 100644 index 000000000..8e86d36b0 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test3.h.ref @@ -0,0 +1,138 @@ +// This file is generated by kconfig_compiler from test3.kcfg. +// All changes you do to this file will be lost. +#ifndef TESTNAMESPACE_TEST3_H +#define TESTNAMESPACE_TEST3_H + +#include <kconfigskeleton.h> +#include <kdebug.h> + +namespace TestNameSpace { + +class Test3 : public KConfigSkeleton +{ + public: + + Test3( ); + ~Test3(); + + /** + Set Enable automatic saving of calendar + */ + void setAutoSave( bool v ) + { + if (!isImmutable( TQString::tqfromLatin1( "AutoSave" ) )) + mAutoSave = v; + } + + /** + Get Enable automatic saving of calendar + */ + bool autoSave() const + { + return mAutoSave; + } + + /** + Get Item object corresponding to AutoSave() + */ + ItemBool *autoSaveItem() + { + return mAutoSaveItem; + } + + /** + Set Blubb + */ + void setBlubb( int v ) + { + if (!isImmutable( TQString::tqfromLatin1( "Blubb" ) )) + mBlubb = v; + } + + /** + Get Blubb + */ + int blubb() const + { + return mBlubb; + } + + /** + Get Item object corresponding to Blubb() + */ + ItemInt *blubbItem() + { + return mBlubbItem; + } + + /** + Set BlahBlah + */ + void setBlahBlah( const TQString & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "BlahBlah" ) )) + mBlahBlah = v; + } + + /** + Get BlahBlah + */ + TQString blahBlah() const + { + return mBlahBlah; + } + + /** + Get Item object corresponding to BlahBlah() + */ + ItemString *blahBlahItem() + { + return mBlahBlahItem; + } + + /** + Set MyPassword + */ + void setMyPassword( const TQString & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "MyPassword" ) )) + mMyPassword = v; + } + + /** + Get MyPassword + */ + TQString myPassword() const + { + return mMyPassword; + } + + /** + Get Item object corresponding to MyPassword() + */ + ItemPassword *myPasswordItem() + { + return mMyPasswordItem; + } + + protected: + + // General + bool mAutoSave; + + // Blah + int mBlubb; + TQString mBlahBlah; + TQString mMyPassword; + + private: + ItemBool *mAutoSaveItem; + ItemInt *mBlubbItem; + ItemString *mBlahBlahItem; + ItemPassword *mMyPasswordItem; +}; + +} + +#endif + diff --git a/tdecore/kconfig_compiler/tests/test3.kcfg b/tdecore/kconfig_compiler/tests/test3.kcfg new file mode 100644 index 000000000..77916da40 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test3.kcfg @@ -0,0 +1,26 @@ +<?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="test3rc"/> + + <group name="General"> + <entry type="Bool" key="Auto Save"> + <label>Enable automatic saving of calendar</label> + <whatsthis>WhatsThis text for AutoSave option</whatsthis> + <default>false</default> + </entry> + </group> + + <group name="Blah"> + <entry type="Int" name="Blubb"> + <default>10</default> + </entry> + <entry type="String" name="BlahBlah"> + <default>a string</default> + </entry> + <entry type="Password" name="MyPassword"/> + </group> + +</kcfg> diff --git a/tdecore/kconfig_compiler/tests/test3.kcfgc b/tdecore/kconfig_compiler/tests/test3.kcfgc new file mode 100644 index 000000000..ca2c22057 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test3.kcfgc @@ -0,0 +1,12 @@ +# Code generation options for kconfig_compiler +File=test3.kcfg +NameSpace=TestNameSpace +ClassName=Test3 +#Singleton=false +Mutators=true +#Inherits=MyPrefs +#IncludeFiles=myprefs.h +#MemberVariables=public +GlobalEnums=true +ItemAccessors=true +#SetUserTexts=true diff --git a/tdecore/kconfig_compiler/tests/test3main.cpp b/tdecore/kconfig_compiler/tests/test3main.cpp new file mode 100644 index 000000000..9789d697d --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test3main.cpp @@ -0,0 +1,29 @@ +/* +Copyright (c) 2003 Cornelius Schumacher <schumacher@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 "test3.h" +#include "kinstance.h" + +int main( int, char*[] ) +{ + KInstance i("test"); + TestNameSpace::Test3 *t = new TestNameSpace::Test3(); + delete t; +} diff --git a/tdecore/kconfig_compiler/tests/test4.cpp.ref b/tdecore/kconfig_compiler/tests/test4.cpp.ref new file mode 100644 index 000000000..0eee21488 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test4.cpp.ref @@ -0,0 +1,82 @@ +// This file is generated by kconfig_compiler from test4.kcfg. +// All changes you do to this file will be lost. + +#include "test4.h" + +#include <kstaticdeleter.h> + +Test4 *Test4::mSelf = 0; +static KStaticDeleter<Test4> staticTest4Deleter; + +Test4 *Test4::self() +{ + if ( !mSelf ) { + staticTest4Deleter.setObject( mSelf, new Test4() ); + mSelf->readConfig(); + } + + return mSelf; +} + +const char* const Test4::EnumButton::enumToString[] = { "right", "mid", "left" }; + +Test4::Test4( ) + : KConfigSkeleton( TQString::tqfromLatin1( "test4rc" ) ) +{ + mSelf = this; + setCurrentGroup( TQString::tqfromLatin1( "Foo" ) ); + +TQColor defaultColor[4] = { Qt::red, Qt::blue, Qt::green, Qt::black }; + KConfigSkeleton::ItemColor *itemColor[4]; + itemColor[0] = new KConfigSkeleton::ItemColor( currentGroup(), TQString::tqfromLatin1( "color #0" ), mColor[0], defaultColor[0] ); + addItem( itemColor[0], TQString::tqfromLatin1( "Color0" ) ); + itemColor[1] = new KConfigSkeleton::ItemColor( currentGroup(), TQString::tqfromLatin1( "color #1" ), mColor[1], defaultColor[1] ); + addItem( itemColor[1], TQString::tqfromLatin1( "Color1" ) ); + itemColor[2] = new KConfigSkeleton::ItemColor( currentGroup(), TQString::tqfromLatin1( "color #2" ), mColor[2], defaultColor[2] ); + addItem( itemColor[2], TQString::tqfromLatin1( "Color2" ) ); + itemColor[3] = new KConfigSkeleton::ItemColor( currentGroup(), TQString::tqfromLatin1( "color #3" ), mColor[3], defaultColor[3] ); + addItem( itemColor[3], TQString::tqfromLatin1( "Color3" ) ); + TQValueList<KConfigSkeleton::ItemEnum::Choice> valuesMouseAction; + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "Encrypt" ); + valuesMouseAction.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "Decrypt" ); + valuesMouseAction.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "CrashNBurn" ); + valuesMouseAction.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "PumpNDump" ); + valuesMouseAction.append( choice ); + } + KConfigSkeleton::ItemEnum *itemMouseAction[3]; + itemMouseAction[0] = new KConfigSkeleton::ItemEnum( currentGroup(), TQString::tqfromLatin1( "right_mouse_action" ), mMouseAction[0], valuesMouseAction, EnumMouseAction::Decrypt ); + addItem( itemMouseAction[0], TQString::tqfromLatin1( "MouseActionright" ) ); + itemMouseAction[1] = new KConfigSkeleton::ItemEnum( currentGroup(), TQString::tqfromLatin1( "mid_mouse_action" ), mMouseAction[1], valuesMouseAction, EnumMouseAction::Encrypt ); + addItem( itemMouseAction[1], TQString::tqfromLatin1( "MouseActionmid" ) ); + itemMouseAction[2] = new KConfigSkeleton::ItemEnum( currentGroup(), TQString::tqfromLatin1( "left_mouse_action" ), mMouseAction[2], valuesMouseAction, EnumMouseAction::PumpNDump ); + addItem( itemMouseAction[2], TQString::tqfromLatin1( "MouseActionleft" ) ); + KConfigSkeleton::ItemString *itemFooBar; + itemFooBar = new KConfigSkeleton::ItemString( currentGroup(), TQString::tqfromLatin1( "foo bar" ), mFooBar ); + addItem( itemFooBar, TQString::tqfromLatin1( "FooBar" ) ); + KConfigSkeleton::ItemInt *itemAge; + itemAge = new KConfigSkeleton::ItemInt( currentGroup(), TQString::tqfromLatin1( "Age" ), mAge, 35 ); + itemAge->setMinValue(8); + itemAge->setMaxValue(88); + addItem( itemAge, TQString::tqfromLatin1( "Age" ) ); +} + +Test4::~Test4() +{ + if ( mSelf == this ) + staticTest4Deleter.setObject( mSelf, 0, false ); +} + diff --git a/tdecore/kconfig_compiler/tests/test4.h.ref b/tdecore/kconfig_compiler/tests/test4.h.ref new file mode 100644 index 000000000..dc8691b1f --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test4.h.ref @@ -0,0 +1,135 @@ +// This file is generated by kconfig_compiler from test4.kcfg. +// All changes you do to this file will be lost. +#ifndef TEST4_H +#define TEST4_H + +#include <kconfigskeleton.h> +#include <kdebug.h> + +class Test4 : public KConfigSkeleton +{ + public: + class EnumMouseAction + { + public: + enum type { Encrypt, Decrypt, CrashNBurn, PumpNDump, COUNT }; + }; + class EnumButton + { + public: + enum type { right, mid, left, COUNT }; + static const char* const enumToString[]; + }; + + static Test4 *self(); + ~Test4(); + + /** + Set Block colors. + */ + static + void setColor( int i, const TQColor & v ) + { + if (!self()->isImmutable( TQString::tqfromLatin1( "Color%1" ).arg( i ) )) + self()->mColor[i] = v; + } + + /** + Get Block colors. + */ + static + TQColor color( int i ) + { + return self()->mColor[i]; + } + + /** + Set Mouse actions. + */ + static + void setMouseAction( int i, int v ) + { + if (!self()->isImmutable( TQString::tqfromLatin1( "MouseAction%1" ).arg( TQString::tqfromLatin1( EnumButton::enumToString[i] ) ) )) + self()->mMouseAction[i] = v; + } + + /** + Get Mouse actions. + */ + static + int mouseAction( int i ) + { + return self()->mMouseAction[i]; + } + + /** + Set foo bar + */ + static + void setFooBar( const TQString & v ) + { + if (!self()->isImmutable( TQString::tqfromLatin1( "FooBar" ) )) + self()->mFooBar = v; + } + + /** + Get foo bar + */ + static + TQString fooBar() + { + return self()->mFooBar; + } + + /** + Set Age + */ + static + void setAge( int v ) + { + if (v < 8) + { + kdDebug() << "setAge: value " << v << " is less than the minimum value of 8" << endl; + v = 8; + } + + if (v > 88) + { + kdDebug() << "setAge: value " << v << " is greater than the maximum value of 88" << endl; + v = 88; + } + + if (!self()->isImmutable( TQString::tqfromLatin1( "Age" ) )) + self()->mAge = v; + } + + /** + Get Age + */ + static + int age() + { + return self()->mAge; + } + + static + void writeConfig() + { + static_cast<KConfigSkeleton*>(self())->writeConfig(); + } + protected: + Test4(); + static Test4 *mSelf; + + + // Foo + TQColor mColor[4]; + int mMouseAction[3]; + TQString mFooBar; + int mAge; + + private: +}; + +#endif + diff --git a/tdecore/kconfig_compiler/tests/test4.kcfg b/tdecore/kconfig_compiler/tests/test4.kcfg new file mode 100644 index 000000000..d8ef2bfae --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test4.kcfg @@ -0,0 +1,42 @@ +<?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="test4rc"/> + + <group name="Foo"> + <entry name="Color$(Number)" type="Color" key="color #$(Number)"> + <parameter name="Number" type="Int" max="3"/> + <label>Block colors.</label> + <code>QColor defaultColor[4] = { Qt::red, Qt::blue, Qt::green, Qt::black };</code> + <default code="true">defaultColor[$(Number)]</default> + </entry> + <entry name="MouseAction$(Button)" type="Enum" key="$(Button)_mouse_action"> + <parameter name="Button" type="Enum"> + <values> + <value>right</value> + <value>mid</value> + <value>left</value> + </values> + </parameter> + <label>Mouse actions.</label> + <choices> + <choice name="Encrypt"/> + <choice name="Decrypt"/> + <choice name="CrashNBurn"/> + <choice name="PumpNDump"/> + </choices> + <default param="right">Decrypt</default> + <default param="mid">Encrypt</default> + <default param="left">PumpNDump</default> + </entry> + <entry name="FooBar" key="foo bar" type="String"/> + <entry name="Age" type="Int"> + <default>35</default> + <min>8</min> + <max>88</max> + </entry> + </group> + +</kcfg> diff --git a/tdecore/kconfig_compiler/tests/test4.kcfgc b/tdecore/kconfig_compiler/tests/test4.kcfgc new file mode 100644 index 000000000..754706dff --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test4.kcfgc @@ -0,0 +1,11 @@ +# Code generation options for kconfig_compiler +File=test4.kcfg +ClassName=Test4 +Singleton=true +Mutators=true +#Inherits=MyPrefs +#IncludeFiles=myprefs.h +#MemberVariables=public +GlobalEnums=false +ItemAccessors=false +#SetUserTexts=true diff --git a/tdecore/kconfig_compiler/tests/test4main.cpp b/tdecore/kconfig_compiler/tests/test4main.cpp new file mode 100644 index 000000000..8b38b3dbd --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test4main.cpp @@ -0,0 +1,30 @@ +/* +Copyright (c) 2003,2004 Waldo Bastian <bastian@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 "test4.h" +#include "kinstance.h" + +int main( int, char*[] ) +{ + KInstance i("test"); + Test4 *t = Test4::self(); + delete t; +} diff --git a/tdecore/kconfig_compiler/tests/test5.cpp.ref b/tdecore/kconfig_compiler/tests/test5.cpp.ref new file mode 100644 index 000000000..0fc90b387 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test5.cpp.ref @@ -0,0 +1,82 @@ +// This file is generated by kconfig_compiler from test5.kcfg. +// All changes you do to this file will be lost. + +#include "test5.h" + +#include <kstaticdeleter.h> + +Test5 *Test5::mSelf = 0; +static KStaticDeleter<Test5> staticTest5Deleter; + +Test5 *Test5::self() +{ + if ( !mSelf ) { + staticTest5Deleter.setObject( mSelf, new Test5() ); + mSelf->readConfig(); + } + + return mSelf; +} + +const char* const Test5::EnumButtonToString[] = { "right", "mid", "left" }; + +Test5::Test5( ) + : KConfigSkeleton( TQString::tqfromLatin1( "test4rc" ) ) +{ + mSelf = this; + setCurrentGroup( TQString::tqfromLatin1( "Foo" ) ); + +TQColor defaultColor[4] = { Qt::red, Qt::blue, Qt::green, Qt::black }; + KConfigSkeleton::ItemColor *itemColor[4]; + itemColor[0] = new KConfigSkeleton::ItemColor( currentGroup(), TQString::tqfromLatin1( "color #0" ), mColor[0], defaultColor[0] ); + addItem( itemColor[0], TQString::tqfromLatin1( "Color0" ) ); + itemColor[1] = new KConfigSkeleton::ItemColor( currentGroup(), TQString::tqfromLatin1( "color #1" ), mColor[1], defaultColor[1] ); + addItem( itemColor[1], TQString::tqfromLatin1( "Color1" ) ); + itemColor[2] = new KConfigSkeleton::ItemColor( currentGroup(), TQString::tqfromLatin1( "color #2" ), mColor[2], defaultColor[2] ); + addItem( itemColor[2], TQString::tqfromLatin1( "Color2" ) ); + itemColor[3] = new KConfigSkeleton::ItemColor( currentGroup(), TQString::tqfromLatin1( "color #3" ), mColor[3], defaultColor[3] ); + addItem( itemColor[3], TQString::tqfromLatin1( "Color3" ) ); + TQValueList<KConfigSkeleton::ItemEnum::Choice> valuesMouseAction; + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "Encrypt" ); + valuesMouseAction.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "Decrypt" ); + valuesMouseAction.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "CrashNBurn" ); + valuesMouseAction.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "PumpNDump" ); + valuesMouseAction.append( choice ); + } + KConfigSkeleton::ItemEnum *itemMouseAction[3]; + itemMouseAction[0] = new KConfigSkeleton::ItemEnum( currentGroup(), TQString::tqfromLatin1( "right_mouse_action" ), mMouseAction[0], valuesMouseAction, Decrypt ); + addItem( itemMouseAction[0], TQString::tqfromLatin1( "MouseActionright" ) ); + itemMouseAction[1] = new KConfigSkeleton::ItemEnum( currentGroup(), TQString::tqfromLatin1( "mid_mouse_action" ), mMouseAction[1], valuesMouseAction, Encrypt ); + addItem( itemMouseAction[1], TQString::tqfromLatin1( "MouseActionmid" ) ); + itemMouseAction[2] = new KConfigSkeleton::ItemEnum( currentGroup(), TQString::tqfromLatin1( "left_mouse_action" ), mMouseAction[2], valuesMouseAction, PumpNDump ); + addItem( itemMouseAction[2], TQString::tqfromLatin1( "MouseActionleft" ) ); + KConfigSkeleton::ItemString *itemFooBar; + itemFooBar = new KConfigSkeleton::ItemString( currentGroup(), TQString::tqfromLatin1( "foo bar" ), mFooBar ); + addItem( itemFooBar, TQString::tqfromLatin1( "FooBar" ) ); + KConfigSkeleton::ItemInt *itemAge; + itemAge = new KConfigSkeleton::ItemInt( currentGroup(), TQString::tqfromLatin1( "Age" ), mAge, 35 ); + itemAge->setMinValue(8); + itemAge->setMaxValue(88); + addItem( itemAge, TQString::tqfromLatin1( "Age" ) ); +} + +Test5::~Test5() +{ + if ( mSelf == this ) + staticTest5Deleter.setObject( mSelf, 0, false ); +} + diff --git a/tdecore/kconfig_compiler/tests/test5.h.ref b/tdecore/kconfig_compiler/tests/test5.h.ref new file mode 100644 index 000000000..9fadbd0ec --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test5.h.ref @@ -0,0 +1,127 @@ +// This file is generated by kconfig_compiler from test5.kcfg. +// All changes you do to this file will be lost. +#ifndef TEST5_H +#define TEST5_H + +#include <kconfigskeleton.h> +#include <kdebug.h> + +class Test5 : public KConfigSkeleton +{ + public: + enum { Encrypt, Decrypt, CrashNBurn, PumpNDump }; + enum { right, mid, left }; + static const char* const EnumButtonToString[]; + + static Test5 *self(); + ~Test5(); + + /** + Set Block colors. + */ + static + void setColor( int i, const TQColor & v ) + { + if (!self()->isImmutable( TQString::tqfromLatin1( "Color%1" ).arg( i ) )) + self()->mColor[i] = v; + } + + /** + Get Block colors. + */ + static + TQColor color( int i ) + { + return self()->mColor[i]; + } + + /** + Set Mouse actions. + */ + static + void setMouseAction( int i, int v ) + { + if (!self()->isImmutable( TQString::tqfromLatin1( "MouseAction%1" ).arg( TQString::tqfromLatin1( EnumButtonToString[i] ) ) )) + self()->mMouseAction[i] = v; + } + + /** + Get Mouse actions. + */ + static + int mouseAction( int i ) + { + return self()->mMouseAction[i]; + } + + /** + Set foo bar + */ + static + void setFooBar( const TQString & v ) + { + if (!self()->isImmutable( TQString::tqfromLatin1( "FooBar" ) )) + self()->mFooBar = v; + } + + /** + Get foo bar + */ + static + TQString fooBar() + { + return self()->mFooBar; + } + + /** + Set Age + */ + static + void setAge( int v ) + { + if (v < 8) + { + kdDebug() << "setAge: value " << v << " is less than the minimum value of 8" << endl; + v = 8; + } + + if (v > 88) + { + kdDebug() << "setAge: value " << v << " is greater than the maximum value of 88" << endl; + v = 88; + } + + if (!self()->isImmutable( TQString::tqfromLatin1( "Age" ) )) + self()->mAge = v; + } + + /** + Get Age + */ + static + int age() + { + return self()->mAge; + } + + static + void writeConfig() + { + static_cast<KConfigSkeleton*>(self())->writeConfig(); + } + protected: + Test5(); + static Test5 *mSelf; + + + // Foo + TQColor mColor[4]; + int mMouseAction[3]; + TQString mFooBar; + int mAge; + + private: +}; + +#endif + diff --git a/tdecore/kconfig_compiler/tests/test5.kcfg b/tdecore/kconfig_compiler/tests/test5.kcfg new file mode 100644 index 000000000..d8ef2bfae --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test5.kcfg @@ -0,0 +1,42 @@ +<?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="test4rc"/> + + <group name="Foo"> + <entry name="Color$(Number)" type="Color" key="color #$(Number)"> + <parameter name="Number" type="Int" max="3"/> + <label>Block colors.</label> + <code>QColor defaultColor[4] = { Qt::red, Qt::blue, Qt::green, Qt::black };</code> + <default code="true">defaultColor[$(Number)]</default> + </entry> + <entry name="MouseAction$(Button)" type="Enum" key="$(Button)_mouse_action"> + <parameter name="Button" type="Enum"> + <values> + <value>right</value> + <value>mid</value> + <value>left</value> + </values> + </parameter> + <label>Mouse actions.</label> + <choices> + <choice name="Encrypt"/> + <choice name="Decrypt"/> + <choice name="CrashNBurn"/> + <choice name="PumpNDump"/> + </choices> + <default param="right">Decrypt</default> + <default param="mid">Encrypt</default> + <default param="left">PumpNDump</default> + </entry> + <entry name="FooBar" key="foo bar" type="String"/> + <entry name="Age" type="Int"> + <default>35</default> + <min>8</min> + <max>88</max> + </entry> + </group> + +</kcfg> diff --git a/tdecore/kconfig_compiler/tests/test5.kcfgc b/tdecore/kconfig_compiler/tests/test5.kcfgc new file mode 100644 index 000000000..663005e5e --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test5.kcfgc @@ -0,0 +1,11 @@ +# Code generation options for kconfig_compiler +File=test5.kcfg +ClassName=Test5 +Singleton=true +Mutators=true +#Inherits=MyPrefs +#IncludeFiles=myprefs.h +#MemberVariables=public +GlobalEnums=true +ItemAccessors=false +#SetUserTexts=true diff --git a/tdecore/kconfig_compiler/tests/test5main.cpp b/tdecore/kconfig_compiler/tests/test5main.cpp new file mode 100644 index 000000000..57ad5189d --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test5main.cpp @@ -0,0 +1,30 @@ +/* +Copyright (c) 2004 Waldo Bastian <bastian@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 "test5.h" +#include "kinstance.h" + +int main( int, char*[] ) +{ + KInstance i("test"); + Test5 *t = Test5::self(); + delete t; +} diff --git a/tdecore/kconfig_compiler/tests/test6.cpp.ref b/tdecore/kconfig_compiler/tests/test6.cpp.ref new file mode 100644 index 000000000..2b8a71d50 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test6.cpp.ref @@ -0,0 +1,31 @@ +// This file is generated by kconfig_compiler from test6.kcfg. +// All changes you do to this file will be lost. + +#include "test6.h" + +Test6::Test6( const TQString & Number ) + : KConfigSkeleton( TQString::tqfromLatin1( "test4rc" ) ) + , mParamNumber(Number) +{ + setCurrentGroup( TQString::tqfromLatin1( "Foo" ) ); + + KConfigSkeleton::ItemColor *itemColor; + itemColor = new KConfigSkeleton::ItemColor( currentGroup(), TQString::tqfromLatin1( "color #%1" ).arg( mParamNumber ), mColor, TQColor( "red" ) ); + addItem( itemColor, TQString::tqfromLatin1( "Color" ) ); + + setCurrentGroup( TQString::tqfromLatin1( "Bar%1" ).arg( mParamNumber ) ); + + KConfigSkeleton::ItemString *itemFooBar; + itemFooBar = new KConfigSkeleton::ItemString( currentGroup(), TQString::tqfromLatin1( "foo bar" ), mFooBar ); + addItem( itemFooBar, TQString::tqfromLatin1( "FooBar" ) ); + KConfigSkeleton::ItemInt *itemAge; + itemAge = new KConfigSkeleton::ItemInt( currentGroup(), TQString::tqfromLatin1( "Age" ), mAge, 35 ); + itemAge->setMinValue(8); + itemAge->setMaxValue(88); + addItem( itemAge, TQString::tqfromLatin1( "Age" ) ); +} + +Test6::~Test6() +{ +} + diff --git a/tdecore/kconfig_compiler/tests/test6.h.ref b/tdecore/kconfig_compiler/tests/test6.h.ref new file mode 100644 index 000000000..18615da38 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test6.h.ref @@ -0,0 +1,93 @@ +// This file is generated by kconfig_compiler from test6.kcfg. +// All changes you do to this file will be lost. +#ifndef TEST6_H +#define TEST6_H + +#include <kconfigskeleton.h> +#include <kdebug.h> + +class Test6 : public KConfigSkeleton +{ + public: + + Test6( const TQString & Number ); + ~Test6(); + + /** + Set Block colors. + */ + void setColor( const TQColor & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "Color" ) )) + mColor = v; + } + + /** + Get Block colors. + */ + TQColor color() const + { + return mColor; + } + + /** + Set foo bar + */ + void setFooBar( const TQString & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "FooBar" ) )) + mFooBar = v; + } + + /** + Get foo bar + */ + TQString fooBar() const + { + return mFooBar; + } + + /** + Set Age + */ + void setAge( int v ) + { + if (v < 8) + { + kdDebug() << "setAge: value " << v << " is less than the minimum value of 8" << endl; + v = 8; + } + + if (v > 88) + { + kdDebug() << "setAge: value " << v << " is greater than the maximum value of 88" << endl; + v = 88; + } + + if (!isImmutable( TQString::tqfromLatin1( "Age" ) )) + mAge = v; + } + + /** + Get Age + */ + int age() const + { + return mAge; + } + + protected: + TQString mParamNumber; + + // Foo + TQColor mColor; + + // Bar$(Number) + TQString mFooBar; + int mAge; + + private: +}; + +#endif + diff --git a/tdecore/kconfig_compiler/tests/test6.kcfg b/tdecore/kconfig_compiler/tests/test6.kcfg new file mode 100644 index 000000000..e59fa88f3 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test6.kcfg @@ -0,0 +1,25 @@ +<?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="test4rc"> + <parameter name="Number" type="String"/> + </kcfgfile> + + <group name="Foo"> + <entry name="Color" type="Color" key="color #$(Number)"> + <label>Block colors.</label> + <default>red</default> + </entry> + </group> + <group name="Bar$(Number)"> + <entry name="FooBar" key="foo bar" type="String"/> + <entry name="Age" type="Int"> + <default>35</default> + <min>8</min> + <max>88</max> + </entry> + </group> + +</kcfg> diff --git a/tdecore/kconfig_compiler/tests/test6.kcfgc b/tdecore/kconfig_compiler/tests/test6.kcfgc new file mode 100644 index 000000000..b69dc152d --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test6.kcfgc @@ -0,0 +1,11 @@ +# Code generation options for kconfig_compiler +File=test6.kcfg +ClassName=Test6 +Singleton=false +Mutators=true +#Inherits=MyPrefs +#IncludeFiles=myprefs.h +#MemberVariables=public +GlobalEnums=true +ItemAccessors=false +#SetUserTexts=true diff --git a/tdecore/kconfig_compiler/tests/test6main.cpp b/tdecore/kconfig_compiler/tests/test6main.cpp new file mode 100644 index 000000000..27dff57ff --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test6main.cpp @@ -0,0 +1,30 @@ +/* +Copyright (c) 2004 Waldo Bastian <bastian@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 "test6.h" +#include "kinstance.h" + +int main( int, char*[] ) +{ + KInstance i("test"); + Test6 *t = new Test6(TQString::null); + delete t; +} diff --git a/tdecore/kconfig_compiler/tests/test7.cpp.ref b/tdecore/kconfig_compiler/tests/test7.cpp.ref new file mode 100644 index 000000000..dab0ae27d --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test7.cpp.ref @@ -0,0 +1,31 @@ +// This file is generated by kconfig_compiler from test7.kcfg. +// All changes you do to this file will be lost. + +#include "test7.h" + +Test7::Test7( int Number ) + : KConfigSkeleton( TQString::tqfromLatin1( "test7rc" ) ) + , mParamNumber(Number) +{ + setCurrentGroup( TQString::tqfromLatin1( "Foo" ) ); + + KConfigSkeleton::ItemColor *itemColor; + itemColor = new KConfigSkeleton::ItemColor( currentGroup(), TQString::tqfromLatin1( "color #%1" ).arg( mParamNumber ), mColor, TQColor( "red" ) ); + addItem( itemColor, TQString::tqfromLatin1( "Color" ) ); + + setCurrentGroup( TQString::tqfromLatin1( "Bar%1" ).arg( mParamNumber ) ); + + KConfigSkeleton::ItemString *itemFooBar; + itemFooBar = new KConfigSkeleton::ItemString( currentGroup(), TQString::tqfromLatin1( "foo bar" ), mFooBar ); + addItem( itemFooBar, TQString::tqfromLatin1( "FooBar" ) ); + KConfigSkeleton::ItemInt *itemAge; + itemAge = new KConfigSkeleton::ItemInt( currentGroup(), TQString::tqfromLatin1( "Age" ), mAge, 35 ); + itemAge->setMinValue(8); + itemAge->setMaxValue(88); + addItem( itemAge, TQString::tqfromLatin1( "Age" ) ); +} + +Test7::~Test7() +{ +} + diff --git a/tdecore/kconfig_compiler/tests/test7.h.ref b/tdecore/kconfig_compiler/tests/test7.h.ref new file mode 100644 index 000000000..f67bc30cb --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test7.h.ref @@ -0,0 +1,93 @@ +// This file is generated by kconfig_compiler from test7.kcfg. +// All changes you do to this file will be lost. +#ifndef TEST7_H +#define TEST7_H + +#include <kconfigskeleton.h> +#include <kdebug.h> + +class Test7 : public KConfigSkeleton +{ + public: + + Test7( int Number ); + ~Test7(); + + /** + Set Block colors. + */ + void setColor( const TQColor & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "Color" ) )) + mColor = v; + } + + /** + Get Block colors. + */ + TQColor color() const + { + return mColor; + } + + /** + Set foo bar + */ + void setFooBar( const TQString & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "FooBar" ) )) + mFooBar = v; + } + + /** + Get foo bar + */ + TQString fooBar() const + { + return mFooBar; + } + + /** + Set Age + */ + void setAge( int v ) + { + if (v < 8) + { + kdDebug() << "setAge: value " << v << " is less than the minimum value of 8" << endl; + v = 8; + } + + if (v > 88) + { + kdDebug() << "setAge: value " << v << " is greater than the maximum value of 88" << endl; + v = 88; + } + + if (!isImmutable( TQString::tqfromLatin1( "Age" ) )) + mAge = v; + } + + /** + Get Age + */ + int age() const + { + return mAge; + } + + protected: + int mParamNumber; + + // Foo + TQColor mColor; + + // Bar$(Number) + TQString mFooBar; + int mAge; + + private: +}; + +#endif + diff --git a/tdecore/kconfig_compiler/tests/test7.kcfg b/tdecore/kconfig_compiler/tests/test7.kcfg new file mode 100644 index 000000000..0a7fd3272 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test7.kcfg @@ -0,0 +1,25 @@ +<?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="test7rc"> + <parameter name="Number" type="Int"/> + </kcfgfile> + + <group name="Foo"> + <entry name="Color" type="Color" key="color #$(Number)"> + <label>Block colors.</label> + <default>red</default> + </entry> + </group> + <group name="Bar$(Number)"> + <entry name="FooBar" key="foo bar" type="String"/> + <entry name="Age" type="Int"> + <default>35</default> + <min>8</min> + <max>88</max> + </entry> + </group> + +</kcfg> diff --git a/tdecore/kconfig_compiler/tests/test7.kcfgc b/tdecore/kconfig_compiler/tests/test7.kcfgc new file mode 100644 index 000000000..9a6c40954 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test7.kcfgc @@ -0,0 +1,11 @@ +# Code generation options for kconfig_compiler +File=test7.kcfg +ClassName=Test7 +Singleton=false +Mutators=true +#Inherits=MyPrefs +#IncludeFiles=myprefs.h +#MemberVariables=public +GlobalEnums=true +ItemAccessors=false +#SetUserTexts=true diff --git a/tdecore/kconfig_compiler/tests/test7main.cpp b/tdecore/kconfig_compiler/tests/test7main.cpp new file mode 100644 index 000000000..9c1ad1931 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test7main.cpp @@ -0,0 +1,30 @@ +/* +Copyright (c) 2004 Waldo Bastian <bastian@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 "test7.h" +#include "kinstance.h" + +int main( int, char*[] ) +{ + KInstance i("test"); + Test7 *t = new Test7(42); + delete t; +} diff --git a/tdecore/kconfig_compiler/tests/test8a.cpp.ref b/tdecore/kconfig_compiler/tests/test8a.cpp.ref new file mode 100644 index 000000000..8d8925c57 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test8a.cpp.ref @@ -0,0 +1,22 @@ +// This file is generated by kconfig_compiler from test8a.kcfg. +// All changes you do to this file will be lost. + +#include "test8a.h" + +Test8a::Test8a( KSharedConfig::Ptr config ) + : KConfigSkeleton( config ) +{ + setCurrentGroup( TQString::tqfromLatin1( "Group" ) ); + + KConfigSkeleton::ItemFont *itemFont; + itemFont = new KConfigSkeleton::ItemFont( currentGroup(), TQString::tqfromLatin1( "Font" ), mFont, KGlobalSettings::generalFont() ); + addItem( itemFont, TQString::tqfromLatin1( "Font" ) ); + KConfigSkeleton::ItemFont *itemTitleFont; + itemTitleFont = new KConfigSkeleton::ItemFont( currentGroup(), TQString::tqfromLatin1( "TitleFont" ), mTitleFont, KGlobalSettings::windowTitleFont() ); + addItem( itemTitleFont, TQString::tqfromLatin1( "TitleFont" ) ); +} + +Test8a::~Test8a() +{ +} + diff --git a/tdecore/kconfig_compiler/tests/test8a.h.ref b/tdecore/kconfig_compiler/tests/test8a.h.ref new file mode 100644 index 000000000..a1ac4de64 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test8a.h.ref @@ -0,0 +1,61 @@ +// This file is generated by kconfig_compiler from test8a.kcfg. +// All changes you do to this file will be lost. +#ifndef TEST8A_H +#define TEST8A_H + +#include <kglobal.h> +#include <kconfigskeleton.h> +#include <kdebug.h> + +class Test8a : public KConfigSkeleton +{ + public: + + Test8a( KSharedConfig::Ptr config = KGlobal::sharedConfig() ); + ~Test8a(); + + /** + Set Font + */ + void setFont( const TQFont & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "Font" ) )) + mFont = v; + } + + /** + Get Font + */ + TQFont font() const + { + return mFont; + } + + /** + Set TitleFont + */ + void setTitleFont( const TQFont & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "TitleFont" ) )) + mTitleFont = v; + } + + /** + Get TitleFont + */ + TQFont titleFont() const + { + return mTitleFont; + } + + protected: + + // Group + TQFont mFont; + TQFont mTitleFont; + + private: +}; + +#endif + diff --git a/tdecore/kconfig_compiler/tests/test8a.kcfg b/tdecore/kconfig_compiler/tests/test8a.kcfg new file mode 100644 index 000000000..5ee87199f --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test8a.kcfg @@ -0,0 +1,17 @@ +<?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 arg="true"/> + + <group name="Group"> + <entry name="Font" type="Font"> + <default code="true">KGlobalSettings::generalFont()</default> + </entry> + + <entry name="TitleFont" type="Font"> + <default code="true">KGlobalSettings::windowTitleFont()</default> + </entry> + </group> +</kcfg> diff --git a/tdecore/kconfig_compiler/tests/test8a.kcfgc b/tdecore/kconfig_compiler/tests/test8a.kcfgc new file mode 100644 index 000000000..5f63c31c2 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test8a.kcfgc @@ -0,0 +1,3 @@ +File=test8a.kcfg +ClassName=Test8a +Mutators=true diff --git a/tdecore/kconfig_compiler/tests/test8b.cpp.ref b/tdecore/kconfig_compiler/tests/test8b.cpp.ref new file mode 100644 index 000000000..566902399 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test8b.cpp.ref @@ -0,0 +1,46 @@ +// This file is generated by kconfig_compiler from test8b.kcfg. +// All changes you do to this file will be lost. + +#include "test8b.h" + +#include <kstaticdeleter.h> + +Test8b *Test8b::mSelf = 0; +static KStaticDeleter<Test8b> staticTest8bDeleter; + +Test8b *Test8b::self() +{ + if ( !mSelf ) { + staticTest8bDeleter.setObject( mSelf, new Test8b() ); + mSelf->readConfig(); + } + + return mSelf; +} + +Test8b::Test8b( ) + : Test8a() +{ + mSelf = this; + setCurrentGroup( TQString::tqfromLatin1( "Group8b1" ) ); + + KConfigSkeleton::ItemUInt *itemSomething; + itemSomething = new KConfigSkeleton::ItemUInt( currentGroup(), TQString::tqfromLatin1( "Something" ), mSomething, 60 ); + addItem( itemSomething, TQString::tqfromLatin1( "Something" ) ); + + setCurrentGroup( TQString::tqfromLatin1( "Group8b2" ) ); + + KConfigSkeleton::ItemBool *itemFooBoo; + itemFooBoo = new KConfigSkeleton::ItemBool( currentGroup(), TQString::tqfromLatin1( "FooBoo" ), mFooBoo, false ); + addItem( itemFooBoo, TQString::tqfromLatin1( "FooBoo" ) ); + KConfigSkeleton::ItemUInt *itemPort; + itemPort = new KConfigSkeleton::ItemUInt( currentGroup(), TQString::tqfromLatin1( "Port" ), mPort, 1000 ); + addItem( itemPort, TQString::tqfromLatin1( "Port" ) ); +} + +Test8b::~Test8b() +{ + if ( mSelf == this ) + staticTest8bDeleter.setObject( mSelf, 0, false ); +} + diff --git a/tdecore/kconfig_compiler/tests/test8b.h.ref b/tdecore/kconfig_compiler/tests/test8b.h.ref new file mode 100644 index 000000000..dfc9089e3 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test8b.h.ref @@ -0,0 +1,96 @@ +// This file is generated by kconfig_compiler from test8b.kcfg. +// All changes you do to this file will be lost. +#ifndef TEST8B_H +#define TEST8B_H + +#include <test8a.h> + +#include <kconfigskeleton.h> +#include <kdebug.h> + +class Test8b : public Test8a +{ + public: + + static Test8b *self(); + ~Test8b(); + + /** + Set Something + */ + static + void setSomething( uint v ) + { + if (!self()->isImmutable( TQString::tqfromLatin1( "Something" ) )) + self()->mSomething = v; + } + + /** + Get Something + */ + static + uint something() + { + return self()->mSomething; + } + + /** + Set FooBoo + */ + static + void setFooBoo( bool v ) + { + if (!self()->isImmutable( TQString::tqfromLatin1( "FooBoo" ) )) + self()->mFooBoo = v; + } + + /** + Get FooBoo + */ + static + bool fooBoo() + { + return self()->mFooBoo; + } + + /** + Set Port + */ + static + void setPort( uint v ) + { + if (!self()->isImmutable( TQString::tqfromLatin1( "Port" ) )) + self()->mPort = v; + } + + /** + Get Port + */ + static + uint port() + { + return self()->mPort; + } + + static + void writeConfig() + { + static_cast<KConfigSkeleton*>(self())->writeConfig(); + } + protected: + Test8b(); + static Test8b *mSelf; + + + // Group8b1 + uint mSomething; + + // Group8b2 + bool mFooBoo; + uint mPort; + + private: +}; + +#endif + diff --git a/tdecore/kconfig_compiler/tests/test8b.kcfg b/tdecore/kconfig_compiler/tests/test8b.kcfg new file mode 100644 index 000000000..3e203a155 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test8b.kcfg @@ -0,0 +1,21 @@ +<?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" > + <group name="Group8b1"> + <entry name="Something" type="UInt"> + <default>60</default> + </entry> + </group> + + <group name="Group8b2"> + <entry name="FooBoo" type="Bool"> + <default>false</default> + </entry> + + <entry name="Port" type="UInt"> + <default>1000</default> + </entry> + </group> +</kcfg> diff --git a/tdecore/kconfig_compiler/tests/test8b.kcfgc b/tdecore/kconfig_compiler/tests/test8b.kcfgc new file mode 100644 index 000000000..7be055203 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test8b.kcfgc @@ -0,0 +1,6 @@ +File=test8b.kcfg +ClassName=Test8b +Mutators=true +Singleton=true +IncludeFiles=test8a.h +Inherits=Test8a diff --git a/tdecore/kconfig_compiler/tests/test8main.cpp b/tdecore/kconfig_compiler/tests/test8main.cpp new file mode 100644 index 000000000..b3c242f68 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test8main.cpp @@ -0,0 +1,34 @@ +/* +Copyright (c) 2005 Michael Brade <brade@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 "test8a.h" +#include "test8b.h" +#include "kinstance.h" + +int main( int, char*[] ) +{ + KInstance i("test"); + Test8a *config1 = new Test8a( KSharedConfig::openConfig( TQString::null ) ); + Test8a *config2 = new Test8a(); + Test8b::self(); + delete config1; + delete config2; +} diff --git a/tdecore/kconfig_compiler/tests/test9.cpp.ref b/tdecore/kconfig_compiler/tests/test9.cpp.ref new file mode 100644 index 000000000..606f21ed1 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test9.cpp.ref @@ -0,0 +1,35 @@ +// This file is generated by kconfig_compiler from test9.kcfg. +// All changes you do to this file will be lost. + +#include "test9.h" + +Test9::Test9( const TQString & transport, const TQString & folder ) + : KConfigSkeleton( TQString::tqfromLatin1( "examplerc" ) ) + , mParamtransport(transport) + , mParamfolder(folder) +{ + setCurrentGroup( TQString::tqfromLatin1( "MyOptionsXX" ) ); + + TQStringList defaultMyStringList; + defaultMyStringList.append( TQString::fromUtf8( "up" ) ); + defaultMyStringList.append( TQString::fromUtf8( "down" ) ); + + KConfigSkeleton::ItemStringList *itemMyStringList; + itemMyStringList = new KConfigSkeleton::ItemStringList( currentGroup(), TQString::tqfromLatin1( "MyStringList" ), mMyStringList, defaultMyStringList ); + addItem( itemMyStringList, TQString::tqfromLatin1( "MyStringList" ) ); + TQStringList defaultMyPathList; + defaultMyPathList.append( TQString::fromUtf8( "/home" ) ); + defaultMyPathList.append( TQString::fromUtf8( "~" ) ); + + KConfigSkeleton::ItemPathList *itemMyPathList; + itemMyPathList = new KConfigSkeleton::ItemPathList( currentGroup(), TQString::tqfromLatin1( "MyPathList" ), mMyPathList, defaultMyPathList ); + addItem( itemMyPathList, TQString::tqfromLatin1( "MyPathList" ) ); + KConfigSkeleton::ItemPathList *itemMyPathsList2; + itemMyPathsList2 = new KConfigSkeleton::ItemPathList( currentGroup(), TQString::tqfromLatin1( "MyPathsList2" ), mMyPathsList2, TQStringList(TQString::tqfromLatin1("/usr/bin")) += TQDir::homeDirPath() ); + addItem( itemMyPathsList2, TQString::tqfromLatin1( "MyPathsList2" ) ); +} + +Test9::~Test9() +{ +} + diff --git a/tdecore/kconfig_compiler/tests/test9.h.ref b/tdecore/kconfig_compiler/tests/test9.h.ref new file mode 100644 index 000000000..0476c8a19 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test9.h.ref @@ -0,0 +1,82 @@ +// This file is generated by kconfig_compiler from test9.kcfg. +// All changes you do to this file will be lost. +#ifndef TEST9_H +#define TEST9_H + +#include <kconfigskeleton.h> +#include <kdebug.h> + +#include <tqdir.h> +class Test9 : public KConfigSkeleton +{ + public: + + Test9( const TQString & transport, const TQString & folder ); + ~Test9(); + + /** + Set MyStringList + */ + void setMyStringList( const TQStringList & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "MyStringList" ) )) + mMyStringList = v; + } + + /** + Get MyStringList + */ + TQStringList myStringList() const + { + return mMyStringList; + } + + /** + Set This is a list of paths + */ + void setMyPathList( const TQStringList & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "MyPathList" ) )) + mMyPathList = v; + } + + /** + Get This is a list of paths + */ + TQStringList myPathList() const + { + return mMyPathList; + } + + /** + Set This is an additional test for PathList + */ + void setMyPathsList2( const TQStringList & v ) + { + if (!isImmutable( TQString::tqfromLatin1( "MyPathsList2" ) )) + mMyPathsList2 = v; + } + + /** + Get This is an additional test for PathList + */ + TQStringList myPathsList2() const + { + return mMyPathsList2; + } + + protected: + public: + TQString mParamtransport; + TQString mParamfolder; + + // MyOptionsXX + TQStringList mMyStringList; + TQStringList mMyPathList; + TQStringList mMyPathsList2; + + private: +}; + +#endif + diff --git a/tdecore/kconfig_compiler/tests/test9.kcfg b/tdecore/kconfig_compiler/tests/test9.kcfg new file mode 100644 index 000000000..b7495e2b6 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test9.kcfg @@ -0,0 +1,24 @@ +<?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" > + <include>qdir.h</include> + <kcfgfile name="examplerc"> + <parameter name="transport" /> + <parameter name="folder" /> + </kcfgfile> + <group name="MyOptionsXX"> + <entry name="MyStringList" type="StringList"> + <default>up,down</default> + </entry> + <entry name="MyPathList" type="PathList"> + <label>This is a list of paths</label> + <default>/home,~</default> + </entry> + <entry name="MyPathsList2" type="PathList"> + <label>This is an additional test for PathList</label> + <default code="true">QStringList(QString::fromLatin1("/usr/bin")) += QDir::homeDirPath()</default> + </entry> + </group> +</kcfg> diff --git a/tdecore/kconfig_compiler/tests/test9.kcfgc b/tdecore/kconfig_compiler/tests/test9.kcfgc new file mode 100644 index 000000000..8f124fc25 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test9.kcfgc @@ -0,0 +1,18 @@ +# Code generation options for kconfig_compiler +ClassName=Test9 +# +# Singleton=false +# +# Inherits=KConfigSkeleton +# +# IncludeFiles=libtdepim/kpimprefs.h +# +MemberVariables=public +# +### The following line includes the file exampleprefs_base_addon.h +### It can be used to add extra functions and variables to the +### class. +# CustomAdditions=true +# +### Provide setFooBar(int) style functions +Mutators=true diff --git a/tdecore/kconfig_compiler/tests/test9main.cpp b/tdecore/kconfig_compiler/tests/test9main.cpp new file mode 100644 index 000000000..796ec0001 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test9main.cpp @@ -0,0 +1,43 @@ +/* +Copyright (c) 2005 Helge Deller <deller@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 "test9.h" +#include "kinstance.h" +#include <kdebug.h> +#include <tqdir.h> + +int main( int, char*[] ) +{ + KInstance i("test"); + Test9 *t = new Test9( TQString::null, TQString::null ); + + TQStringList myPathsList2 = t->myPathsList2(); + kdWarning() << myPathsList2 << endl; + + // add another path + TQStringList newlist = TQDir::homeDirPath() + TQString::tqfromLatin1("/.kde"); + myPathsList2 = myPathsList2 + newlist; + kdWarning() << myPathsList2 << endl; + + t->setMyPathsList2(myPathsList2); + kdWarning() << t->myPathsList2() << endl; + + delete t; +} diff --git a/tdecore/kconfig_compiler/tests/test_dpointer.cpp.ref b/tdecore/kconfig_compiler/tests/test_dpointer.cpp.ref new file mode 100644 index 000000000..00e933564 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test_dpointer.cpp.ref @@ -0,0 +1,344 @@ +// This file is generated by kconfig_compiler from test_dpointer.kcfg. +// All changes you do to this file will be lost. + +#include "test_dpointer.h" + +#include <klocale.h> + +#include <kstaticdeleter.h> + +class TestDPointerPrivate +{ + public: + + // General + bool autoSave; + int autoSaveInterval; + bool confirm; + TQString archiveFile; + int destination; + + // Views + int hourSize; + bool selectionStartsEditor; + + // KOrganizer Plugins + TQStringList selectedPlugins; + + // Colors + TQColor highlightColor; + TQColor agendaBgColor; + + // Fonts + TQFont timeBarFont; + + // items + KConfigSkeleton::ItemBool *autoSaveItem; + KConfigSkeleton::ItemInt *autoSaveIntervalItem; + KConfigSkeleton::ItemBool *confirmItem; + KConfigSkeleton::ItemString *archiveFileItem; + KConfigSkeleton::ItemEnum *destinationItem; + KConfigSkeleton::ItemInt *hourSizeItem; + KConfigSkeleton::ItemBool *selectionStartsEditorItem; + KConfigSkeleton::ItemStringList *selectedPluginsItem; + KConfigSkeleton::ItemColor *highlightColorItem; + KConfigSkeleton::ItemColor *agendaBgColorItem; + KConfigSkeleton::ItemFont *timeBarFontItem; +}; + +TestDPointer *TestDPointer::mSelf = 0; +static KStaticDeleter<TestDPointer> staticTestDPointerDeleter; + +TestDPointer *TestDPointer::self() +{ + if ( !mSelf ) { + staticTestDPointerDeleter.setObject( mSelf, new TestDPointer() ); + mSelf->readConfig(); + } + + return mSelf; +} + +TestDPointer::TestDPointer( ) + : KConfigSkeleton( TQString::tqfromLatin1( "korganizerrc" ) ) +{ + d = new TestDPointerPrivate; + mSelf = this; + setCurrentGroup( TQString::tqfromLatin1( "General" ) ); + + d->autoSaveItem = new KConfigSkeleton::ItemBool( currentGroup(), TQString::tqfromLatin1( "Auto Save" ), d->autoSave, false ); + d->autoSaveItem->setLabel( i18n("Enable automatic saving of calendar") ); + d->autoSaveItem->setWhatsThis( i18n("WhatsThis text for AutoSave option") ); + addItem( d->autoSaveItem, TQString::tqfromLatin1( "AutoSave" ) ); + d->autoSaveIntervalItem = new KConfigSkeleton::ItemInt( currentGroup(), TQString::tqfromLatin1( "Auto Save Interval" ), d->autoSaveInterval, 10 ); + d->autoSaveIntervalItem->setLabel( i18n("Auto Save Interval") ); + addItem( d->autoSaveIntervalItem, TQString::tqfromLatin1( "AutoSaveInterval" ) ); + d->confirmItem = new KConfigSkeleton::ItemBool( currentGroup(), TQString::tqfromLatin1( "Confirm Deletes" ), d->confirm, true ); + d->confirmItem->setLabel( i18n("Confirm deletes") ); + addItem( d->confirmItem, TQString::tqfromLatin1( "Confirm" ) ); + d->archiveFileItem = new KConfigSkeleton::ItemString( currentGroup(), TQString::tqfromLatin1( "Archive File" ), d->archiveFile ); + d->archiveFileItem->setLabel( i18n("Archive File") ); + addItem( d->archiveFileItem, TQString::tqfromLatin1( "ArchiveFile" ) ); + TQValueList<KConfigSkeleton::ItemEnum::Choice> valuesDestination; + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "standardDestination" ); + valuesDestination.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "askDestination" ); + valuesDestination.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "argl1" ); + choice.label = i18n("Argl1 Label"); + valuesDestination.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "argl2" ); + choice.whatsThis = i18n("Argl2 Whatsthis"); + valuesDestination.append( choice ); + } + { + KConfigSkeleton::ItemEnum::Choice choice; + choice.name = TQString::tqfromLatin1( "argl3" ); + choice.label = i18n("Argl3 Label"); + choice.whatsThis = i18n("Argl3 Whatsthis"); + valuesDestination.append( choice ); + } + d->destinationItem = new KConfigSkeleton::ItemEnum( currentGroup(), TQString::tqfromLatin1( "Destination" ), d->destination, valuesDestination, EnumDestination::standardDestination ); + d->destinationItem->setLabel( i18n("New Events/Todos Should") ); + addItem( d->destinationItem, TQString::tqfromLatin1( "Destination" ) ); + + setCurrentGroup( TQString::tqfromLatin1( "Views" ) ); + + d->hourSizeItem = new KConfigSkeleton::ItemInt( currentGroup(), TQString::tqfromLatin1( "Hour Size" ), d->hourSize, 10 ); + d->hourSizeItem->setLabel( i18n("Hour Size") ); + addItem( d->hourSizeItem, TQString::tqfromLatin1( "HourSize" ) ); + d->selectionStartsEditorItem = new KConfigSkeleton::ItemBool( currentGroup(), TQString::tqfromLatin1( "SelectionStartsEditor" ), d->selectionStartsEditor, false ); + d->selectionStartsEditorItem->setLabel( i18n("Time range selection in agenda view starts event editor") ); + addItem( d->selectionStartsEditorItem, TQString::tqfromLatin1( "SelectionStartsEditor" ) ); + + setCurrentGroup( TQString::tqfromLatin1( "KOrganizer Plugins" ) ); + + TQStringList defaultSelectedPlugins; + defaultSelectedPlugins.append( TQString::fromUtf8( "holidays" ) ); + defaultSelectedPlugins.append( TQString::fromUtf8( "webexport" ) ); + + d->selectedPluginsItem = new KConfigSkeleton::ItemStringList( currentGroup(), TQString::tqfromLatin1( "SelectedPlugins" ), d->selectedPlugins, defaultSelectedPlugins ); + d->selectedPluginsItem->setLabel( i18n("SelectedPlugins") ); + addItem( d->selectedPluginsItem, TQString::tqfromLatin1( "SelectedPlugins" ) ); + + setCurrentGroup( TQString::tqfromLatin1( "Colors" ) ); + + d->highlightColorItem = new KConfigSkeleton::ItemColor( currentGroup(), TQString::tqfromLatin1( "Highlight Color" ), d->highlightColor, TQColor( 100, 100, 255 ) ); + d->highlightColorItem->setLabel( i18n("Highlight color") ); + addItem( d->highlightColorItem, TQString::tqfromLatin1( "HighlightColor" ) ); + d->agendaBgColorItem = new KConfigSkeleton::ItemColor( currentGroup(), TQString::tqfromLatin1( "Agenda Background Color" ), d->agendaBgColor, TQColor( 255, 255, 255 ) ); + d->agendaBgColorItem->setLabel( i18n("Agenda view background color") ); + addItem( d->agendaBgColorItem, TQString::tqfromLatin1( "AgendaBgColor" ) ); + + setCurrentGroup( TQString::tqfromLatin1( "Fonts" ) ); + + d->timeBarFontItem = new KConfigSkeleton::ItemFont( currentGroup(), TQString::tqfromLatin1( "TimeBar Font" ), d->timeBarFont ); + d->timeBarFontItem->setLabel( i18n("Time bar") ); + addItem( d->timeBarFontItem, TQString::tqfromLatin1( "TimeBarFont" ) ); +} + +void TestDPointer::setAutoSave( bool v ) +{ + if (!self()->isImmutable( TQString::tqfromLatin1( "AutoSave" ) )) + self()->d->autoSave = v; +} + +bool TestDPointer::autoSave() +{ + return self()->d->autoSave; +} + + +KConfigSkeleton::ItemBool *TestDPointer::autoSaveItem() +{ + return d->autoSaveItem; +} + +void TestDPointer::setAutoSaveInterval( int v ) +{ + if (!self()->isImmutable( TQString::tqfromLatin1( "AutoSaveInterval" ) )) + self()->d->autoSaveInterval = v; +} + +int TestDPointer::autoSaveInterval() +{ + return self()->d->autoSaveInterval; +} + + +KConfigSkeleton::ItemInt *TestDPointer::autoSaveIntervalItem() +{ + return d->autoSaveIntervalItem; +} + +void TestDPointer::setConfirm( bool v ) +{ + if (!self()->isImmutable( TQString::tqfromLatin1( "Confirm" ) )) + self()->d->confirm = v; +} + +bool TestDPointer::confirm() +{ + return self()->d->confirm; +} + + +KConfigSkeleton::ItemBool *TestDPointer::confirmItem() +{ + return d->confirmItem; +} + +void TestDPointer::setArchiveFile( const TQString & v ) +{ + if (!self()->isImmutable( TQString::tqfromLatin1( "ArchiveFile" ) )) + self()->d->archiveFile = v; +} + +TQString TestDPointer::archiveFile() +{ + return self()->d->archiveFile; +} + + +KConfigSkeleton::ItemString *TestDPointer::archiveFileItem() +{ + return d->archiveFileItem; +} + +void TestDPointer::setDestination( int v ) +{ + if (!self()->isImmutable( TQString::tqfromLatin1( "Destination" ) )) + self()->d->destination = v; +} + +int TestDPointer::destination() +{ + return self()->d->destination; +} + + +KConfigSkeleton::ItemEnum *TestDPointer::destinationItem() +{ + return d->destinationItem; +} + +void TestDPointer::setHourSize( int v ) +{ + if (!self()->isImmutable( TQString::tqfromLatin1( "HourSize" ) )) + self()->d->hourSize = v; +} + +int TestDPointer::hourSize() +{ + return self()->d->hourSize; +} + + +KConfigSkeleton::ItemInt *TestDPointer::hourSizeItem() +{ + return d->hourSizeItem; +} + +void TestDPointer::setSelectionStartsEditor( bool v ) +{ + if (!self()->isImmutable( TQString::tqfromLatin1( "SelectionStartsEditor" ) )) + self()->d->selectionStartsEditor = v; +} + +bool TestDPointer::selectionStartsEditor() +{ + return self()->d->selectionStartsEditor; +} + + +KConfigSkeleton::ItemBool *TestDPointer::selectionStartsEditorItem() +{ + return d->selectionStartsEditorItem; +} + +void TestDPointer::setSelectedPlugins( const TQStringList & v ) +{ + if (!self()->isImmutable( TQString::tqfromLatin1( "SelectedPlugins" ) )) + self()->d->selectedPlugins = v; +} + +TQStringList TestDPointer::selectedPlugins() +{ + return self()->d->selectedPlugins; +} + + +KConfigSkeleton::ItemStringList *TestDPointer::selectedPluginsItem() +{ + return d->selectedPluginsItem; +} + +void TestDPointer::setHighlightColor( const TQColor & v ) +{ + if (!self()->isImmutable( TQString::tqfromLatin1( "HighlightColor" ) )) + self()->d->highlightColor = v; +} + +TQColor TestDPointer::highlightColor() +{ + return self()->d->highlightColor; +} + + +KConfigSkeleton::ItemColor *TestDPointer::highlightColorItem() +{ + return d->highlightColorItem; +} + +void TestDPointer::setAgendaBgColor( const TQColor & v ) +{ + if (!self()->isImmutable( TQString::tqfromLatin1( "AgendaBgColor" ) )) + self()->d->agendaBgColor = v; +} + +TQColor TestDPointer::agendaBgColor() +{ + return self()->d->agendaBgColor; +} + + +KConfigSkeleton::ItemColor *TestDPointer::agendaBgColorItem() +{ + return d->agendaBgColorItem; +} + +void TestDPointer::setTimeBarFont( const TQFont & v ) +{ + if (!self()->isImmutable( TQString::tqfromLatin1( "TimeBarFont" ) )) + self()->d->timeBarFont = v; +} + +TQFont TestDPointer::timeBarFont() +{ + return self()->d->timeBarFont; +} + + +KConfigSkeleton::ItemFont *TestDPointer::timeBarFontItem() +{ + return d->timeBarFontItem; +} + +TestDPointer::~TestDPointer() +{ + delete d; + if ( mSelf == this ) + staticTestDPointerDeleter.setObject( mSelf, 0, false ); +} + diff --git a/tdecore/kconfig_compiler/tests/test_dpointer.h.ref b/tdecore/kconfig_compiler/tests/test_dpointer.h.ref new file mode 100644 index 000000000..81f281e83 --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test_dpointer.h.ref @@ -0,0 +1,224 @@ +// This file is generated by kconfig_compiler from test_dpointer.kcfg. +// All changes you do to this file will be lost. +#ifndef TESTDPOINTER_H +#define TESTDPOINTER_H + +#include <kconfigskeleton.h> +#include <kdebug.h> + +class TestDPointerPrivate; + +class TestDPointer : public KConfigSkeleton +{ + public: + class EnumDestination + { + public: + enum type { standardDestination, askDestination, argl1, argl2, argl3, COUNT }; + }; + + static TestDPointer *self(); + ~TestDPointer(); + + /** + Set Enable automatic saving of calendar + */ + static + void setAutoSave( bool v ); + + /** + Get Enable automatic saving of calendar + */ + static + bool autoSave(); + + /** + Get Item object corresponding to AutoSave() + */ + ItemBool *autoSaveItem(); + + /** + Set Auto Save Interval + */ + static + void setAutoSaveInterval( int v ); + + /** + Get Auto Save Interval + */ + static + int autoSaveInterval(); + + /** + Get Item object corresponding to AutoSaveInterval() + */ + ItemInt *autoSaveIntervalItem(); + + /** + Set Confirm deletes + */ + static + void setConfirm( bool v ); + + /** + Get Confirm deletes + */ + static + bool confirm(); + + /** + Get Item object corresponding to Confirm() + */ + ItemBool *confirmItem(); + + /** + Set Archive File + */ + static + void setArchiveFile( const TQString & v ); + + /** + Get Archive File + */ + static + TQString archiveFile(); + + /** + Get Item object corresponding to ArchiveFile() + */ + ItemString *archiveFileItem(); + + /** + Set New Events/Todos Should + */ + static + void setDestination( int v ); + + /** + Get New Events/Todos Should + */ + static + int destination(); + + /** + Get Item object corresponding to Destination() + */ + ItemEnum *destinationItem(); + + /** + Set Hour Size + */ + static + void setHourSize( int v ); + + /** + Get Hour Size + */ + static + int hourSize(); + + /** + Get Item object corresponding to HourSize() + */ + ItemInt *hourSizeItem(); + + /** + Set Time range selection in agenda view starts event editor + */ + static + void setSelectionStartsEditor( bool v ); + + /** + Get Time range selection in agenda view starts event editor + */ + static + bool selectionStartsEditor(); + + /** + Get Item object corresponding to SelectionStartsEditor() + */ + ItemBool *selectionStartsEditorItem(); + + /** + Set SelectedPlugins + */ + static + void setSelectedPlugins( const TQStringList & v ); + + /** + Get SelectedPlugins + */ + static + TQStringList selectedPlugins(); + + /** + Get Item object corresponding to SelectedPlugins() + */ + ItemStringList *selectedPluginsItem(); + + /** + Set Highlight color + */ + static + void setHighlightColor( const TQColor & v ); + + /** + Get Highlight color + */ + static + TQColor highlightColor(); + + /** + Get Item object corresponding to HighlightColor() + */ + ItemColor *highlightColorItem(); + + /** + Set Agenda view background color + */ + static + void setAgendaBgColor( const TQColor & v ); + + /** + Get Agenda view background color + */ + static + TQColor agendaBgColor(); + + /** + Get Item object corresponding to AgendaBgColor() + */ + ItemColor *agendaBgColorItem(); + + /** + Set Time bar + */ + static + void setTimeBarFont( const TQFont & v ); + + /** + Get Time bar + */ + static + TQFont timeBarFont(); + + /** + Get Item object corresponding to TimeBarFont() + */ + ItemFont *timeBarFontItem(); + + static + void writeConfig() + { + static_cast<KConfigSkeleton*>(self())->writeConfig(); + } + protected: + TestDPointer(); + static TestDPointer *mSelf; + + private: + TestDPointerPrivate *d; +}; + +#endif + diff --git a/tdecore/kconfig_compiler/tests/test_dpointer.kcfg b/tdecore/kconfig_compiler/tests/test_dpointer.kcfg new file mode 100644 index 000000000..3b19e270e --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test_dpointer.kcfg @@ -0,0 +1,78 @@ +<?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="korganizerrc"/> + + <group name="General"> + <entry type="Bool" key="Auto Save"> + <label>Enable automatic saving of calendar</label> + <whatsthis>WhatsThis text for AutoSave option</whatsthis> + <default>false</default> + </entry> + <entry type="Int" key="Auto Save Interval"> + <default>10</default> + </entry> + <entry type="Bool" key="Confirm Deletes" name="Confirm"> + <label>Confirm deletes</label> + <default>true</default> + </entry> + <entry type="String" key="Archive File"> + </entry> + <entry type="Enum" key="Destination" name="Destination"> + <label>New Events/Todos Should</label> + <choices> + <choice name="standardDestination"> + </choice> + <choice name="askDestination"> + </choice> + <choice name="argl1"> + <label>Argl1 Label</label> + </choice> + <choice name="argl2"> + <whatsthis>Argl2 Whatsthis</whatsthis> + </choice> + <choice name="argl3"> + <label>Argl3 Label</label> + <whatsthis>Argl3 Whatsthis</whatsthis> + </choice> + </choices> + <default>standardDestination</default> + </entry> + </group> + + <group name="Views"> + <entry type="Int" key="Hour Size"> + <default>10</default> + </entry> + <entry type="Bool" name="SelectionStartsEditor"> + <label>Time range selection in agenda view starts event editor</label> + <default>false</default> + </entry> + </group> + + <group name="KOrganizer Plugins"> + <entry type="StringList" name="SelectedPlugins"> + <default>holidays,webexport</default> + </entry> + </group> + + <group name="Colors"> + <entry type="Color" key="Highlight Color"> + <label>Highlight color</label> + <default>100, 100, 255</default> + </entry> + <entry type="Color" key="Agenda Background Color" name="AgendaBgColor"> + <label>Agenda view background color</label> + <default>255, 255, 255</default> + </entry> + </group> + + <group name="Fonts"> + <entry type="Font" key="TimeBar Font"> + <label>Time bar</label> + </entry> + </group> + +</kcfg> diff --git a/tdecore/kconfig_compiler/tests/test_dpointer.kcfgc b/tdecore/kconfig_compiler/tests/test_dpointer.kcfgc new file mode 100644 index 000000000..48baa376e --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test_dpointer.kcfgc @@ -0,0 +1,11 @@ +# Code generation options for kconfig_compiler +File=test_dpointer.kcfg +ClassName=TestDPointer +Singleton=true +Mutators=true +#Inherits=MyPrefs +#IncludeFiles=myprefs.h +MemberVariables=dpointer +#GlobalEnums=true +ItemAccessors=true +SetUserTexts=true diff --git a/tdecore/kconfig_compiler/tests/test_dpointer_main.cpp b/tdecore/kconfig_compiler/tests/test_dpointer_main.cpp new file mode 100644 index 000000000..a6c23c8fe --- /dev/null +++ b/tdecore/kconfig_compiler/tests/test_dpointer_main.cpp @@ -0,0 +1,30 @@ +/* +Copyright (c) 2005 Duncan Mac-Vicar P. <duncan@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 "test_dpointer.h" +#include "kinstance.h" + +int main( int, char*[] ) +{ + KInstance i("test"); + TestDPointer *t = TestDPointer::self(); + delete t; +} |