aboutsummaryrefslogtreecommitdiff
path: root/autotests/kconfig_compiler
diff options
context:
space:
mode:
Diffstat (limited to 'autotests/kconfig_compiler')
-rw-r--r--autotests/kconfig_compiler/CMakeLists.txt212
-rw-r--r--autotests/kconfig_compiler/kconfigcompiler_test.cpp181
-rw-r--r--autotests/kconfig_compiler/kconfigcompiler_test.h42
-rw-r--r--autotests/kconfig_compiler/myprefs.h12
-rw-r--r--autotests/kconfig_compiler/test1.cpp.ref72
-rw-r--r--autotests/kconfig_compiler/test1.h.ref197
-rw-r--r--autotests/kconfig_compiler/test1.kcfg55
-rw-r--r--autotests/kconfig_compiler/test1.kcfgc18
-rw-r--r--autotests/kconfig_compiler/test10.cpp.ref46
-rw-r--r--autotests/kconfig_compiler/test10.h.ref50
-rw-r--r--autotests/kconfig_compiler/test10.kcfg13
-rw-r--r--autotests/kconfig_compiler/test10.kcfgc4
-rw-r--r--autotests/kconfig_compiler/test10main.cpp32
-rw-r--r--autotests/kconfig_compiler/test11.cpp.ref278
-rw-r--r--autotests/kconfig_compiler/test11.h.ref572
-rw-r--r--autotests/kconfig_compiler/test11.kcfg136
-rw-r--r--autotests/kconfig_compiler/test11.kcfgc13
-rw-r--r--autotests/kconfig_compiler/test11_types.h31
-rw-r--r--autotests/kconfig_compiler/test11a.cpp.ref187
-rw-r--r--autotests/kconfig_compiler/test11a.h.ref480
-rw-r--r--autotests/kconfig_compiler/test11a.kcfg135
-rw-r--r--autotests/kconfig_compiler/test11a.kcfgc13
-rw-r--r--autotests/kconfig_compiler/test11main.cpp34
-rw-r--r--autotests/kconfig_compiler/test12.cpp.ref22
-rw-r--r--autotests/kconfig_compiler/test12.h.ref36
-rw-r--r--autotests/kconfig_compiler/test12.kcfg10
-rw-r--r--autotests/kconfig_compiler/test12.kcfgc1
-rw-r--r--autotests/kconfig_compiler/test12main.cpp28
-rw-r--r--autotests/kconfig_compiler/test1main.cpp31
-rw-r--r--autotests/kconfig_compiler/test2.cpp.ref96
-rw-r--r--autotests/kconfig_compiler/test2.h.ref335
-rw-r--r--autotests/kconfig_compiler/test2.kcfg78
-rw-r--r--autotests/kconfig_compiler/test2.kcfgc11
-rw-r--r--autotests/kconfig_compiler/test2main.cpp31
-rw-r--r--autotests/kconfig_compiler/test3.cpp.ref29
-rw-r--r--autotests/kconfig_compiler/test3.h.ref140
-rw-r--r--autotests/kconfig_compiler/test3.kcfg26
-rw-r--r--autotests/kconfig_compiler/test3.kcfgc12
-rw-r--r--autotests/kconfig_compiler/test3a.cpp.ref29
-rw-r--r--autotests/kconfig_compiler/test3a.h.ref142
-rw-r--r--autotests/kconfig_compiler/test3a.kcfg26
-rw-r--r--autotests/kconfig_compiler/test3a.kcfgc12
-rw-r--r--autotests/kconfig_compiler/test3amain.cpp31
-rw-r--r--autotests/kconfig_compiler/test3main.cpp31
-rw-r--r--autotests/kconfig_compiler/test4.cpp.ref178
-rw-r--r--autotests/kconfig_compiler/test4.h.ref171
-rw-r--r--autotests/kconfig_compiler/test4.kcfg56
-rw-r--r--autotests/kconfig_compiler/test4.kcfgc11
-rw-r--r--autotests/kconfig_compiler/test4main.cpp32
-rw-r--r--autotests/kconfig_compiler/test5.cpp.ref88
-rw-r--r--autotests/kconfig_compiler/test5.h.ref123
-rw-r--r--autotests/kconfig_compiler/test5.kcfg42
-rw-r--r--autotests/kconfig_compiler/test5.kcfgc11
-rw-r--r--autotests/kconfig_compiler/test5main.cpp32
-rw-r--r--autotests/kconfig_compiler/test6.cpp.ref31
-rw-r--r--autotests/kconfig_compiler/test6.h.ref94
-rw-r--r--autotests/kconfig_compiler/test6.kcfg25
-rw-r--r--autotests/kconfig_compiler/test6.kcfgc11
-rw-r--r--autotests/kconfig_compiler/test6main.cpp32
-rw-r--r--autotests/kconfig_compiler/test7.cpp.ref31
-rw-r--r--autotests/kconfig_compiler/test7.h.ref94
-rw-r--r--autotests/kconfig_compiler/test7.kcfg25
-rw-r--r--autotests/kconfig_compiler/test7.kcfgc11
-rw-r--r--autotests/kconfig_compiler/test7main.cpp32
-rw-r--r--autotests/kconfig_compiler/test8a.cpp.ref22
-rw-r--r--autotests/kconfig_compiler/test8a.h.ref62
-rw-r--r--autotests/kconfig_compiler/test8a.kcfg17
-rw-r--r--autotests/kconfig_compiler/test8a.kcfgc3
-rw-r--r--autotests/kconfig_compiler/test8b.cpp.ref52
-rw-r--r--autotests/kconfig_compiler/test8b.h.ref92
-rw-r--r--autotests/kconfig_compiler/test8b.kcfg21
-rw-r--r--autotests/kconfig_compiler/test8b.kcfgc6
-rw-r--r--autotests/kconfig_compiler/test8main.cpp36
-rw-r--r--autotests/kconfig_compiler/test9.cpp.ref35
-rw-r--r--autotests/kconfig_compiler/test9.h.ref83
-rw-r--r--autotests/kconfig_compiler/test9.kcfg24
-rw-r--r--autotests/kconfig_compiler/test9.kcfgc18
-rw-r--r--autotests/kconfig_compiler/test9main.cpp45
-rw-r--r--autotests/kconfig_compiler/test_dpointer.cpp.ref348
-rw-r--r--autotests/kconfig_compiler/test_dpointer.h.ref220
-rw-r--r--autotests/kconfig_compiler/test_dpointer.kcfg78
-rw-r--r--autotests/kconfig_compiler/test_dpointer.kcfgc11
-rw-r--r--autotests/kconfig_compiler/test_dpointer_main.cpp32
-rw-r--r--autotests/kconfig_compiler/test_signal.cpp.ref73
-rw-r--r--autotests/kconfig_compiler/test_signal.h.ref153
-rw-r--r--autotests/kconfig_compiler/test_signal.kcfg45
-rw-r--r--autotests/kconfig_compiler/test_signal.kcfgc7
-rw-r--r--autotests/kconfig_compiler/test_signal_main.cpp32
88 files changed, 6615 insertions, 0 deletions
diff --git a/autotests/kconfig_compiler/CMakeLists.txt b/autotests/kconfig_compiler/CMakeLists.txt
new file mode 100644
index 00000000..ef2fd407
--- /dev/null
+++ b/autotests/kconfig_compiler/CMakeLists.txt
@@ -0,0 +1,212 @@
+
+#test5.cpp test5.h: $(srcdir)/test5.kcfg ../kconfig_compiler $(srcdir)/test5.kcfgc
+# ../kconfig_compiler $(srcdir)/test5.kcfg $(srcdir)/test5.kcfgc
+
+macro(GEN_KCFG_TEST_SOURCE _testName _srcs)
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.cpp ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.h
+ COMMAND ${KConfig_KCFGC_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_testName}.kcfg ${CMAKE_CURRENT_SOURCE_DIR}/${_testName}.kcfgc
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_testName}.kcfg ${CMAKE_CURRENT_SOURCE_DIR}/${_testName}.kcfgc kconfig_compiler)
+
+# set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_testName}.h PROPERTIES GENERATED TRUE)
+ qt5_generate_moc(${CMAKE_CURRENT_BINARY_DIR}/${_testName}.h ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.moc )
+# do not run automoc on the generated file
+ set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_testName}.cpp PROPERTIES SKIP_AUTOMOC TRUE)
+ set( ${_srcs} ${${_srcs}} ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.cpp ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.h )
+
+ set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_testName}.moc )
+endmacro(GEN_KCFG_TEST_SOURCE)
+
+include(ECMMarkAsTest)
+
+########### next target ###############
+
+set(test1_SRCS test1main.cpp )
+
+
+gen_kcfg_test_source(test1 test1_SRCS)
+
+add_executable(test1 ${test1_SRCS})
+ecm_mark_as_test(test1)
+target_link_libraries(test1 KF5::ConfigGui)
+
+
+########### next target ###############
+
+set(test2_SRCS test2main.cpp )
+
+
+gen_kcfg_test_source(test2 test2_SRCS)
+
+add_executable(test2 ${test2_SRCS})
+ecm_mark_as_test(test2)
+target_link_libraries(test2 KF5::ConfigGui)
+
+
+########### next target ###############
+
+set(test3_SRCS test3main.cpp )
+
+
+gen_kcfg_test_source(test3 test3_SRCS)
+
+add_executable(test3 ${test3_SRCS})
+ecm_mark_as_test(test3)
+target_link_libraries(test3 KF5::ConfigGui)
+
+
+########### next target ###############
+
+set(test3a_SRCS test3amain.cpp )
+
+
+gen_kcfg_test_source(test3a test3a_SRCS)
+
+add_executable(test3a ${test3a_SRCS})
+ecm_mark_as_test(test3a)
+target_link_libraries(test3a KF5::ConfigGui)
+
+
+########### next target ###############
+
+set(test4_SRCS test4main.cpp )
+
+
+gen_kcfg_test_source(test4 test4_SRCS)
+
+add_executable(test4 ${test4_SRCS})
+ecm_mark_as_test(test4)
+target_link_libraries(test4 KF5::ConfigGui)
+
+
+########### next target ###############
+
+set(test5_SRCS test5main.cpp )
+
+
+gen_kcfg_test_source(test5 test5_SRCS)
+
+add_executable(test5 ${test5_SRCS})
+ecm_mark_as_test(test5)
+target_link_libraries(test5 KF5::ConfigGui)
+
+
+########### next target ###############
+
+set(test6_SRCS test6main.cpp )
+
+
+gen_kcfg_test_source(test6 test6_SRCS)
+
+add_executable(test6 ${test6_SRCS})
+ecm_mark_as_test(test6)
+target_link_libraries(test6 KF5::ConfigGui)
+
+
+########### next target ###############
+
+set(test7_SRCS test7main.cpp )
+
+
+gen_kcfg_test_source(test7 test7_SRCS)
+
+add_executable(test7 ${test7_SRCS})
+ecm_mark_as_test(test7)
+target_link_libraries(test7 KF5::ConfigGui)
+
+
+########### next target ###############
+
+set(test8_SRCS test8main.cpp )
+
+
+gen_kcfg_test_source(test8a test8_SRCS)
+gen_kcfg_test_source(test8b test8_SRCS)
+
+add_executable(test8 ${test8_SRCS})
+ecm_mark_as_test(test8)
+target_link_libraries(test8 KF5::ConfigGui)
+
+
+########### next target ###############
+
+set(test9_SRCS test9main.cpp )
+
+
+gen_kcfg_test_source(test9 test9_SRCS)
+
+add_executable(test9 ${test9_SRCS})
+ecm_mark_as_test(test9)
+target_link_libraries(test9 KF5::ConfigGui)
+
+
+########### next target ###############
+
+set(test10_SRCS test10main.cpp )
+
+
+gen_kcfg_test_source(test10 test10_SRCS)
+
+add_executable(test10 ${test10_SRCS})
+ecm_mark_as_test(test10)
+target_link_libraries(test10 KF5::ConfigGui)
+
+
+########### next target ###############
+
+set(test11_SRCS test11main.cpp )
+
+
+gen_kcfg_test_source(test11 test11_SRCS)
+gen_kcfg_test_source(test11a test11_SRCS)
+
+add_executable(test11 ${test11_SRCS})
+ecm_mark_as_test(test11)
+target_link_libraries(test11 KF5::ConfigGui)
+
+
+########### next target ###############
+
+set(test12_SRCS test12main.cpp )
+
+gen_kcfg_test_source(test12 test12_SRCS)
+
+add_executable(test12 ${test12_SRCS})
+ecm_mark_as_test(test12)
+target_link_libraries(test12 KF5::ConfigGui)
+
+
+########### next target ###############
+
+set(test_dpointer_SRCS test_dpointer_main.cpp )
+
+gen_kcfg_test_source(test_dpointer test_dpointer_SRCS)
+
+add_executable(test_dpointer ${test_dpointer_SRCS})
+ecm_mark_as_test(test_dpointer)
+target_link_libraries(test_dpointer KF5::ConfigGui)
+
+
+########### next target ###############
+
+set(test_signal_SRCS test_signal_main.cpp )
+gen_kcfg_test_source(test_signal test_signal_SRCS)
+add_executable(test_signal ${test_signal_SRCS})
+ecm_mark_as_test(test_signal)
+target_link_libraries(test_signal KF5::ConfigGui)
+
+########### next target ###############
+
+set(kconfigcompiler_test_SRCS kconfigcompiler_test.cpp )
+add_executable(kconfigcompiler_test ${kconfigcompiler_test_SRCS})
+ecm_mark_as_test(kconfigcompiler_test)
+add_test(kconfig-kconfigcompiler kconfigcompiler_test)
+
+target_link_libraries(kconfigcompiler_test Qt5::Test )
+
+########### install files ###############
+
+
+
+
+
diff --git a/autotests/kconfig_compiler/kconfigcompiler_test.cpp b/autotests/kconfig_compiler/kconfigcompiler_test.cpp
new file mode 100644
index 00000000..a9bf52c8
--- /dev/null
+++ b/autotests/kconfig_compiler/kconfigcompiler_test.cpp
@@ -0,0 +1,181 @@
+/*
+ Tests for KConfig Compiler
+
+ Copyright (c) 2005 by Duncan Mac-Vicar <duncan@kde.org>
+ Copyright (c) 2009 by Pino Toscano <pino@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 <QtCore/QDir>
+#include <QtCore/QFile>
+#include <QtCore/QProcess>
+#include <QtCore/QString>
+#include <QtTest/QtTest>
+#include <qstandardpaths.h>
+#include "kconfigcompiler_test.h"
+
+// QT5 TODO QTEST_GUILESS_MAIN(KConfigCompiler_Test)
+QTEST_MAIN(KConfigCompiler_Test)
+
+typedef const char * CompilerTestSet[];
+
+static CompilerTestSet testCases =
+{
+ "test1.cpp", "test1.h",
+ "test2.cpp", "test2.h",
+ "test3.cpp", "test3.h",
+ "test3a.cpp", "test3a.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",
+ "test10.h", "test10.cpp",
+ "test11.h", "test11.cpp",
+ "test11a.h", "test11a.cpp",
+ "test12.h", "test12.cpp",
+ "test_dpointer.cpp", "test_dpointer.h",
+ "test_signal.cpp", "test_signal.h",
+ NULL
+};
+
+static CompilerTestSet testCasesToRun =
+{
+ "test1",
+ "test2",
+ "test3",
+ "test3a",
+ "test4",
+ "test5",
+ "test6",
+ "test7",
+ "test8",
+ "test9",
+ "test10",
+ "test11",
+ "test12",
+ "test_dpointer",
+ "test_signal",
+ 0
+};
+
+#if 0
+static CompilerTestSet willFailCases =
+{
+ // where is that QDir coming from?
+ //"test9.cpp", NULL
+ NULL
+};
+#endif
+
+void KConfigCompiler_Test::initTestCase()
+{
+ m_diffExe = QStandardPaths::findExecutable("diff");
+ if (!m_diffExe.isEmpty()) {
+ m_diff.setFileName(QDir::currentPath() + QLatin1String("/kconfigcompiler_test_differences.diff"));
+ if (m_diff.exists()) {
+ m_diff.remove();
+ }
+ }
+}
+
+void KConfigCompiler_Test::testBaselineComparison_data()
+{
+ QTest::addColumn<QString>("testName");
+
+ for (const char **it = testCases; *it; ++it) {
+ QTest::newRow(*it) << QString::fromLatin1(*it);
+ }
+}
+
+void KConfigCompiler_Test::testBaselineComparison()
+{
+ QFETCH(QString, testName);
+
+ QFile file(QFINDTESTDATA(testName));
+ QFile fileRef(QFINDTESTDATA(testName + QLatin1String(".ref")));
+
+ if (!file.open(QIODevice::ReadOnly)) {
+ qWarning() << "Failed to open" << file.fileName();
+ QFAIL("Can't open file for comparison");
+ }
+ if (!fileRef.open(QIODevice::ReadOnly)) {
+ qWarning() << "Failed to open" << fileRef.fileName();
+ QFAIL("Can't open file for comparison");
+ }
+ QString content = file.readAll();
+ QString contentRef = fileRef.readAll();
+
+ if (content != contentRef) {
+ appendFileDiff(fileRef.fileName(), file.fileName());
+ }
+ // use split('\n') to avoid
+ // the whole output shown inline
+ QCOMPARE(content.split('\n'), contentRef.split('\n'));
+ QVERIFY(content == contentRef);
+}
+
+void KConfigCompiler_Test::testRunning_data()
+{
+ QTest::addColumn<QString>("testName");
+
+ for (const char **it = testCasesToRun; *it; ++it) {
+ QTest::newRow(*it) << QString::fromLatin1(*it);
+ }
+}
+
+void KConfigCompiler_Test::testRunning()
+{
+ QFETCH(QString, testName);
+
+#ifdef Q_OS_WIN
+ testName += QStringLiteral(".exe");
+#endif
+
+ QString program = QFINDTESTDATA(testName);
+ QVERIFY2(QFile::exists(program), qPrintable(program + QLatin1String(" must exist!")));
+ QProcess process;
+ process.start(program, QIODevice::ReadOnly);
+ if (process.waitForStarted()) {
+ QVERIFY(process.waitForFinished());
+ }
+ QCOMPARE((int)process.error(), (int)QProcess::UnknownError);
+ QCOMPARE(process.exitCode(), 0);
+}
+
+
+void KConfigCompiler_Test::appendFileDiff(const QString &oldFile, const QString &newFile)
+{
+ if (m_diffExe.isEmpty()) {
+ return;
+ }
+ if (!m_diff.isOpen()) {
+ if (!m_diff.open(QIODevice::WriteOnly)) {
+ return;
+ }
+ }
+
+ QStringList args;
+ args << "-u";
+ args << QFileInfo(oldFile).absoluteFilePath();
+ args << QFileInfo(newFile).absoluteFilePath();
+
+ QProcess process;
+ process.start(m_diffExe, args, QIODevice::ReadOnly);
+ process.waitForStarted();
+ process.waitForFinished();
+ if (process.exitCode() == 1) {
+ QByteArray out = process.readAllStandardOutput();
+ m_diff.write(out);
+ }
+}
diff --git a/autotests/kconfig_compiler/kconfigcompiler_test.h b/autotests/kconfig_compiler/kconfigcompiler_test.h
new file mode 100644
index 00000000..53ad18a0
--- /dev/null
+++ b/autotests/kconfig_compiler/kconfigcompiler_test.h
@@ -0,0 +1,42 @@
+/*
+ Tests for KConfig Compiler
+
+ Copyright (c) 2005 by Duncan Mac-Vicar <duncan@kde.org>
+ Copyright (c) 2009 by Pino Toscano <pino@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 <QtCore/QFile>
+#include <QtCore/QObject>
+
+class QString;
+
+class KConfigCompiler_Test : public QObject
+{
+ Q_OBJECT
+private Q_SLOTS:
+ void initTestCase();
+ void testBaselineComparison_data();
+ void testBaselineComparison();
+ void testRunning_data();
+ void testRunning();
+private:
+ void appendFileDiff(const QString &oldFile, const QString &newFile);
+
+ QString m_diffExe;
+ QFile m_diff;
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/myprefs.h b/autotests/kconfig_compiler/myprefs.h
new file mode 100644
index 00000000..4d12eeb7
--- /dev/null
+++ b/autotests/kconfig_compiler/myprefs.h
@@ -0,0 +1,12 @@
+#ifndef MYPREFS_H
+#define MYPREFS_H
+
+#include <kconfigskeleton.h>
+
+class MyPrefs : public KConfigSkeleton
+{
+ public:
+ MyPrefs( const QString &a ) : KConfigSkeleton( a ) {}
+};
+
+#endif
diff --git a/autotests/kconfig_compiler/test1.cpp.ref b/autotests/kconfig_compiler/test1.cpp.ref
new file mode 100644
index 00000000..611ce5c1
--- /dev/null
+++ b/autotests/kconfig_compiler/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 QString & transport, const QString & folder )
+ : KConfigSkeleton( QLatin1String( "examplerc" ) )
+ , mParamtransport(transport)
+ , mParamfolder(folder)
+{
+ setCurrentGroup( QString( QLatin1String( "General-%1" ) ).arg( mParamfolder ) );
+
+ KConfigSkeleton::ItemBool *itemOneOption;
+ itemOneOption = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "OneOption" ), mOneOption, true );
+ addItem( itemOneOption, QLatin1String( "OneOption" ) );
+ KConfigSkeleton::ItemInt *itemAnotherOption;
+ itemAnotherOption = new KConfigSkeleton::ItemInt( currentGroup(), QLatin1String( "Another Option" ), mAnotherOption, 5 );
+ addItem( itemAnotherOption, QLatin1String( "AnotherOption" ) );
+ QList<KConfigSkeleton::ItemEnum::Choice> valuesListOption;
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("One");
+ valuesListOption.append( choice );
+ }
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("Two");
+ valuesListOption.append( choice );
+ }
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("Three");
+ valuesListOption.append( choice );
+ }
+ KConfigSkeleton::ItemEnum *itemListOption;
+ itemListOption = new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String( "ListOption" ), mListOption, valuesListOption, EnumListOption::One );
+ addItem( itemListOption, QLatin1String( "ListOption" ) );
+
+ setCurrentGroup( QLatin1String( "MyOptions" ) );
+
+ KConfigSkeleton::ItemString *itemMyString;
+ itemMyString = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "MyString" ), mMyString, QLatin1String( "Default String" ) );
+ addItem( itemMyString, QLatin1String( "MyString" ) );
+ KConfigSkeleton::ItemPath *itemMyPath;
+ itemMyPath = new KConfigSkeleton::ItemPath( currentGroup(), QLatin1String( "MyPath" ), mMyPath, QDir::homePath()+QString::fromLatin1(".hidden_file") );
+ addItem( itemMyPath, QLatin1String( "MyPath" ) );
+ KConfigSkeleton::ItemInt *itemAnotherOption2;
+ itemAnotherOption2 = new KConfigSkeleton::ItemInt( currentGroup(), QLatin1String( "Another Option" ), mAnotherOption2, 10 );
+ addItem( itemAnotherOption2, QLatin1String( "AnotherOption2" ) );
+ QStringList defaultMyStringList;
+ defaultMyStringList.append( QString::fromUtf8( "up" ) );
+ defaultMyStringList.append( QString::fromUtf8( "down" ) );
+
+ KConfigSkeleton::ItemStringList *itemMyStringList;
+ itemMyStringList = new KConfigSkeleton::ItemStringList( currentGroup(), QLatin1String( "MyStringList" ), mMyStringList, defaultMyStringList );
+ addItem( itemMyStringList, QLatin1String( "MyStringList" ) );
+ QStringList defaultMyStringListHidden;
+ defaultMyStringListHidden.append( QString::fromUtf8( "up" ) );
+ defaultMyStringListHidden.append( QString::fromUtf8( "down" ) );
+
+ KConfigSkeleton::ItemStringList *itemMyStringListHidden;
+ itemMyStringListHidden = new KConfigSkeleton::ItemStringList( currentGroup(), QLatin1String( "MyStringListHidden" ), mMyStringListHidden, defaultMyStringListHidden );
+ addItem( itemMyStringListHidden, QLatin1String( "MyStringListHidden" ) );
+ KConfigSkeleton::ItemInt *itemMyNumber;
+ itemMyNumber = new KConfigSkeleton::ItemInt( currentGroup(), QString( QLatin1String( "List-%1-%2" ) ).arg( mParamtransport ).arg( mParamfolder ), mMyNumber, 1 );
+ addItem( itemMyNumber, QLatin1String( "MyNumber" ) );
+}
+
+Test1::~Test1()
+{
+}
+
diff --git a/autotests/kconfig_compiler/test1.h.ref b/autotests/kconfig_compiler/test1.h.ref
new file mode 100644
index 00000000..57fa4bf8
--- /dev/null
+++ b/autotests/kconfig_compiler/test1.h.ref
@@ -0,0 +1,197 @@
+// 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 <QCoreApplication>
+#include <QDebug>
+
+#include <qdir.h>
+class Test1 : public KConfigSkeleton
+{
+ public:
+ class EnumListOption
+ {
+ public:
+ enum type { One, Two, Three, COUNT };
+ };
+
+ Test1( const QString & transport, const QString & folder );
+ ~Test1();
+
+ /**
+ Set One option
+ */
+ void setOneOption( bool v )
+ {
+ if (!isImmutable( QString::fromLatin1( "OneOption" ) ))
+ mOneOption = v;
+ }
+
+ /**
+ Get One option
+ */
+ bool oneOption() const
+ {
+ return mOneOption;
+ }
+
+ /**
+ Set Another option
+ */
+ void setAnotherOption( int v )
+ {
+ if (!isImmutable( QString::fromLatin1( "AnotherOption" ) ))
+ mAnotherOption = v;
+ }
+
+ /**
+ Get Another option
+ */
+ int anotherOption() const
+ {
+ return mAnotherOption;
+ }
+
+ /**
+ Set This is some funky option
+ */
+ void setListOption( int v )
+ {
+ if (!isImmutable( QString::fromLatin1( "ListOption" ) ))
+ mListOption = v;
+ }
+
+ /**
+ Get This is some funky option
+ */
+ int listOption() const
+ {
+ return mListOption;
+ }
+
+ /**
+ Set This is a string
+ */
+ void setMyString( const QString & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "MyString" ) ))
+ mMyString = v;
+ }
+
+ /**
+ Get This is a string
+ */
+ QString myString() const
+ {
+ return mMyString;
+ }
+
+ /**
+ Set This is a path
+ */
+ void setMyPath( const QString & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "MyPath" ) ))
+ mMyPath = v;
+ }
+
+ /**
+ Get This is a path
+ */
+ QString myPath() const
+ {
+ return mMyPath;
+ }
+
+ /**
+ Set Another option
+ */
+ void setAnotherOption2( int v )
+ {
+ if (!isImmutable( QString::fromLatin1( "AnotherOption2" ) ))
+ mAnotherOption2 = v;
+ }
+
+ /**
+ Get Another option
+ */
+ int anotherOption2() const
+ {
+ return mAnotherOption2;
+ }
+
+ /**
+ Set MyStringList
+ */
+ void setMyStringList( const QStringList & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "MyStringList" ) ))
+ mMyStringList = v;
+ }
+
+ /**
+ Get MyStringList
+ */
+ QStringList myStringList() const
+ {
+ return mMyStringList;
+ }
+
+ /**
+ Set MyStringListHidden
+ */
+ void setMyStringListHidden( const QStringList & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "MyStringListHidden" ) ))
+ mMyStringListHidden = v;
+ }
+
+ /**
+ Get MyStringListHidden
+ */
+ QStringList myStringListHidden() const
+ {
+ return mMyStringListHidden;
+ }
+
+ /**
+ Set List Number
+ */
+ void setMyNumber( int v )
+ {
+ if (!isImmutable( QString::fromLatin1( "MyNumber" ) ))
+ mMyNumber = v;
+ }
+
+ /**
+ Get List Number
+ */
+ int myNumber() const
+ {
+ return mMyNumber;
+ }
+
+ protected:
+ QString mParamtransport;
+ QString mParamfolder;
+
+ // General-$(folder)
+ bool mOneOption;
+ int mAnotherOption;
+ int mListOption;
+
+ // MyOptions
+ QString mMyString;
+ QString mMyPath;
+ int mAnotherOption2;
+ QStringList mMyStringList;
+ QStringList mMyStringListHidden;
+ int mMyNumber;
+
+ private:
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test1.kcfg b/autotests/kconfig_compiler/test1.kcfg
new file mode 100644
index 00000000..819bdac5
--- /dev/null
+++ b/autotests/kconfig_compiler/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::homePath()+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/autotests/kconfig_compiler/test1.kcfgc b/autotests/kconfig_compiler/test1.kcfgc
new file mode 100644
index 00000000..6e0edd36
--- /dev/null
+++ b/autotests/kconfig_compiler/test1.kcfgc
@@ -0,0 +1,18 @@
+# Code generation options for kconfig_compiler
+ClassName=Test1
+#
+# Singleton=false
+#
+# Inherits=KConfigSkeleton
+#
+# IncludeFiles=libkdepim/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/autotests/kconfig_compiler/test10.cpp.ref b/autotests/kconfig_compiler/test10.cpp.ref
new file mode 100644
index 00000000..ac28ab2f
--- /dev/null
+++ b/autotests/kconfig_compiler/test10.cpp.ref
@@ -0,0 +1,46 @@
+// This file is generated by kconfig_compiler from test10.kcfg.
+// All changes you do to this file will be lost.
+
+#include "test10.h"
+
+#include <qglobal.h>
+#include <QtCore/QFile>
+
+class Test10Helper
+{
+ public:
+ Test10Helper() : q(0) {}
+ ~Test10Helper() { delete q; }
+ Test10 *q;
+};
+Q_GLOBAL_STATIC(Test10Helper, s_globalTest10)
+Test10 *Test10::self()
+{
+ if (!s_globalTest10()->q) {
+ new Test10;
+ s_globalTest10()->q->readConfig();
+ }
+
+ return s_globalTest10()->q;
+}
+
+Test10::Test10( )
+ : KConfigSkeleton( QLatin1String( "test10rc" ) )
+{
+ Q_ASSERT(!s_globalTest10()->q);
+ s_globalTest10()->q = this;
+ setCurrentGroup( QLatin1String( "Foo" ) );
+
+ KConfigSkeleton::ItemUrl *itemFooBar;
+ itemFooBar = new KConfigSkeleton::ItemUrl( currentGroup(), QLatin1String( "foo bar" ), mFooBar );
+ addItem( itemFooBar, QLatin1String( "FooBar" ) );
+ KConfigSkeleton::ItemUrlList *itemBarFoo;
+ itemBarFoo = new KConfigSkeleton::ItemUrlList( currentGroup(), QLatin1String( "bar foo" ), mBarFoo );
+ addItem( itemBarFoo, QLatin1String( "BarFoo" ) );
+}
+
+Test10::~Test10()
+{
+ s_globalTest10()->q = 0;
+}
+
diff --git a/autotests/kconfig_compiler/test10.h.ref b/autotests/kconfig_compiler/test10.h.ref
new file mode 100644
index 00000000..f3f441d3
--- /dev/null
+++ b/autotests/kconfig_compiler/test10.h.ref
@@ -0,0 +1,50 @@
+// This file is generated by kconfig_compiler from test10.kcfg.
+// All changes you do to this file will be lost.
+#ifndef TEST10_H
+#define TEST10_H
+
+#include <kconfigskeleton.h>
+#include <QCoreApplication>
+#include <QDebug>
+
+class Test10 : public KConfigSkeleton
+{
+ public:
+
+ static Test10 *self();
+ ~Test10();
+
+
+ /**
+ Get foo bar
+ */
+ static
+ QUrl fooBar()
+ {
+ return self()->mFooBar;
+ }
+
+
+ /**
+ Get bar foo
+ */
+ static
+ QList<QUrl> barFoo()
+ {
+ return self()->mBarFoo;
+ }
+
+ protected:
+ Test10();
+ friend class Test10Helper;
+
+
+ // Foo
+ QUrl mFooBar;
+ QList<QUrl> mBarFoo;
+
+ private:
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test10.kcfg b/autotests/kconfig_compiler/test10.kcfg
new file mode 100644
index 00000000..d7be2c3d
--- /dev/null
+++ b/autotests/kconfig_compiler/test10.kcfg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+ <kcfgfile name="test10rc"/>
+
+ <group name="Foo">
+ <entry name="FooBar" key="foo bar" type="Url"/>
+ <entry name="BarFoo" key="bar foo" type="UrlList"/>
+ </group>
+
+</kcfg>
diff --git a/autotests/kconfig_compiler/test10.kcfgc b/autotests/kconfig_compiler/test10.kcfgc
new file mode 100644
index 00000000..83ac2111
--- /dev/null
+++ b/autotests/kconfig_compiler/test10.kcfgc
@@ -0,0 +1,4 @@
+# Code generation options for kconfig_compiler
+File=test10.kcfg
+ClassName=Test10
+Singleton=true
diff --git a/autotests/kconfig_compiler/test10main.cpp b/autotests/kconfig_compiler/test10main.cpp
new file mode 100644
index 00000000..9e9a7db8
--- /dev/null
+++ b/autotests/kconfig_compiler/test10main.cpp
@@ -0,0 +1,32 @@
+/*
+Copyright (c) 2007 Andreas Pakulat <apaku@gmx.de>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include "test10.h"
+#include <QGuiApplication>
+
+int main( int argc, char **argv )
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ Test10 *t = Test10::self();
+ delete t;
+ return 0;
+}
diff --git a/autotests/kconfig_compiler/test11.cpp.ref b/autotests/kconfig_compiler/test11.cpp.ref
new file mode 100644
index 00000000..5a1f5b92
--- /dev/null
+++ b/autotests/kconfig_compiler/test11.cpp.ref
@@ -0,0 +1,278 @@
+// This file is generated by kconfig_compiler from test11.kcfg.
+// All changes you do to this file will be lost.
+
+#include "test11.h"
+
+Test11::Test11( )
+ : MyPrefs( QLatin1String( "korganizerrc" ) )
+{
+ setCurrentGroup( QLatin1String( "General" ) );
+
+ mAutoSaveItem = new MyPrefs::ItemBool( currentGroup(), QLatin1String( "Auto Save" ), mAutoSave, false );
+ mAutoSaveItem->setLabel( QCoreApplication::translate("Test11", "Enable automatic saving of calendar") );
+ mAutoSaveItem->setWhatsThis( QCoreApplication::translate("Test11", "WhatsThis text for AutoSave option") );
+ addItem( mAutoSaveItem, QLatin1String( "AutoSave" ) );
+ mAutoSaveIntervalItem = new MyPrefs::ItemInt( currentGroup(), QLatin1String( "Auto Save Interval" ), mAutoSaveInterval, 10 );
+ mAutoSaveIntervalItem->setLabel( QCoreApplication::translate("Test11", "Auto Save Interval") );
+ addItem( mAutoSaveIntervalItem, QLatin1String( "AutoSaveInterval" ) );
+ mConfirmItem = new MyPrefs::ItemBool( currentGroup(), QLatin1String( "Confirm Deletes" ), mConfirm, true );
+ mConfirmItem->setLabel( QCoreApplication::translate("Test11", "Confirm deletes") );
+ addItem( mConfirmItem, QLatin1String( "Confirm" ) );
+ mArchiveFileItem = new MyPrefs::ItemString( currentGroup(), QLatin1String( "Archive File" ), mArchiveFile );
+ mArchiveFileItem->setLabel( QCoreApplication::translate("Test11", "Archive File") );
+ addItem( mArchiveFileItem, QLatin1String( "ArchiveFile" ) );
+ QList<MyPrefs::ItemEnum::Choice> valuesDestination;
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("standardDestination");
+ valuesDestination.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("askDestination");
+ valuesDestination.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("argl1");
+ choice.label = QCoreApplication::translate("Test11", "Argl1 Label");
+ valuesDestination.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("argl2");
+ choice.whatsThis = QCoreApplication::translate("Test11", "Argl2 Whatsthis");
+ valuesDestination.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("argl3");
+ choice.label = QCoreApplication::translate("Test11", "Argl3 Label");
+ choice.whatsThis = QCoreApplication::translate("Test11", "Argl3 Whatsthis");
+ valuesDestination.append( choice );
+ }
+ mDestinationItem = new MyPrefs::ItemEnum( currentGroup(), QLatin1String( "Destination" ), mDestination, valuesDestination, EnumDestination::standardDestination );
+ mDestinationItem->setLabel( QCoreApplication::translate("Test11", "New Events/Todos Should") );
+ addItem( mDestinationItem, QLatin1String( "Destination" ) );
+
+ setCurrentGroup( QLatin1String( "Views" ) );
+
+ mHourSizeItem = new MyPrefs::ItemInt( currentGroup(), QLatin1String( "Hour Size" ), mHourSize, 10 );
+ mHourSizeItem->setLabel( QCoreApplication::translate("Test11", "Hour Size") );
+ addItem( mHourSizeItem, QLatin1String( "HourSize" ) );
+ mSelectionStartsEditorItem = new MyPrefs::ItemBool( currentGroup(), QLatin1String( "SelectionStartsEditor" ), mSelectionStartsEditor, false );
+ mSelectionStartsEditorItem->setLabel( QCoreApplication::translate("Test11", "Time range selection in agenda view starts event editor") );
+ addItem( mSelectionStartsEditorItem, QLatin1String( "SelectionStartsEditor" ) );
+
+ setCurrentGroup( QLatin1String( "KOrganizer Plugins" ) );
+
+ QStringList defaultSelectedPlugins;
+ defaultSelectedPlugins.append( QString::fromUtf8( "holidays" ) );
+ defaultSelectedPlugins.append( QString::fromUtf8( "webexport" ) );
+
+ mSelectedPluginsItem = new MyPrefs::ItemStringList( currentGroup(), QLatin1String( "SelectedPlugins" ), mSelectedPlugins, defaultSelectedPlugins );
+ mSelectedPluginsItem->setLabel( QCoreApplication::translate("Test11", "SelectedPlugins") );
+ addItem( mSelectedPluginsItem, QLatin1String( "SelectedPlugins" ) );
+
+ setCurrentGroup( QLatin1String( "Colors" ) );
+
+ mHighlightColorItem = new MyPrefs::ItemColor( currentGroup(), QLatin1String( "Highlight Color" ), mHighlightColor, QColor( 100, 100, 255 ) );
+ mHighlightColorItem->setLabel( QCoreApplication::translate("Test11", "Highlight color") );
+ addItem( mHighlightColorItem, QLatin1String( "HighlightColor" ) );
+ mAgendaBgColorItem = new MyPrefs::ItemColor( currentGroup(), QLatin1String( "Agenda Background Color" ), mAgendaBgColor, QColor( 255, 255, 255 ) );
+ mAgendaBgColorItem->setLabel( QCoreApplication::translate("Test11", "Agenda view background color") );
+ addItem( mAgendaBgColorItem, QLatin1String( "AgendaBgColor" ) );
+
+ setCurrentGroup( QLatin1String( "Fonts" ) );
+
+ mTimeBarFontItem = new MyPrefs::ItemFont( currentGroup(), QLatin1String( "TimeBar Font" ), mTimeBarFont );
+ mTimeBarFontItem->setLabel( QCoreApplication::translate("Test11", "Time bar") );
+ addItem( mTimeBarFontItem, QLatin1String( "TimeBarFont" ) );
+
+ setCurrentGroup( QLatin1String( "Email" ) );
+
+ QList<MyPrefs::ItemEnum::Choice> valuesEmailClient;
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("sendmail");
+ choice.label = /*: @option */ QCoreApplication::translate("Test11", "Sendmail");
+ valuesEmailClient.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("kmail");
+ choice.label = /*: @option */ QCoreApplication::translate("Test11", "KMail");
+ valuesEmailClient.append( choice );
+ }
+ mEmailClientItem = new MyPrefs::ItemEnum( currentGroup(), QLatin1String( "EmailClient" ), mEmailClient, valuesEmailClient, kmail );
+ mEmailClientItem->setLabel( /*: @label */ QCoreApplication::translate("Test11", "Email client") );
+ mEmailClientItem->setWhatsThis( /*: @info:whatsthis */ QCoreApplication::translate("Test11", "<para>How to send email when an email alarm is triggered.<list><item>KMail: The email is sent automatically via <application>KMail</application>. <application>KMail</application> is started first if necessary.</item><item>Sendmail: The email is sent automatically. This option will only work if your system is configured to use <application>sendmail</application> or a sendmail compatible mail transport agent.</item></list></para>") );
+ addItem( mEmailClientItem, QLatin1String( "EmailClient" ) );
+ QList<MyPrefs::ItemEnum::Choice> valuesDefaultReminderUnits;
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("Minutes");
+ valuesDefaultReminderUnits.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("HoursMinutes");
+ choice.label = /*: @option */ QCoreApplication::translate("Test11", "Hours/Minutes");
+ valuesDefaultReminderUnits.append( choice );
+ }
+ mDefaultReminderUnitsItem = new MyPrefs::ItemEnum( currentGroup(), QLatin1String( "RemindUnits" ), mDefaultReminderUnits, valuesDefaultReminderUnits, TimePeriod::HoursMinutes );
+ mDefaultReminderUnitsItem->setLabel( /*: @label */ QCoreApplication::translate("Test11", "Reminder units") );
+ mDefaultReminderUnitsItem->setToolTip( /*: @info:tooltip */ QCoreApplication::translate("Test11", "Default reminder time units in the alarm edit dialog.") );
+ mDefaultReminderUnitsItem->setWhatsThis( /*: @info:whatsthis */ QCoreApplication::translate("Test11", "Default reminder time units in the alarm edit dialog.") );
+ addItem( mDefaultReminderUnitsItem, QLatin1String( "DefaultReminderUnits" ) );
+
+ setCurrentGroup( QLatin1String( "QueueRates" ) );
+
+ QList< QList<int> > defaultRate;
+ QList< int > defaultRateInit;
+
+ defaultRateInit.append( 15 );
+ defaultRateInit.append( 60 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+
+ defaultRateInit.clear();
+ defaultRateInit.append( 40 );
+ defaultRateInit.append( 60 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+
+ defaultRateInit.clear();
+ defaultRateInit.append( 1 );
+ defaultRateInit.append( 1 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+
+ QList<int> defaultqueueRate;
+
+ mQueueRateItem[0] = new MyPrefs::ItemIntList( currentGroup(), QLatin1String( "EmptyingRate 0" ), mQueueRate[0], defaultRate[0] );
+ mQueueRateItem[0]->setLabel( QCoreApplication::translate("Test11", "EmptyingRate queueRate$(QueueIndex)") );
+ addItem( mQueueRateItem[0], QLatin1String( "queueRate0" ) );
+ mQueueRateItem[1] = new MyPrefs::ItemIntList( currentGroup(), QLatin1String( "EmptyingRate 1" ), mQueueRate[1], defaultqueueRate );
+ mQueueRateItem[1]->setLabel( QCoreApplication::translate("Test11", "EmptyingRate queueRate$(QueueIndex)") );
+ addItem( mQueueRateItem[1], QLatin1String( "queueRate1" ) );
+ mQueueRateItem[2] = new MyPrefs::ItemIntList( currentGroup(), QLatin1String( "EmptyingRate 2" ), mQueueRate[2], defaultRate[2] );
+ mQueueRateItem[2]->setLabel( QCoreApplication::translate("Test11", "EmptyingRate queueRate$(QueueIndex)") );
+ addItem( mQueueRateItem[2], QLatin1String( "queueRate2" ) );
+ mShowQueueTunerItem = new MyPrefs::ItemBool( currentGroup(), QLatin1String( "ShowQueueTuner" ), mShowQueueTuner, false );
+ mShowQueueTunerItem->setLabel( QCoreApplication::translate("Test11", "ShowQueueTuner") );
+ addItem( mShowQueueTunerItem, QLatin1String( "ShowQueueTuner" ) );
+}
+
+bool Test11::defaultAutoSaveValue_helper() const
+{
+
+ return false;
+}
+
+int Test11::defaultAutoSaveIntervalValue_helper() const
+{
+
+ return 10;
+}
+
+bool Test11::defaultConfirmValue_helper() const
+{
+
+ return true;
+}
+
+int Test11::defaultDestinationValue_helper() const
+{
+
+ return EnumDestination::standardDestination;
+}
+
+int Test11::defaultHourSizeValue_helper() const
+{
+
+ return 10;
+}
+
+bool Test11::defaultSelectionStartsEditorValue_helper() const
+{
+
+ return false;
+}
+
+QStringList Test11::defaultSelectedPluginsValue_helper() const
+{
+ QStringList defaultSelectedPlugins;
+ defaultSelectedPlugins.append( QString::fromUtf8( "holidays" ) );
+ defaultSelectedPlugins.append( QString::fromUtf8( "webexport" ) );
+
+ return defaultSelectedPlugins;
+}
+
+QColor Test11::defaultHighlightColorValue_helper() const
+{
+
+ return QColor( 100, 100, 255 );
+}
+
+QColor Test11::defaultAgendaBgColorValue_helper() const
+{
+
+ return QColor( 255, 255, 255 );
+}
+
+int Test11::defaultEmailClientValue_helper() const
+{
+
+ return kmail;
+}
+
+int Test11::defaultDefaultReminderUnitsValue_helper() const
+{
+
+ return TimePeriod::HoursMinutes;
+}
+
+QList<int> Test11::defaultQueueRateValue_helper( int i ) const
+{
+ QList< QList<int> > defaultRate;
+ QList< int > defaultRateInit;
+
+ defaultRateInit.append( 15 );
+ defaultRateInit.append( 60 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+
+ defaultRateInit.clear();
+ defaultRateInit.append( 40 );
+ defaultRateInit.append( 60 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+
+ defaultRateInit.clear();
+ defaultRateInit.append( 1 );
+ defaultRateInit.append( 1 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+
+ QList<int> defaultqueueRate;
+
+ switch (i) {
+ case 0: return defaultRate[0];
+ case 2: return defaultRate[2];
+ default:
+ return defaultqueueRate;
+ }
+
+}
+
+bool Test11::defaultShowQueueTunerValue_helper() const
+{
+
+ return false;
+}
+
+Test11::~Test11()
+{
+}
+
diff --git a/autotests/kconfig_compiler/test11.h.ref b/autotests/kconfig_compiler/test11.h.ref
new file mode 100644
index 00000000..b5eeb74c
--- /dev/null
+++ b/autotests/kconfig_compiler/test11.h.ref
@@ -0,0 +1,572 @@
+// This file is generated by kconfig_compiler from test11.kcfg.
+// All changes you do to this file will be lost.
+#ifndef TEST11_H
+#define TEST11_H
+
+#include <myprefs.h>
+
+#include <qglobal.h>
+#include <kconfigskeleton.h>
+#include <QCoreApplication>
+#include <QDebug>
+
+#include "test11_types.h"
+class Test11 : public MyPrefs
+{
+ public:
+ class EnumDestination
+ {
+ public:
+ enum type { standardDestination, askDestination, argl1, argl2, argl3, COUNT };
+ };
+ enum MailClient { sendmail, kmail };
+
+ Test11( );
+ ~Test11();
+
+ /**
+ Set Enable automatic saving of calendar
+ */
+ void setAutoSave( bool v )
+ {
+ if (!isImmutable( QString::fromLatin1( "AutoSave" ) ))
+ mAutoSave = v;
+ }
+
+ /**
+ Get Enable automatic saving of calendar
+ */
+ bool autoSave() const
+ {
+ return mAutoSave;
+ }
+
+ /**
+ Get Enable automatic saving of calendar default value
+ */
+ bool defaultAutoSaveValue() const
+ {
+ return defaultAutoSaveValue_helper();
+ }
+
+ /**
+ Get Item object corresponding to AutoSave()
+ */
+ ItemBool *autoSaveItem()
+ {
+ return mAutoSaveItem;
+ }
+
+ /**
+ Set Auto Save Interval
+ */
+ void setAutoSaveInterval( int v )
+ {
+ if (!isImmutable( QString::fromLatin1( "AutoSaveInterval" ) ))
+ mAutoSaveInterval = v;
+ }
+
+ /**
+ Get Auto Save Interval
+ */
+ int autoSaveInterval() const
+ {
+ return mAutoSaveInterval;
+ }
+
+ /**
+ Get Auto Save Interval default value
+ */
+ int defaultAutoSaveIntervalValue() const
+ {
+ return defaultAutoSaveIntervalValue_helper();
+ }
+
+ /**
+ Get Item object corresponding to AutoSaveInterval()
+ */
+ ItemInt *autoSaveIntervalItem()
+ {
+ return mAutoSaveIntervalItem;
+ }
+
+ /**
+ Set Confirm deletes
+ */
+ void setConfirm( bool v )
+ {
+ if (!isImmutable( QString::fromLatin1( "Confirm" ) ))
+ mConfirm = v;
+ }
+
+ /**
+ Get Confirm deletes
+ */
+ bool confirm() const
+ {
+ return mConfirm;
+ }
+
+ /**
+ Get Confirm deletes default value
+ */
+ bool defaultConfirmValue() const
+ {
+ return defaultConfirmValue_helper();
+ }
+
+ /**
+ Get Item object corresponding to Confirm()
+ */
+ ItemBool *confirmItem()
+ {
+ return mConfirmItem;
+ }
+
+ /**
+ Set Archive File
+ */
+ void setArchiveFile( const QString & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "ArchiveFile" ) ))
+ mArchiveFile = v;
+ }
+
+ /**
+ Get Archive File
+ */
+ QString archiveFile() const
+ {
+ return mArchiveFile;
+ }
+
+ /**
+ Get Item object corresponding to ArchiveFile()
+ */
+ ItemString *archiveFileItem()
+ {
+ return mArchiveFileItem;
+ }
+
+ /**
+ Set New Events/Todos Should
+ */
+ void setDestination( EnumDestination::type v )
+ {
+ if (!isImmutable( QString::fromLatin1( "Destination" ) ))
+ mDestination = v;
+ }
+
+ /**
+ Get New Events/Todos Should
+ */
+ EnumDestination::type destination() const
+ {
+ return static_cast<EnumDestination::type>(mDestination);
+ }
+
+ /**
+ Get New Events/Todos Should default value
+ */
+ EnumDestination::type defaultDestinationValue() const
+ {
+ return static_cast<EnumDestination::type>(defaultDestinationValue_helper());
+ }
+
+ /**
+ Get Item object corresponding to Destination()
+ */
+ ItemEnum *destinationItem()
+ {
+ return mDestinationItem;
+ }
+
+ /**
+ Set Hour Size
+ */
+ void setHourSize( int v )
+ {
+ if (!isImmutable( QString::fromLatin1( "HourSize" ) ))
+ mHourSize = v;
+ }
+
+ /**
+ Get Hour Size
+ */
+ int hourSize() const
+ {
+ return mHourSize;
+ }
+
+ /**
+ Get Hour Size default value
+ */
+ int defaultHourSizeValue() const
+ {
+ return defaultHourSizeValue_helper();
+ }
+
+ /**
+ 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( QString::fromLatin1( "SelectionStartsEditor" ) ))
+ mSelectionStartsEditor = v;
+ }
+
+ /**
+ Get Time range selection in agenda view starts event editor
+ */
+ bool selectionStartsEditor() const
+ {
+ return mSelectionStartsEditor;
+ }
+
+ /**
+ Get Time range selection in agenda view starts event editor default value
+ */
+ bool defaultSelectionStartsEditorValue() const
+ {
+ return defaultSelectionStartsEditorValue_helper();
+ }
+
+ /**
+ Get Item object corresponding to SelectionStartsEditor()
+ */
+ ItemBool *selectionStartsEditorItem()
+ {
+ return mSelectionStartsEditorItem;
+ }
+
+ /**
+ Set SelectedPlugins
+ */
+ void setSelectedPlugins( const QStringList & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "SelectedPlugins" ) ))
+ mSelectedPlugins = v;
+ }
+
+ /**
+ Get SelectedPlugins
+ */
+ QStringList selectedPlugins() const
+ {
+ return mSelectedPlugins;
+ }
+
+ /**
+ Get SelectedPlugins default value
+ */
+ QStringList defaultSelectedPluginsValue() const
+ {
+ return defaultSelectedPluginsValue_helper();
+ }
+
+ /**
+ Get Item object corresponding to SelectedPlugins()
+ */
+ ItemStringList *selectedPluginsItem()
+ {
+ return mSelectedPluginsItem;
+ }
+
+ /**
+ Set Highlight color
+ */
+ void setHighlightColor( const QColor & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "HighlightColor" ) ))
+ mHighlightColor = v;
+ }
+
+ /**
+ Get Highlight color
+ */
+ QColor highlightColor() const
+ {
+ return mHighlightColor;
+ }
+
+ /**
+ Get Highlight color default value
+ */
+ QColor defaultHighlightColorValue() const
+ {
+ return defaultHighlightColorValue_helper();
+ }
+
+ /**
+ Get Item object corresponding to HighlightColor()
+ */
+ ItemColor *highlightColorItem()
+ {
+ return mHighlightColorItem;
+ }
+
+ /**
+ Set Agenda view background color
+ */
+ void setAgendaBgColor( const QColor & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "AgendaBgColor" ) ))
+ mAgendaBgColor = v;
+ }
+
+ /**
+ Get Agenda view background color
+ */
+ QColor agendaBgColor() const
+ {
+ return mAgendaBgColor;
+ }
+
+ /**
+ Get Agenda view background color default value
+ */
+ QColor defaultAgendaBgColorValue() const
+ {
+ return defaultAgendaBgColorValue_helper();
+ }
+
+ /**
+ Get Item object corresponding to AgendaBgColor()
+ */
+ ItemColor *agendaBgColorItem()
+ {
+ return mAgendaBgColorItem;
+ }
+
+ /**
+ Set Time bar
+ */
+ void setTimeBarFont( const QFont & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "TimeBarFont" ) ))
+ mTimeBarFont = v;
+ }
+
+ /**
+ Get Time bar
+ */
+ QFont timeBarFont() const
+ {
+ return mTimeBarFont;
+ }
+
+ /**
+ Get Item object corresponding to TimeBarFont()
+ */
+ ItemFont *timeBarFontItem()
+ {
+ return mTimeBarFontItem;
+ }
+
+ /**
+ Set Email client
+ */
+ void setEmailClient( MailClient v )
+ {
+ if (!isImmutable( QString::fromLatin1( "EmailClient" ) ))
+ mEmailClient = v;
+ }
+
+ /**
+ Get Email client
+ */
+ MailClient emailClient() const
+ {
+ return static_cast<MailClient>(mEmailClient);
+ }
+
+ /**
+ Get Email client default value
+ */
+ MailClient defaultEmailClientValue() const
+ {
+ return static_cast<MailClient>(defaultEmailClientValue_helper());
+ }
+
+ /**
+ Get Item object corresponding to EmailClient()
+ */
+ ItemEnum *emailClientItem()
+ {
+ return mEmailClientItem;
+ }
+
+ /**
+ Set Reminder units
+ */
+ void setDefaultReminderUnits( TimePeriod::Units v )
+ {
+ if (!isImmutable( QString::fromLatin1( "DefaultReminderUnits" ) ))
+ mDefaultReminderUnits = v;
+ }
+
+ /**
+ Get Reminder units
+ */
+ TimePeriod::Units defaultReminderUnits() const
+ {
+ return static_cast<TimePeriod::Units>(mDefaultReminderUnits);
+ }
+
+ /**
+ Get Reminder units default value
+ */
+ TimePeriod::Units defaultDefaultReminderUnitsValue() const
+ {
+ return static_cast<TimePeriod::Units>(defaultDefaultReminderUnitsValue_helper());
+ }
+
+ /**
+ Get Item object corresponding to DefaultReminderUnits()
+ */
+ ItemEnum *defaultReminderUnitsItem()
+ {
+ return mDefaultReminderUnitsItem;
+ }
+
+ /**
+ Set EmptyingRate $(QueueIndex)
+ */
+ void setQueueRate( int i, const QList<int> & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "queueRate%1" ).arg( i ) ))
+ mQueueRate[i] = v;
+ }
+
+ /**
+ Get EmptyingRate $(QueueIndex)
+ */
+ QList<int> queueRate( int i ) const
+ {
+ return mQueueRate[i];
+ }
+
+ /**
+ Get EmptyingRate $(QueueIndex) default value
+ */
+ QList<int> defaultQueueRateValue( int i ) const
+ {
+ return defaultQueueRateValue_helper( i );
+ }
+
+ /**
+ Get Item object corresponding to queueRate()
+ */
+ ItemIntList *queueRateItem( int i )
+ {
+ return mQueueRateItem[i];
+ }
+
+ /**
+ Set ShowQueueTuner
+ */
+ void setShowQueueTuner( bool v )
+ {
+ if (!isImmutable( QString::fromLatin1( "ShowQueueTuner" ) ))
+ mShowQueueTuner = v;
+ }
+
+ /**
+ Get ShowQueueTuner
+ */
+ bool showQueueTuner() const
+ {
+ return mShowQueueTuner;
+ }
+
+ /**
+ Get ShowQueueTuner default value
+ */
+ bool defaultShowQueueTunerValue() const
+ {
+ return defaultShowQueueTunerValue_helper();
+ }
+
+ /**
+ Get Item object corresponding to ShowQueueTuner()
+ */
+ ItemBool *showQueueTunerItem()
+ {
+ return mShowQueueTunerItem;
+ }
+
+ protected:
+ public:
+
+ // General
+ bool mAutoSave;
+ bool defaultAutoSaveValue_helper() const;
+ int mAutoSaveInterval;
+ int defaultAutoSaveIntervalValue_helper() const;
+ bool mConfirm;
+ bool defaultConfirmValue_helper() const;
+ QString mArchiveFile;
+ QString defaultArchiveFileValue_helper() const;
+ int mDestination;
+ int defaultDestinationValue_helper() const;
+
+ // Views
+ int mHourSize;
+ int defaultHourSizeValue_helper() const;
+ bool mSelectionStartsEditor;
+ bool defaultSelectionStartsEditorValue_helper() const;
+
+ // KOrganizer Plugins
+ QStringList mSelectedPlugins;
+ QStringList defaultSelectedPluginsValue_helper() const;
+
+ // Colors
+ QColor mHighlightColor;
+ QColor defaultHighlightColorValue_helper() const;
+ QColor mAgendaBgColor;
+ QColor defaultAgendaBgColorValue_helper() const;
+
+ // Fonts
+ QFont mTimeBarFont;
+ QFont defaultTimeBarFontValue_helper() const;
+
+ // Email
+ int mEmailClient;
+ int defaultEmailClientValue_helper() const;
+ int mDefaultReminderUnits;
+ int defaultDefaultReminderUnitsValue_helper() const;
+
+ // QueueRates
+ QList<int> mQueueRate[3];
+ QList<int> defaultQueueRateValue_helper( int i ) const;
+ bool mShowQueueTuner;
+ bool defaultShowQueueTunerValue_helper() const;
+
+ private:
+ ItemBool *mAutoSaveItem;
+ ItemInt *mAutoSaveIntervalItem;
+ ItemBool *mConfirmItem;
+ ItemString *mArchiveFileItem;
+ ItemEnum *mDestinationItem;
+ ItemInt *mHourSizeItem;
+ ItemBool *mSelectionStartsEditorItem;
+ ItemStringList *mSelectedPluginsItem;
+ ItemColor *mHighlightColorItem;
+ ItemColor *mAgendaBgColorItem;
+ ItemFont *mTimeBarFontItem;
+ ItemEnum *mEmailClientItem;
+ ItemEnum *mDefaultReminderUnitsItem;
+ ItemIntList *mQueueRateItem[3];
+ ItemBool *mShowQueueTunerItem;
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test11.kcfg b/autotests/kconfig_compiler/test11.kcfg
new file mode 100644
index 00000000..d82e1326
--- /dev/null
+++ b/autotests/kconfig_compiler/test11.kcfg
@@ -0,0 +1,136 @@
+<?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>"test11_types.h"</include>
+
+ <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>
+
+ <group name="Email">
+ <entry name="EmailClient" key="EmailClient" type="Enum">
+ <label context="@label">Email client</label>
+ <whatsthis context="@info:whatsthis">&lt;para>How to send email when an email alarm is triggered.&lt;list>&lt;item>KMail: The email is sent automatically via &lt;application>KMail&lt;/application>. &lt;application>KMail&lt;/application> is started first if necessary.&lt;/item>&lt;item>Sendmail: The email is sent automatically. This option will only work if your system is configured to use &lt;application>sendmail&lt;/application> or a sendmail compatible mail transport agent.&lt;/item>&lt;/list>&lt;/para></whatsthis>
+ <choices name="MailClient">
+ <choice name="sendmail"><label context="@option">Sendmail</label></choice>
+ <choice name="kmail"><label context="@option">KMail</label></choice>
+ </choices>
+ <default>kmail</default>
+ </entry>
+
+ <entry name="DefaultReminderUnits" key="RemindUnits" type="Enum">
+ <label context="@label">Reminder units</label>
+ <whatsthis context="@info:whatsthis">Default reminder time units in the alarm edit dialog.</whatsthis>
+ <tooltip context="@info:tooltip">Default reminder time units in the alarm edit dialog.</tooltip>
+ <choices name="TimePeriod::Units">
+ <choice name="Minutes"></choice>
+ <choice name="HoursMinutes"><label context="@option">Hours/Minutes</label></choice>
+ </choices>
+ <default>HoursMinutes</default>
+ </entry>
+ </group>
+
+ <group name="QueueRates">
+ <entry name="queueRate$(QueueIndex)" type="IntList" key="EmptyingRate $(QueueIndex)">
+ <!-- kconfig_compiler really should do this for me... -->
+ <code> QList&lt; QList&lt;int&gt; &gt; defaultRate;
+ QList&lt; int &gt; defaultRateInit;
+
+ defaultRateInit.append( 15 );
+ defaultRateInit.append( 60 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+
+ defaultRateInit.clear();
+ defaultRateInit.append( 40 );
+ defaultRateInit.append( 60 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+
+ defaultRateInit.clear();
+ defaultRateInit.append( 1 );
+ defaultRateInit.append( 1 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+ </code>
+ <parameter name="QueueIndex" type="Int" max="2"/>
+ <default param="0" code="true">defaultRate[0]</default>
+ <default param="2" code="true">defaultRate[2]</default>
+ </entry>
+ <entry key="ShowQueueTuner" type="Bool">
+ <default>false</default>
+ </entry>
+ </group>
+
+</kcfg>
diff --git a/autotests/kconfig_compiler/test11.kcfgc b/autotests/kconfig_compiler/test11.kcfgc
new file mode 100644
index 00000000..2b6fee15
--- /dev/null
+++ b/autotests/kconfig_compiler/test11.kcfgc
@@ -0,0 +1,13 @@
+# Code generation options for kconfig_compiler
+File=test11.kcfg
+ClassName=Test11
+Singleton=false
+Mutators=true
+Inherits=MyPrefs
+IncludeFiles=myprefs.h
+MemberVariables=public
+GlobalEnums=false
+ItemAccessors=true
+SetUserTexts=true
+UseEnumTypes=true
+DefaultValueGetters=true
diff --git a/autotests/kconfig_compiler/test11_types.h b/autotests/kconfig_compiler/test11_types.h
new file mode 100644
index 00000000..5b21aa97
--- /dev/null
+++ b/autotests/kconfig_compiler/test11_types.h
@@ -0,0 +1,31 @@
+/*
+Copyright (c) 2009 Pino Toscano <pino@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.
+*/
+
+#ifndef TEST11_TYPES_H
+#define TEST11_TYPES_H
+
+class TimePeriod
+{
+public:
+ enum Units { Minutes, HoursMinutes, Days, Weeks };
+};
+
+#endif
diff --git a/autotests/kconfig_compiler/test11a.cpp.ref b/autotests/kconfig_compiler/test11a.cpp.ref
new file mode 100644
index 00000000..f826fc16
--- /dev/null
+++ b/autotests/kconfig_compiler/test11a.cpp.ref
@@ -0,0 +1,187 @@
+// This file is generated by kconfig_compiler from test11a.kcfg.
+// All changes you do to this file will be lost.
+
+#include "test11a.h"
+
+Test11a::Test11a( )
+ : MyPrefs( QLatin1String( "korganizerrc" ) )
+{
+ setCurrentGroup( QLatin1String( "General" ) );
+
+ mAutoSaveItem = new MyPrefs::ItemBool( currentGroup(), QLatin1String( "Auto Save" ), mAutoSave, false );
+ mAutoSaveItem->setLabel( QCoreApplication::translate("Test11a", "Enable automatic saving of calendar") );
+ mAutoSaveItem->setWhatsThis( QCoreApplication::translate("Test11a", "WhatsThis text for AutoSave option") );
+ addItem( mAutoSaveItem, QLatin1String( "AutoSave" ) );
+ mAutoSaveIntervalItem = new MyPrefs::ItemInt( currentGroup(), QLatin1String( "Auto Save Interval" ), mAutoSaveInterval, 10 );
+ mAutoSaveIntervalItem->setLabel( QCoreApplication::translate("Test11a", "Auto Save Interval") );
+ addItem( mAutoSaveIntervalItem, QLatin1String( "AutoSaveInterval" ) );
+ mConfirmItem = new MyPrefs::ItemBool( currentGroup(), QLatin1String( "Confirm Deletes" ), mConfirm, true );
+ mConfirmItem->setLabel( QCoreApplication::translate("Test11a", "Confirm deletes") );
+ addItem( mConfirmItem, QLatin1String( "Confirm" ) );
+ mArchiveFileItem = new MyPrefs::ItemString( currentGroup(), QLatin1String( "Archive File" ), mArchiveFile );
+ mArchiveFileItem->setLabel( QCoreApplication::translate("Test11a", "Archive File") );
+ addItem( mArchiveFileItem, QLatin1String( "ArchiveFile" ) );
+ QList<MyPrefs::ItemEnum::Choice> valuesDestination;
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("standardDestination");
+ valuesDestination.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("askDestination");
+ valuesDestination.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("argl1");
+ choice.label = QCoreApplication::translate("Test11a", "Argl1 Label");
+ valuesDestination.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("argl2");
+ choice.whatsThis = QCoreApplication::translate("Test11a", "Argl2 Whatsthis");
+ valuesDestination.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("argl3");
+ choice.label = QCoreApplication::translate("Test11a", "Argl3 Label");
+ choice.whatsThis = QCoreApplication::translate("Test11a", "Argl3 Whatsthis");
+ valuesDestination.append( choice );
+ }
+ mDestinationItem = new MyPrefs::ItemEnum( currentGroup(), QLatin1String( "Destination" ), mDestination, valuesDestination, EnumDestination::standardDestination );
+ mDestinationItem->setLabel( QCoreApplication::translate("Test11a", "New Events/Todos Should") );
+ addItem( mDestinationItem, QLatin1String( "Destination" ) );
+
+ setCurrentGroup( QLatin1String( "Views" ) );
+
+ mHourSizeItem = new MyPrefs::ItemInt( currentGroup(), QLatin1String( "Hour Size" ), mHourSize, 10 );
+ mHourSizeItem->setLabel( QCoreApplication::translate("Test11a", "Hour Size") );
+ addItem( mHourSizeItem, QLatin1String( "HourSize" ) );
+ mSelectionStartsEditorItem = new MyPrefs::ItemBool( currentGroup(), QLatin1String( "SelectionStartsEditor" ), mSelectionStartsEditor, false );
+ mSelectionStartsEditorItem->setLabel( QCoreApplication::translate("Test11a", "Time range selection in agenda view starts event editor") );
+ addItem( mSelectionStartsEditorItem, QLatin1String( "SelectionStartsEditor" ) );
+
+ setCurrentGroup( QLatin1String( "KOrganizer Plugins" ) );
+
+ QStringList defaultSelectedPlugins;
+ defaultSelectedPlugins.append( QString::fromUtf8( "holidays" ) );
+ defaultSelectedPlugins.append( QString::fromUtf8( "webexport" ) );
+
+ mSelectedPluginsItem = new MyPrefs::ItemStringList( currentGroup(), QLatin1String( "SelectedPlugins" ), mSelectedPlugins, defaultSelectedPlugins );
+ mSelectedPluginsItem->setLabel( QCoreApplication::translate("Test11a", "SelectedPlugins") );
+ addItem( mSelectedPluginsItem, QLatin1String( "SelectedPlugins" ) );
+
+ setCurrentGroup( QLatin1String( "Colors" ) );
+
+ mHighlightColorItem = new MyPrefs::ItemColor( currentGroup(), QLatin1String( "Highlight Color" ), mHighlightColor, QColor( 100, 100, 255 ) );
+ mHighlightColorItem->setLabel( QCoreApplication::translate("Test11a", "Highlight color") );
+ addItem( mHighlightColorItem, QLatin1String( "HighlightColor" ) );
+ mAgendaBgColorItem = new MyPrefs::ItemColor( currentGroup(), QLatin1String( "Agenda Background Color" ), mAgendaBgColor, QColor( 255, 255, 255 ) );
+ mAgendaBgColorItem->setLabel( QCoreApplication::translate("Test11a", "Agenda view background color") );
+ addItem( mAgendaBgColorItem, QLatin1String( "AgendaBgColor" ) );
+
+ setCurrentGroup( QLatin1String( "Fonts" ) );
+
+ mTimeBarFontItem = new MyPrefs::ItemFont( currentGroup(), QLatin1String( "TimeBar Font" ), mTimeBarFont );
+ mTimeBarFontItem->setLabel( QCoreApplication::translate("Test11a", "Time bar") );
+ addItem( mTimeBarFontItem, QLatin1String( "TimeBarFont" ) );
+
+ setCurrentGroup( QLatin1String( "Email" ) );
+
+ QList<MyPrefs::ItemEnum::Choice> valuesEmailClient;
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("sendmail");
+ choice.label = /*: @option */ QCoreApplication::translate("Test11a", "Sendmail");
+ valuesEmailClient.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("kmail");
+ choice.label = /*: @option */ QCoreApplication::translate("Test11a", "KMail");
+ valuesEmailClient.append( choice );
+ }
+ mEmailClientItem = new MyPrefs::ItemEnum( currentGroup(), QLatin1String( "EmailClient" ), mEmailClient, valuesEmailClient, kmail );
+ mEmailClientItem->setLabel( /*: @label */ QCoreApplication::translate("Test11a", "Email client") );
+ mEmailClientItem->setWhatsThis( /*: @info:whatsthis */ QCoreApplication::translate("Test11a", "<para>How to send email when an email alarm is triggered.<list><item>KMail: The email is sent automatically via <application>KMail</application>. <application>KMail</application> is started first if necessary.</item><item>Sendmail: The email is sent automatically. This option will only work if your system is configured to use <application>sendmail</application> or a sendmail compatible mail transport agent.</item></list></para>") );
+ addItem( mEmailClientItem, QLatin1String( "EmailClient" ) );
+ QList<MyPrefs::ItemEnum::Choice> valuesDefaultReminderUnits;
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("Minutes");
+ valuesDefaultReminderUnits.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("HoursMinutes");
+ choice.label = /*: @option */ QCoreApplication::translate("Test11a", "Hours/Minutes");
+ valuesDefaultReminderUnits.append( choice );
+ }
+ mDefaultReminderUnitsItem = new MyPrefs::ItemEnum( currentGroup(), QLatin1String( "RemindUnits" ), mDefaultReminderUnits, valuesDefaultReminderUnits, TimePeriod::HoursMinutes );
+ mDefaultReminderUnitsItem->setLabel( /*: @label */ QCoreApplication::translate("Test11a", "Reminder units") );
+ mDefaultReminderUnitsItem->setWhatsThis( /*: @info:whatsthis */ QCoreApplication::translate("Test11a", "Default reminder time units in the alarm edit dialog.") );
+ addItem( mDefaultReminderUnitsItem, QLatin1String( "DefaultReminderUnits" ) );
+
+ setCurrentGroup( QLatin1String( "QueueRates" ) );
+
+ QList< QList<int> > defaultRate;
+ QList< int > defaultRateInit;
+
+ defaultRateInit.append( 15 );
+ defaultRateInit.append( 60 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+
+ defaultRateInit.clear();
+ defaultRateInit.append( 40 );
+ defaultRateInit.append( 60 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+
+ defaultRateInit.clear();
+ defaultRateInit.append( 1 );
+ defaultRateInit.append( 1 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+
+ QList<int> defaultqueueRate;
+
+ mQueueRateItem[0] = new MyPrefs::ItemIntList( currentGroup(), QLatin1String( "EmptyingRate 0" ), mQueueRate[0], defaultRate[0] );
+ mQueueRateItem[0]->setLabel( QCoreApplication::translate("Test11a", "EmptyingRate queueRate$(QueueIndex)") );
+ addItem( mQueueRateItem[0], QLatin1String( "queueRate0" ) );
+ mQueueRateItem[1] = new MyPrefs::ItemIntList( currentGroup(), QLatin1String( "EmptyingRate 1" ), mQueueRate[1], defaultqueueRate );
+ mQueueRateItem[1]->setLabel( QCoreApplication::translate("Test11a", "EmptyingRate queueRate$(QueueIndex)") );
+ addItem( mQueueRateItem[1], QLatin1String( "queueRate1" ) );
+ mQueueRateItem[2] = new MyPrefs::ItemIntList( currentGroup(), QLatin1String( "EmptyingRate 2" ), mQueueRate[2], defaultRate[2] );
+ mQueueRateItem[2]->setLabel( QCoreApplication::translate("Test11a", "EmptyingRate queueRate$(QueueIndex)") );
+ addItem( mQueueRateItem[2], QLatin1String( "queueRate2" ) );
+ mShowQueueTunerItem = new MyPrefs::ItemBool( currentGroup(), QLatin1String( "ShowQueueTuner" ), mShowQueueTuner, false );
+ mShowQueueTunerItem->setLabel( QCoreApplication::translate("Test11a", "ShowQueueTuner") );
+ addItem( mShowQueueTunerItem, QLatin1String( "ShowQueueTuner" ) );
+}
+
+int Test11a::defaultDestinationValue_helper() const
+{
+
+ return EnumDestination::standardDestination;
+}
+
+bool Test11a::defaultSelectionStartsEditorValue_helper() const
+{
+
+ return false;
+}
+
+int Test11a::defaultDefaultReminderUnitsValue_helper() const
+{
+
+ return TimePeriod::HoursMinutes;
+}
+
+Test11a::~Test11a()
+{
+}
+
diff --git a/autotests/kconfig_compiler/test11a.h.ref b/autotests/kconfig_compiler/test11a.h.ref
new file mode 100644
index 00000000..4410ce29
--- /dev/null
+++ b/autotests/kconfig_compiler/test11a.h.ref
@@ -0,0 +1,480 @@
+// This file is generated by kconfig_compiler from test11a.kcfg.
+// All changes you do to this file will be lost.
+#ifndef TEST11A_H
+#define TEST11A_H
+
+#include <myprefs.h>
+
+#include <qglobal.h>
+#include <kconfigskeleton.h>
+#include <QCoreApplication>
+#include <QDebug>
+
+#include "test11_types.h"
+class Test11a : public MyPrefs
+{
+ public:
+ class EnumDestination
+ {
+ public:
+ enum type { standardDestination, askDestination, argl1, argl2, argl3, COUNT };
+ };
+ enum MailClient { sendmail, kmail };
+
+ Test11a( );
+ ~Test11a();
+
+ /**
+ Set Enable automatic saving of calendar
+ */
+ void setAutoSave( bool v )
+ {
+ if (!isImmutable( QString::fromLatin1( "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( QString::fromLatin1( "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( QString::fromLatin1( "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 QString & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "ArchiveFile" ) ))
+ mArchiveFile = v;
+ }
+
+ /**
+ Get Archive File
+ */
+ QString archiveFile() const
+ {
+ return mArchiveFile;
+ }
+
+ /**
+ Get Item object corresponding to ArchiveFile()
+ */
+ ItemString *archiveFileItem()
+ {
+ return mArchiveFileItem;
+ }
+
+ /**
+ Set New Events/Todos Should
+ */
+ void setDestination( EnumDestination::type v )
+ {
+ if (!isImmutable( QString::fromLatin1( "Destination" ) ))
+ mDestination = v;
+ }
+
+ /**
+ Get New Events/Todos Should
+ */
+ EnumDestination::type destination() const
+ {
+ return static_cast<EnumDestination::type>(mDestination);
+ }
+
+ /**
+ Get New Events/Todos Should default value
+ */
+ EnumDestination::type defaultDestinationValue() const
+ {
+ return static_cast<EnumDestination::type>(defaultDestinationValue_helper());
+ }
+
+ /**
+ Get Item object corresponding to Destination()
+ */
+ ItemEnum *destinationItem()
+ {
+ return mDestinationItem;
+ }
+
+ /**
+ Set Hour Size
+ */
+ void setHourSize( int v )
+ {
+ if (!isImmutable( QString::fromLatin1( "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( QString::fromLatin1( "SelectionStartsEditor" ) ))
+ mSelectionStartsEditor = v;
+ }
+
+ /**
+ Get Time range selection in agenda view starts event editor
+ */
+ bool selectionStartsEditor() const
+ {
+ return mSelectionStartsEditor;
+ }
+
+ /**
+ Get Time range selection in agenda view starts event editor default value
+ */
+ bool defaultSelectionStartsEditorValue() const
+ {
+ return defaultSelectionStartsEditorValue_helper();
+ }
+
+ /**
+ Get Item object corresponding to SelectionStartsEditor()
+ */
+ ItemBool *selectionStartsEditorItem()
+ {
+ return mSelectionStartsEditorItem;
+ }
+
+ /**
+ Set SelectedPlugins
+ */
+ void setSelectedPlugins( const QStringList & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "SelectedPlugins" ) ))
+ mSelectedPlugins = v;
+ }
+
+ /**
+ Get SelectedPlugins
+ */
+ QStringList selectedPlugins() const
+ {
+ return mSelectedPlugins;
+ }
+
+ /**
+ Get Item object corresponding to SelectedPlugins()
+ */
+ ItemStringList *selectedPluginsItem()
+ {
+ return mSelectedPluginsItem;
+ }
+
+ /**
+ Set Highlight color
+ */
+ void setHighlightColor( const QColor & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "HighlightColor" ) ))
+ mHighlightColor = v;
+ }
+
+ /**
+ Get Highlight color
+ */
+ QColor highlightColor() const
+ {
+ return mHighlightColor;
+ }
+
+ /**
+ Get Item object corresponding to HighlightColor()
+ */
+ ItemColor *highlightColorItem()
+ {
+ return mHighlightColorItem;
+ }
+
+ /**
+ Set Agenda view background color
+ */
+ void setAgendaBgColor( const QColor & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "AgendaBgColor" ) ))
+ mAgendaBgColor = v;
+ }
+
+ /**
+ Get Agenda view background color
+ */
+ QColor agendaBgColor() const
+ {
+ return mAgendaBgColor;
+ }
+
+ /**
+ Get Item object corresponding to AgendaBgColor()
+ */
+ ItemColor *agendaBgColorItem()
+ {
+ return mAgendaBgColorItem;
+ }
+
+ /**
+ Set Time bar
+ */
+ void setTimeBarFont( const QFont & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "TimeBarFont" ) ))
+ mTimeBarFont = v;
+ }
+
+ /**
+ Get Time bar
+ */
+ QFont timeBarFont() const
+ {
+ return mTimeBarFont;
+ }
+
+ /**
+ Get Item object corresponding to TimeBarFont()
+ */
+ ItemFont *timeBarFontItem()
+ {
+ return mTimeBarFontItem;
+ }
+
+ /**
+ Set Email client
+ */
+ void setEmailClient( MailClient v )
+ {
+ if (!isImmutable( QString::fromLatin1( "EmailClient" ) ))
+ mEmailClient = v;
+ }
+
+ /**
+ Get Email client
+ */
+ MailClient emailClient() const
+ {
+ return static_cast<MailClient>(mEmailClient);
+ }
+
+ /**
+ Get Item object corresponding to EmailClient()
+ */
+ ItemEnum *emailClientItem()
+ {
+ return mEmailClientItem;
+ }
+
+ /**
+ Set Reminder units
+ */
+ void setDefaultReminderUnits( TimePeriod::Units v )
+ {
+ if (!isImmutable( QString::fromLatin1( "DefaultReminderUnits" ) ))
+ mDefaultReminderUnits = v;
+ }
+
+ /**
+ Get Reminder units
+ */
+ TimePeriod::Units defaultReminderUnits() const
+ {
+ return static_cast<TimePeriod::Units>(mDefaultReminderUnits);
+ }
+
+ /**
+ Get Reminder units default value
+ */
+ TimePeriod::Units defaultDefaultReminderUnitsValue() const
+ {
+ return static_cast<TimePeriod::Units>(defaultDefaultReminderUnitsValue_helper());
+ }
+
+ /**
+ Get Item object corresponding to DefaultReminderUnits()
+ */
+ ItemEnum *defaultReminderUnitsItem()
+ {
+ return mDefaultReminderUnitsItem;
+ }
+
+ /**
+ Set EmptyingRate $(QueueIndex)
+ */
+ void setQueueRate( int i, const QList<int> & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "queueRate%1" ).arg( i ) ))
+ mQueueRate[i] = v;
+ }
+
+ /**
+ Get EmptyingRate $(QueueIndex)
+ */
+ QList<int> queueRate( int i ) const
+ {
+ return mQueueRate[i];
+ }
+
+ /**
+ Get Item object corresponding to queueRate()
+ */
+ ItemIntList *queueRateItem( int i )
+ {
+ return mQueueRateItem[i];
+ }
+
+ /**
+ Set ShowQueueTuner
+ */
+ void setShowQueueTuner( bool v )
+ {
+ if (!isImmutable( QString::fromLatin1( "ShowQueueTuner" ) ))
+ mShowQueueTuner = v;
+ }
+
+ /**
+ Get ShowQueueTuner
+ */
+ bool showQueueTuner() const
+ {
+ return mShowQueueTuner;
+ }
+
+ /**
+ Get Item object corresponding to ShowQueueTuner()
+ */
+ ItemBool *showQueueTunerItem()
+ {
+ return mShowQueueTunerItem;
+ }
+
+ protected:
+ public:
+
+ // General
+ bool mAutoSave;
+ int mAutoSaveInterval;
+ bool mConfirm;
+ QString mArchiveFile;
+ int mDestination;
+ int defaultDestinationValue_helper() const;
+
+ // Views
+ int mHourSize;
+ bool mSelectionStartsEditor;
+ bool defaultSelectionStartsEditorValue_helper() const;
+
+ // KOrganizer Plugins
+ QStringList mSelectedPlugins;
+
+ // Colors
+ QColor mHighlightColor;
+ QColor mAgendaBgColor;
+
+ // Fonts
+ QFont mTimeBarFont;
+
+ // Email
+ int mEmailClient;
+ int mDefaultReminderUnits;
+ int defaultDefaultReminderUnitsValue_helper() const;
+
+ // QueueRates
+ QList<int> mQueueRate[3];
+ bool mShowQueueTuner;
+
+ private:
+ ItemBool *mAutoSaveItem;
+ ItemInt *mAutoSaveIntervalItem;
+ ItemBool *mConfirmItem;
+ ItemString *mArchiveFileItem;
+ ItemEnum *mDestinationItem;
+ ItemInt *mHourSizeItem;
+ ItemBool *mSelectionStartsEditorItem;
+ ItemStringList *mSelectedPluginsItem;
+ ItemColor *mHighlightColorItem;
+ ItemColor *mAgendaBgColorItem;
+ ItemFont *mTimeBarFontItem;
+ ItemEnum *mEmailClientItem;
+ ItemEnum *mDefaultReminderUnitsItem;
+ ItemIntList *mQueueRateItem[3];
+ ItemBool *mShowQueueTunerItem;
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test11a.kcfg b/autotests/kconfig_compiler/test11a.kcfg
new file mode 100644
index 00000000..da027067
--- /dev/null
+++ b/autotests/kconfig_compiler/test11a.kcfg
@@ -0,0 +1,135 @@
+<?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>"test11_types.h"</include>
+
+ <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>
+
+ <group name="Email">
+ <entry name="EmailClient" key="EmailClient" type="Enum">
+ <label context="@label">Email client</label>
+ <whatsthis context="@info:whatsthis">&lt;para>How to send email when an email alarm is triggered.&lt;list>&lt;item>KMail: The email is sent automatically via &lt;application>KMail&lt;/application>. &lt;application>KMail&lt;/application> is started first if necessary.&lt;/item>&lt;item>Sendmail: The email is sent automatically. This option will only work if your system is configured to use &lt;application>sendmail&lt;/application> or a sendmail compatible mail transport agent.&lt;/item>&lt;/list>&lt;/para></whatsthis>
+ <choices name="MailClient">
+ <choice name="sendmail"><label context="@option">Sendmail</label></choice>
+ <choice name="kmail"><label context="@option">KMail</label></choice>
+ </choices>
+ <default>kmail</default>
+ </entry>
+
+ <entry name="DefaultReminderUnits" key="RemindUnits" type="Enum">
+ <label context="@label">Reminder units</label>
+ <whatsthis context="@info:whatsthis">Default reminder time units in the alarm edit dialog.</whatsthis>
+ <choices name="TimePeriod::Units">
+ <choice name="Minutes"></choice>
+ <choice name="HoursMinutes"><label context="@option">Hours/Minutes</label></choice>
+ </choices>
+ <default>HoursMinutes</default>
+ </entry>
+ </group>
+
+ <group name="QueueRates">
+ <entry name="queueRate$(QueueIndex)" type="IntList" key="EmptyingRate $(QueueIndex)">
+ <!-- kconfig_compiler really should do this for me... -->
+ <code> QList&lt; QList&lt;int&gt; &gt; defaultRate;
+ QList&lt; int &gt; defaultRateInit;
+
+ defaultRateInit.append( 15 );
+ defaultRateInit.append( 60 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+
+ defaultRateInit.clear();
+ defaultRateInit.append( 40 );
+ defaultRateInit.append( 60 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+
+ defaultRateInit.clear();
+ defaultRateInit.append( 1 );
+ defaultRateInit.append( 1 );
+ defaultRateInit.append( 0 );
+ defaultRate.append( defaultRateInit );
+ </code>
+ <parameter name="QueueIndex" type="Int" max="2"/>
+ <default param="0" code="true">defaultRate[0]</default>
+ <default param="2" code="true">defaultRate[2]</default>
+ </entry>
+ <entry key="ShowQueueTuner" type="Bool">
+ <default>false</default>
+ </entry>
+ </group>
+
+</kcfg>
diff --git a/autotests/kconfig_compiler/test11a.kcfgc b/autotests/kconfig_compiler/test11a.kcfgc
new file mode 100644
index 00000000..cf0b0d8d
--- /dev/null
+++ b/autotests/kconfig_compiler/test11a.kcfgc
@@ -0,0 +1,13 @@
+# Code generation options for kconfig_compiler
+File=test11a.kcfg
+ClassName=Test11a
+Singleton=false
+Mutators=true
+Inherits=MyPrefs
+IncludeFiles=myprefs.h
+MemberVariables=public
+GlobalEnums=false
+ItemAccessors=true
+SetUserTexts=true
+UseEnumTypes=true
+DefaultValueGetters=Destination,SelectionStartsEditor,DefaultReminderUnits
diff --git a/autotests/kconfig_compiler/test11main.cpp b/autotests/kconfig_compiler/test11main.cpp
new file mode 100644
index 00000000..4f5fc80c
--- /dev/null
+++ b/autotests/kconfig_compiler/test11main.cpp
@@ -0,0 +1,34 @@
+/*
+Copyright (c) 2009 Pino Toscano <pino@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 "test11.h"
+#include "test11a.h"
+#include <QGuiApplication>
+
+int main( int argc, char **argv )
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ Test11 *t = new Test11();
+ Test11a *t2 = new Test11a();
+ delete t;
+ delete t2;
+ return 0;
+}
diff --git a/autotests/kconfig_compiler/test12.cpp.ref b/autotests/kconfig_compiler/test12.cpp.ref
new file mode 100644
index 00000000..69d5bba9
--- /dev/null
+++ b/autotests/kconfig_compiler/test12.cpp.ref
@@ -0,0 +1,22 @@
+// This file is generated by kconfig_compiler from test12.kcfg.
+// All changes you do to this file will be lost.
+
+#include "test12.h"
+
+Test12::Test12( )
+ : KConfigSkeleton( QLatin1String( "muondatasourcesrc" ) )
+{
+ setCurrentGroup( QLatin1String( "muon" ) );
+
+ QList<QUrl> defaultRnRSource;
+ defaultRnRSource.append( QUrl::fromUserInput(QString::fromUtf8( "http://kde.org" ) ) );
+
+ KConfigSkeleton::ItemUrlList *itemRnRSource;
+ itemRnRSource = new KConfigSkeleton::ItemUrlList( currentGroup(), QLatin1String( "RnRSource" ), mRnRSource, defaultRnRSource );
+ addItem( itemRnRSource, QLatin1String( "RnRSource" ) );
+}
+
+Test12::~Test12()
+{
+}
+
diff --git a/autotests/kconfig_compiler/test12.h.ref b/autotests/kconfig_compiler/test12.h.ref
new file mode 100644
index 00000000..d55414ec
--- /dev/null
+++ b/autotests/kconfig_compiler/test12.h.ref
@@ -0,0 +1,36 @@
+// This file is generated by kconfig_compiler from test12.kcfg.
+// All changes you do to this file will be lost.
+#ifndef TEST12_H
+#define TEST12_H
+
+#include <qglobal.h>
+#include <kconfigskeleton.h>
+#include <QCoreApplication>
+#include <QDebug>
+
+class Test12 : public KConfigSkeleton
+{
+ public:
+
+ Test12( );
+ ~Test12();
+
+
+ /**
+ Get RnRSource
+ */
+ QList<QUrl> rnRSource() const
+ {
+ return mRnRSource;
+ }
+
+ protected:
+
+ // muon
+ QList<QUrl> mRnRSource;
+
+ private:
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test12.kcfg b/autotests/kconfig_compiler/test12.kcfg
new file mode 100644
index 00000000..57663ab9
--- /dev/null
+++ b/autotests/kconfig_compiler/test12.kcfg
@@ -0,0 +1,10 @@
+<?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="muondatasourcesrc"/>
+ <group name="muon">
+ <entry name="RnRSource" type="UrlList"><default>http://kde.org</default></entry>
+ </group>
+</kcfg>
diff --git a/autotests/kconfig_compiler/test12.kcfgc b/autotests/kconfig_compiler/test12.kcfgc
new file mode 100644
index 00000000..1ed82e7e
--- /dev/null
+++ b/autotests/kconfig_compiler/test12.kcfgc
@@ -0,0 +1 @@
+ClassName=Test12
diff --git a/autotests/kconfig_compiler/test12main.cpp b/autotests/kconfig_compiler/test12main.cpp
new file mode 100644
index 00000000..b8a05294
--- /dev/null
+++ b/autotests/kconfig_compiler/test12main.cpp
@@ -0,0 +1,28 @@
+/*
+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 "test12.h"
+
+int main( int, char** )
+{
+ Test12 *t = new Test12();
+ delete t;
+ return 0;
+}
diff --git a/autotests/kconfig_compiler/test1main.cpp b/autotests/kconfig_compiler/test1main.cpp
new file mode 100644
index 00000000..f1f61c0a
--- /dev/null
+++ b/autotests/kconfig_compiler/test1main.cpp
@@ -0,0 +1,31 @@
+/*
+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 <QGuiApplication>
+
+int main( int argc, char **argv )
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ Test1 *t = new Test1( QString(), QString() );
+ delete t;
+ return 0;
+}
diff --git a/autotests/kconfig_compiler/test2.cpp.ref b/autotests/kconfig_compiler/test2.cpp.ref
new file mode 100644
index 00000000..476b34c5
--- /dev/null
+++ b/autotests/kconfig_compiler/test2.cpp.ref
@@ -0,0 +1,96 @@
+// This file is generated by kconfig_compiler from test2.kcfg.
+// All changes you do to this file will be lost.
+
+#include "test2.h"
+
+Test2::Test2( )
+ : MyPrefs( QLatin1String( "korganizerrc" ) )
+{
+ setCurrentGroup( QLatin1String( "General" ) );
+
+ mAutoSaveItem = new MyPrefs::ItemBool( currentGroup(), QLatin1String( "Auto Save" ), mAutoSave, false );
+ mAutoSaveItem->setLabel( QCoreApplication::translate("Test2", "Enable automatic saving of calendar") );
+ mAutoSaveItem->setWhatsThis( QCoreApplication::translate("Test2", "WhatsThis text for AutoSave option") );
+ addItem( mAutoSaveItem, QLatin1String( "AutoSave" ) );
+ mAutoSaveIntervalItem = new MyPrefs::ItemInt( currentGroup(), QLatin1String( "Auto Save Interval" ), mAutoSaveInterval, 10 );
+ mAutoSaveIntervalItem->setLabel( QCoreApplication::translate("Test2", "Auto Save Interval") );
+ addItem( mAutoSaveIntervalItem, QLatin1String( "AutoSaveInterval" ) );
+ mConfirmItem = new MyPrefs::ItemBool( currentGroup(), QLatin1String( "Confirm Deletes" ), mConfirm, true );
+ mConfirmItem->setLabel( QCoreApplication::translate("Test2", "Confirm deletes") );
+ addItem( mConfirmItem, QLatin1String( "Confirm" ) );
+ mArchiveFileItem = new MyPrefs::ItemString( currentGroup(), QLatin1String( "Archive File" ), mArchiveFile );
+ mArchiveFileItem->setLabel( QCoreApplication::translate("Test2", "Archive File") );
+ addItem( mArchiveFileItem, QLatin1String( "ArchiveFile" ) );
+ QList<MyPrefs::ItemEnum::Choice> valuesDestination;
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("standardDestination");
+ valuesDestination.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("askDestination");
+ valuesDestination.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("argl1");
+ choice.label = QCoreApplication::translate("Test2", "Argl1 Label");
+ valuesDestination.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("argl2");
+ choice.whatsThis = QCoreApplication::translate("Test2", "Argl2 Whatsthis");
+ valuesDestination.append( choice );
+ }
+ {
+ MyPrefs::ItemEnum::Choice choice;
+ choice.name = QLatin1String("argl3");
+ choice.label = QCoreApplication::translate("Test2", "Argl3 Label");
+ choice.whatsThis = QCoreApplication::translate("Test2", "Argl3 Whatsthis");
+ valuesDestination.append( choice );
+ }
+ mDestinationItem = new MyPrefs::ItemEnum( currentGroup(), QLatin1String( "Destination" ), mDestination, valuesDestination, standardDestination );
+ mDestinationItem->setLabel( QCoreApplication::translate("Test2", "New Events/Todos Should") );
+ addItem( mDestinationItem, QLatin1String( "Destination" ) );
+
+ setCurrentGroup( QLatin1String( "Views" ) );
+
+ mHourSizeItem = new MyPrefs::ItemInt( currentGroup(), QLatin1String( "Hour Size" ), mHourSize, 10 );
+ mHourSizeItem->setLabel( QCoreApplication::translate("Test2", "Hour Size") );
+ addItem( mHourSizeItem, QLatin1String( "HourSize" ) );
+ mSelectionStartsEditorItem = new MyPrefs::ItemBool( currentGroup(), QLatin1String( "SelectionStartsEditor" ), mSelectionStartsEditor, false );
+ mSelectionStartsEditorItem->setLabel( QCoreApplication::translate("Test2", "Time range selection in agenda view starts event editor") );
+ addItem( mSelectionStartsEditorItem, QLatin1String( "SelectionStartsEditor" ) );
+
+ setCurrentGroup( QLatin1String( "KOrganizer Plugins" ) );
+
+ QStringList defaultSelectedPlugins;
+ defaultSelectedPlugins.append( QString::fromUtf8( "holidays" ) );
+ defaultSelectedPlugins.append( QString::fromUtf8( "webexport" ) );
+
+ mSelectedPluginsItem = new MyPrefs::ItemStringList( currentGroup(), QLatin1String( "SelectedPlugins" ), mSelectedPlugins, defaultSelectedPlugins );
+ mSelectedPluginsItem->setLabel( QCoreApplication::translate("Test2", "SelectedPlugins") );
+ addItem( mSelectedPluginsItem, QLatin1String( "SelectedPlugins" ) );
+
+ setCurrentGroup( QLatin1String( "Colors" ) );
+
+ mHighlightColorItem = new MyPrefs::ItemColor( currentGroup(), QLatin1String( "Highlight Color" ), mHighlightColor, QColor( 100, 100, 255 ) );
+ mHighlightColorItem->setLabel( QCoreApplication::translate("Test2", "Highlight color") );
+ addItem( mHighlightColorItem, QLatin1String( "HighlightColor" ) );
+ mAgendaBgColorItem = new MyPrefs::ItemColor( currentGroup(), QLatin1String( "Agenda Background Color" ), mAgendaBgColor, QColor( 255, 255, 255 ) );
+ mAgendaBgColorItem->setLabel( QCoreApplication::translate("Test2", "Agenda view background color") );
+ addItem( mAgendaBgColorItem, QLatin1String( "AgendaBgColor" ) );
+
+ setCurrentGroup( QLatin1String( "Fonts" ) );
+
+ mTimeBarFontItem = new MyPrefs::ItemFont( currentGroup(), QLatin1String( "TimeBar Font" ), mTimeBarFont );
+ mTimeBarFontItem->setLabel( QCoreApplication::translate("Test2", "Time bar") );
+ addItem( mTimeBarFontItem, QLatin1String( "TimeBarFont" ) );
+}
+
+Test2::~Test2()
+{
+}
+
diff --git a/autotests/kconfig_compiler/test2.h.ref b/autotests/kconfig_compiler/test2.h.ref
new file mode 100644
index 00000000..49af161e
--- /dev/null
+++ b/autotests/kconfig_compiler/test2.h.ref
@@ -0,0 +1,335 @@
+// 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 <qglobal.h>
+#include <kconfigskeleton.h>
+#include <QCoreApplication>
+#include <QDebug>
+
+class Test2 : public MyPrefs
+{
+ public:
+ enum EnumDestination { standardDestination, askDestination, argl1, argl2, argl3 };
+
+ Test2( );
+ ~Test2();
+
+ /**
+ Set Enable automatic saving of calendar
+ */
+ void setAutoSave( bool v )
+ {
+ if (!isImmutable( QString::fromLatin1( "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( QString::fromLatin1( "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( QString::fromLatin1( "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 QString & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "ArchiveFile" ) ))
+ mArchiveFile = v;
+ }
+
+ /**
+ Get Archive File
+ */
+ QString 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( QString::fromLatin1( "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( QString::fromLatin1( "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( QString::fromLatin1( "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 QStringList & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "SelectedPlugins" ) ))
+ mSelectedPlugins = v;
+ }
+
+ /**
+ Get SelectedPlugins
+ */
+ QStringList selectedPlugins() const
+ {
+ return mSelectedPlugins;
+ }
+
+ /**
+ Get Item object corresponding to SelectedPlugins()
+ */
+ ItemStringList *selectedPluginsItem()
+ {
+ return mSelectedPluginsItem;
+ }
+
+ /**
+ Set Highlight color
+ */
+ void setHighlightColor( const QColor & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "HighlightColor" ) ))
+ mHighlightColor = v;
+ }
+
+ /**
+ Get Highlight color
+ */
+ QColor highlightColor() const
+ {
+ return mHighlightColor;
+ }
+
+ /**
+ Get Item object corresponding to HighlightColor()
+ */
+ ItemColor *highlightColorItem()
+ {
+ return mHighlightColorItem;
+ }
+
+ /**
+ Set Agenda view background color
+ */
+ void setAgendaBgColor( const QColor & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "AgendaBgColor" ) ))
+ mAgendaBgColor = v;
+ }
+
+ /**
+ Get Agenda view background color
+ */
+ QColor agendaBgColor() const
+ {
+ return mAgendaBgColor;
+ }
+
+ /**
+ Get Item object corresponding to AgendaBgColor()
+ */
+ ItemColor *agendaBgColorItem()
+ {
+ return mAgendaBgColorItem;
+ }
+
+ /**
+ Set Time bar
+ */
+ void setTimeBarFont( const QFont & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "TimeBarFont" ) ))
+ mTimeBarFont = v;
+ }
+
+ /**
+ Get Time bar
+ */
+ QFont timeBarFont() const
+ {
+ return mTimeBarFont;
+ }
+
+ /**
+ Get Item object corresponding to TimeBarFont()
+ */
+ ItemFont *timeBarFontItem()
+ {
+ return mTimeBarFontItem;
+ }
+
+ protected:
+ public:
+
+ // General
+ bool mAutoSave;
+ int mAutoSaveInterval;
+ bool mConfirm;
+ QString mArchiveFile;
+ int mDestination;
+
+ // Views
+ int mHourSize;
+ bool mSelectionStartsEditor;
+
+ // KOrganizer Plugins
+ QStringList mSelectedPlugins;
+
+ // Colors
+ QColor mHighlightColor;
+ QColor mAgendaBgColor;
+
+ // Fonts
+ QFont 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/autotests/kconfig_compiler/test2.kcfg b/autotests/kconfig_compiler/test2.kcfg
new file mode 100644
index 00000000..3b19e270
--- /dev/null
+++ b/autotests/kconfig_compiler/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/autotests/kconfig_compiler/test2.kcfgc b/autotests/kconfig_compiler/test2.kcfgc
new file mode 100644
index 00000000..56620d2f
--- /dev/null
+++ b/autotests/kconfig_compiler/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/autotests/kconfig_compiler/test2main.cpp b/autotests/kconfig_compiler/test2main.cpp
new file mode 100644
index 00000000..80203c65
--- /dev/null
+++ b/autotests/kconfig_compiler/test2main.cpp
@@ -0,0 +1,31 @@
+/*
+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 <QGuiApplication>
+
+int main( int argc, char **argv )
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ Test2 *t = new Test2();
+ delete t;
+ return 0;
+}
diff --git a/autotests/kconfig_compiler/test3.cpp.ref b/autotests/kconfig_compiler/test3.cpp.ref
new file mode 100644
index 00000000..0c9187a1
--- /dev/null
+++ b/autotests/kconfig_compiler/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( QLatin1String( "test3rc" ) )
+{
+ setCurrentGroup( QLatin1String( "General" ) );
+
+ mAutoSaveItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "Auto Save" ), mAutoSave, false );
+ addItem( mAutoSaveItem, QLatin1String( "AutoSave" ) );
+
+ setCurrentGroup( QLatin1String( "Blah" ) );
+
+ mBlubbItem = new KConfigSkeleton::ItemInt( currentGroup(), QLatin1String( "Blubb" ), mBlubb, 10 );
+ addItem( mBlubbItem, QLatin1String( "Blubb" ) );
+ mBlahBlahItem = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "BlahBlah" ), mBlahBlah, QLatin1String( "a string" ) );
+ addItem( mBlahBlahItem, QLatin1String( "BlahBlah" ) );
+ mMyPasswordItem = new KConfigSkeleton::ItemPassword( currentGroup(), QLatin1String( "MyPassword" ), mMyPassword );
+ addItem( mMyPasswordItem, QLatin1String( "MyPassword" ) );
+}
+
+Test3::~Test3()
+{
+}
+
diff --git a/autotests/kconfig_compiler/test3.h.ref b/autotests/kconfig_compiler/test3.h.ref
new file mode 100644
index 00000000..931e2e26
--- /dev/null
+++ b/autotests/kconfig_compiler/test3.h.ref
@@ -0,0 +1,140 @@
+// 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 <qglobal.h>
+#include <kconfigskeleton.h>
+#include <QCoreApplication>
+#include <QDebug>
+
+namespace TestNameSpace {
+
+class Test3 : public KConfigSkeleton
+{
+ public:
+
+ Test3( );
+ ~Test3();
+
+ /**
+ Set Enable automatic saving of calendar
+ */
+ void setAutoSave( bool v )
+ {
+ if (!isImmutable( QString::fromLatin1( "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( QString::fromLatin1( "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 QString & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "BlahBlah" ) ))
+ mBlahBlah = v;
+ }
+
+ /**
+ Get BlahBlah
+ */
+ QString blahBlah() const
+ {
+ return mBlahBlah;
+ }
+
+ /**
+ Get Item object corresponding to BlahBlah()
+ */
+ ItemString *blahBlahItem()
+ {
+ return mBlahBlahItem;
+ }
+
+ /**
+ Set MyPassword
+ */
+ void setMyPassword( const QString & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "MyPassword" ) ))
+ mMyPassword = v;
+ }
+
+ /**
+ Get MyPassword
+ */
+ QString myPassword() const
+ {
+ return mMyPassword;
+ }
+
+ /**
+ Get Item object corresponding to MyPassword()
+ */
+ ItemPassword *myPasswordItem()
+ {
+ return mMyPasswordItem;
+ }
+
+ protected:
+
+ // General
+ bool mAutoSave;
+
+ // Blah
+ int mBlubb;
+ QString mBlahBlah;
+ QString mMyPassword;
+
+ private:
+ ItemBool *mAutoSaveItem;
+ ItemInt *mBlubbItem;
+ ItemString *mBlahBlahItem;
+ ItemPassword *mMyPasswordItem;
+};
+
+}
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test3.kcfg b/autotests/kconfig_compiler/test3.kcfg
new file mode 100644
index 00000000..77916da4
--- /dev/null
+++ b/autotests/kconfig_compiler/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/autotests/kconfig_compiler/test3.kcfgc b/autotests/kconfig_compiler/test3.kcfgc
new file mode 100644
index 00000000..ca2c2205
--- /dev/null
+++ b/autotests/kconfig_compiler/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/autotests/kconfig_compiler/test3a.cpp.ref b/autotests/kconfig_compiler/test3a.cpp.ref
new file mode 100644
index 00000000..34321e9e
--- /dev/null
+++ b/autotests/kconfig_compiler/test3a.cpp.ref
@@ -0,0 +1,29 @@
+// This file is generated by kconfig_compiler from test3a.kcfg.
+// All changes you do to this file will be lost.
+
+#include "test3a.h"
+
+using namespace TestNameSpace::InnerNameSpace;
+
+Test3a::Test3a( )
+ : KConfigSkeleton( QLatin1String( "test3arc" ) )
+{
+ setCurrentGroup( QLatin1String( "General" ) );
+
+ mAutoSaveItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "Auto Save" ), mAutoSave, false );
+ addItem( mAutoSaveItem, QLatin1String( "AutoSave" ) );
+
+ setCurrentGroup( QLatin1String( "Blah" ) );
+
+ mBlubbItem = new KConfigSkeleton::ItemInt( currentGroup(), QLatin1String( "Blubb" ), mBlubb, 10 );
+ addItem( mBlubbItem, QLatin1String( "Blubb" ) );
+ mBlahBlahItem = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "BlahBlah" ), mBlahBlah, QLatin1String( "a string" ) );
+ addItem( mBlahBlahItem, QLatin1String( "BlahBlah" ) );
+ mMyPasswordItem = new KConfigSkeleton::ItemPassword( currentGroup(), QLatin1String( "MyPassword" ), mMyPassword );
+ addItem( mMyPasswordItem, QLatin1String( "MyPassword" ) );
+}
+
+Test3a::~Test3a()
+{
+}
+
diff --git a/autotests/kconfig_compiler/test3a.h.ref b/autotests/kconfig_compiler/test3a.h.ref
new file mode 100644
index 00000000..56d672a3
--- /dev/null
+++ b/autotests/kconfig_compiler/test3a.h.ref
@@ -0,0 +1,142 @@
+// This file is generated by kconfig_compiler from test3a.kcfg.
+// All changes you do to this file will be lost.
+#ifndef TESTNAMESPACE_INNERNAMESPACE_TEST3A_H
+#define TESTNAMESPACE_INNERNAMESPACE_TEST3A_H
+
+#include <qglobal.h>
+#include <kconfigskeleton.h>
+#include <QCoreApplication>
+#include <QDebug>
+
+namespace TestNameSpace {
+namespace InnerNameSpace {
+
+class Test3a : public KConfigSkeleton
+{
+ public:
+
+ Test3a( );
+ ~Test3a();
+
+ /**
+ Set Enable automatic saving of calendar
+ */
+ void setAutoSave( bool v )
+ {
+ if (!isImmutable( QString::fromLatin1( "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( QString::fromLatin1( "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 QString & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "BlahBlah" ) ))
+ mBlahBlah = v;
+ }
+
+ /**
+ Get BlahBlah
+ */
+ QString blahBlah() const
+ {
+ return mBlahBlah;
+ }
+
+ /**
+ Get Item object corresponding to BlahBlah()
+ */
+ ItemString *blahBlahItem()
+ {
+ return mBlahBlahItem;
+ }
+
+ /**
+ Set MyPassword
+ */
+ void setMyPassword( const QString & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "MyPassword" ) ))
+ mMyPassword = v;
+ }
+
+ /**
+ Get MyPassword
+ */
+ QString myPassword() const
+ {
+ return mMyPassword;
+ }
+
+ /**
+ Get Item object corresponding to MyPassword()
+ */
+ ItemPassword *myPasswordItem()
+ {
+ return mMyPasswordItem;
+ }
+
+ protected:
+
+ // General
+ bool mAutoSave;
+
+ // Blah
+ int mBlubb;
+ QString mBlahBlah;
+ QString mMyPassword;
+
+ private:
+ ItemBool *mAutoSaveItem;
+ ItemInt *mBlubbItem;
+ ItemString *mBlahBlahItem;
+ ItemPassword *mMyPasswordItem;
+};
+
+}
+}
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test3a.kcfg b/autotests/kconfig_compiler/test3a.kcfg
new file mode 100644
index 00000000..d49b4d65
--- /dev/null
+++ b/autotests/kconfig_compiler/test3a.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="test3arc"/>
+
+ <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/autotests/kconfig_compiler/test3a.kcfgc b/autotests/kconfig_compiler/test3a.kcfgc
new file mode 100644
index 00000000..ca849a81
--- /dev/null
+++ b/autotests/kconfig_compiler/test3a.kcfgc
@@ -0,0 +1,12 @@
+# Code generation options for kconfig_compiler
+File=test3a.kcfg
+NameSpace=TestNameSpace::InnerNameSpace
+ClassName=Test3a
+#Singleton=false
+Mutators=true
+#Inherits=MyPrefs
+#IncludeFiles=myprefs.h
+#MemberVariables=public
+GlobalEnums=true
+ItemAccessors=true
+#SetUserTexts=true
diff --git a/autotests/kconfig_compiler/test3amain.cpp b/autotests/kconfig_compiler/test3amain.cpp
new file mode 100644
index 00000000..fa33f1cb
--- /dev/null
+++ b/autotests/kconfig_compiler/test3amain.cpp
@@ -0,0 +1,31 @@
+/*
+Copyright (c) 2009 Pino Toscano <pino@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 "test3a.h"
+#include <QGuiApplication>
+
+int main( int argc, char **argv )
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ TestNameSpace::InnerNameSpace::Test3a *t = new TestNameSpace::InnerNameSpace::Test3a();
+ delete t;
+ return 0;
+}
diff --git a/autotests/kconfig_compiler/test3main.cpp b/autotests/kconfig_compiler/test3main.cpp
new file mode 100644
index 00000000..bf2846c1
--- /dev/null
+++ b/autotests/kconfig_compiler/test3main.cpp
@@ -0,0 +1,31 @@
+/*
+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 <QGuiApplication>
+
+int main( int argc, char **argv )
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ TestNameSpace::Test3 *t = new TestNameSpace::Test3();
+ delete t;
+ return 0;
+}
diff --git a/autotests/kconfig_compiler/test4.cpp.ref b/autotests/kconfig_compiler/test4.cpp.ref
new file mode 100644
index 00000000..171d655d
--- /dev/null
+++ b/autotests/kconfig_compiler/test4.cpp.ref
@@ -0,0 +1,178 @@
+// This file is generated by kconfig_compiler from test4.kcfg.
+// All changes you do to this file will be lost.
+
+#include "test4.h"
+
+#include <qglobal.h>
+#include <QtCore/QFile>
+
+class Test4Helper
+{
+ public:
+ Test4Helper() : q(0) {}
+ ~Test4Helper() { delete q; }
+ Test4 *q;
+};
+Q_GLOBAL_STATIC(Test4Helper, s_globalTest4)
+Test4 *Test4::self()
+{
+ if (!s_globalTest4()->q) {
+ new Test4;
+ s_globalTest4()->q->readConfig();
+ }
+
+ return s_globalTest4()->q;
+}
+
+const char* const Test4::EnumButton::enumToString[] = { "right", "mid", "left" };
+
+Test4::Test4( )
+ : KConfigSkeleton( QLatin1String( "test4rc" ) )
+{
+ Q_ASSERT(!s_globalTest4()->q);
+ s_globalTest4()->q = this;
+ setCurrentGroup( QLatin1String( "Foo" ) );
+
+QColor defaultColor[4] = { Qt::red, Qt::blue, Qt::green, Qt::black };
+ KConfigSkeleton::ItemColor *itemColor[4];
+ itemColor[0] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "color #0" ), mColor[0], defaultColor[0] );
+ addItem( itemColor[0], QLatin1String( "Color0" ) );
+ itemColor[1] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "color #1" ), mColor[1], defaultColor[1] );
+ addItem( itemColor[1], QLatin1String( "Color1" ) );
+ itemColor[2] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "color #2" ), mColor[2], defaultColor[2] );
+ addItem( itemColor[2], QLatin1String( "Color2" ) );
+ itemColor[3] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "color #3" ), mColor[3], defaultColor[3] );
+ addItem( itemColor[3], QLatin1String( "Color3" ) );
+ QList<KConfigSkeleton::ItemEnum::Choice> valuesMouseAction;
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("Encrypt");
+ valuesMouseAction.append( choice );
+ }
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("Decrypt");
+ valuesMouseAction.append( choice );
+ }
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("CrashNBurn");
+ valuesMouseAction.append( choice );
+ }
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("PumpNDump");
+ valuesMouseAction.append( choice );
+ }
+ KConfigSkeleton::ItemEnum *itemMouseAction[3];
+ itemMouseAction[0] = new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String( "right_mouse_action" ), mMouseAction[0], valuesMouseAction, EnumMouseAction::Decrypt );
+ addItem( itemMouseAction[0], QLatin1String( "MouseActionright" ) );
+ itemMouseAction[1] = new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String( "mid_mouse_action" ), mMouseAction[1], valuesMouseAction, EnumMouseAction::Encrypt );
+ addItem( itemMouseAction[1], QLatin1String( "MouseActionmid" ) );
+ itemMouseAction[2] = new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String( "left_mouse_action" ), mMouseAction[2], valuesMouseAction, EnumMouseAction::PumpNDump );
+ addItem( itemMouseAction[2], QLatin1String( "MouseActionleft" ) );
+ KConfigSkeleton::ItemColor *itemGrayColor[11];
+ itemGrayColor[0] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "gray color #0" ), mGrayColor[0],
+ QColor::fromRgbF(0 / 10.0, 0 / 10.0, 0 / 10.0)
+ );
+ addItem( itemGrayColor[0], QLatin1String( "GrayColor0" ) );
+ itemGrayColor[1] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "gray color #1" ), mGrayColor[1],
+ QColor::fromRgbF(1 / 10.0, 1 / 10.0, 1 / 10.0)
+ );
+ addItem( itemGrayColor[1], QLatin1String( "GrayColor1" ) );
+ itemGrayColor[2] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "gray color #2" ), mGrayColor[2],
+ QColor::fromRgbF(2 / 10.0, 2 / 10.0, 2 / 10.0)
+ );
+ addItem( itemGrayColor[2], QLatin1String( "GrayColor2" ) );
+ itemGrayColor[3] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "gray color #3" ), mGrayColor[3],
+ QColor::fromRgbF(3 / 10.0, 3 / 10.0, 3 / 10.0)
+ );
+ addItem( itemGrayColor[3], QLatin1String( "GrayColor3" ) );
+ itemGrayColor[4] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "gray color #4" ), mGrayColor[4],
+ QColor::fromRgbF(4 / 10.0, 4 / 10.0, 4 / 10.0)
+ );
+ addItem( itemGrayColor[4], QLatin1String( "GrayColor4" ) );
+ itemGrayColor[5] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "gray color #5" ), mGrayColor[5],
+ QColor::fromRgbF(5 / 10.0, 5 / 10.0, 5 / 10.0)
+ );
+ addItem( itemGrayColor[5], QLatin1String( "GrayColor5" ) );
+ itemGrayColor[6] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "gray color #6" ), mGrayColor[6],
+ QColor::fromRgbF(6 / 10.0, 6 / 10.0, 6 / 10.0)
+ );
+ addItem( itemGrayColor[6], QLatin1String( "GrayColor6" ) );
+ itemGrayColor[7] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "gray color #7" ), mGrayColor[7],
+ QColor::fromRgbF(7 / 10.0, 7 / 10.0, 7 / 10.0)
+ );
+ addItem( itemGrayColor[7], QLatin1String( "GrayColor7" ) );
+ itemGrayColor[8] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "gray color #8" ), mGrayColor[8],
+ QColor::fromRgbF(8 / 10.0, 8 / 10.0, 8 / 10.0)
+ );
+ addItem( itemGrayColor[8], QLatin1String( "GrayColor8" ) );
+ itemGrayColor[9] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "gray color #9" ), mGrayColor[9],
+ QColor::fromRgbF(9 / 10.0, 9 / 10.0, 9 / 10.0)
+ );
+ addItem( itemGrayColor[9], QLatin1String( "GrayColor9" ) );
+ itemGrayColor[10] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "gray color #10" ), mGrayColor[10],
+ QColor::fromRgbF(10 / 10.0, 10 / 10.0, 10 / 10.0)
+ );
+ addItem( itemGrayColor[10], QLatin1String( "GrayColor10" ) );
+ KConfigSkeleton::ItemString *itemColorString[11];
+ itemColorString[0] = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "color string #0" ), mColorString[0],
+ QString::number(0)
+ );
+ addItem( itemColorString[0], QLatin1String( "ColorString0" ) );
+ itemColorString[1] = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "color string #1" ), mColorString[1],
+ QString::number(1)
+ );
+ addItem( itemColorString[1], QLatin1String( "ColorString1" ) );
+ itemColorString[2] = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "color string #2" ), mColorString[2],
+ QString::number(2)
+ );
+ addItem( itemColorString[2], QLatin1String( "ColorString2" ) );
+ itemColorString[3] = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "color string #3" ), mColorString[3],
+ QString::number(3)
+ );
+ addItem( itemColorString[3], QLatin1String( "ColorString3" ) );
+ itemColorString[4] = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "color string #4" ), mColorString[4],
+ QString::number(4)
+ );
+ addItem( itemColorString[4], QLatin1String( "ColorString4" ) );
+ itemColorString[5] = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "color string #5" ), mColorString[5],
+ QString::number(5)
+ );
+ addItem( itemColorString[5], QLatin1String( "ColorString5" ) );
+ itemColorString[6] = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "color string #6" ), mColorString[6],
+ QString::number(6)
+ );
+ addItem( itemColorString[6], QLatin1String( "ColorString6" ) );
+ itemColorString[7] = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "color string #7" ), mColorString[7],
+ QString::number(7)
+ );
+ addItem( itemColorString[7], QLatin1String( "ColorString7" ) );
+ itemColorString[8] = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "color string #8" ), mColorString[8],
+ QString::number(8)
+ );
+ addItem( itemColorString[8], QLatin1String( "ColorString8" ) );
+ itemColorString[9] = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "color string #9" ), mColorString[9],
+ QString::number(9)
+ );
+ addItem( itemColorString[9], QLatin1String( "ColorString9" ) );
+ itemColorString[10] = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "color string #10" ), mColorString[10],
+ QString::number(10)
+ );
+ addItem( itemColorString[10], QLatin1String( "ColorString10" ) );
+ KConfigSkeleton::ItemString *itemFooBar;
+ itemFooBar = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "foo bar" ), mFooBar );
+ addItem( itemFooBar, QLatin1String( "FooBar" ) );
+ KConfigSkeleton::ItemInt *itemAge;
+ itemAge = new KConfigSkeleton::ItemInt( currentGroup(), QLatin1String( "Age" ), mAge, 35 );
+ itemAge->setMinValue(8);
+ itemAge->setMaxValue(88);
+ addItem( itemAge, QLatin1String( "Age" ) );
+}
+
+Test4::~Test4()
+{
+ s_globalTest4()->q = 0;
+}
+
diff --git a/autotests/kconfig_compiler/test4.h.ref b/autotests/kconfig_compiler/test4.h.ref
new file mode 100644
index 00000000..991a4f7d
--- /dev/null
+++ b/autotests/kconfig_compiler/test4.h.ref
@@ -0,0 +1,171 @@
+// 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 <QCoreApplication>
+#include <QDebug>
+
+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 QColor & v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "Color%1" ).arg( i ) ))
+ self()->mColor[i] = v;
+ }
+
+ /**
+ Get Block colors.
+ */
+ static
+ QColor color( int i )
+ {
+ return self()->mColor[i];
+ }
+
+ /**
+ Set Mouse actions.
+ */
+ static
+ void setMouseAction( int i, int v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "MouseAction%1" ).arg( QLatin1String( EnumButton::enumToString[i] ) ) ))
+ self()->mMouseAction[i] = v;
+ }
+
+ /**
+ Get Mouse actions.
+ */
+ static
+ int mouseAction( int i )
+ {
+ return self()->mMouseAction[i];
+ }
+
+ /**
+ Set Gray colors.
+ */
+ static
+ void setGrayColor( int i, const QColor & v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "GrayColor%1" ).arg( i ) ))
+ self()->mGrayColor[i] = v;
+ }
+
+ /**
+ Get Gray colors.
+ */
+ static
+ QColor grayColor( int i )
+ {
+ return self()->mGrayColor[i];
+ }
+
+ /**
+ Set Gray colors as string.
+ */
+ static
+ void setColorString( int i, const QString & v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "ColorString%1" ).arg( i ) ))
+ self()->mColorString[i] = v;
+ }
+
+ /**
+ Get Gray colors as string.
+ */
+ static
+ QString colorString( int i )
+ {
+ return self()->mColorString[i];
+ }
+
+ /**
+ Set foo bar
+ */
+ static
+ void setFooBar( const QString & v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "FooBar" ) ))
+ self()->mFooBar = v;
+ }
+
+ /**
+ Get foo bar
+ */
+ static
+ QString fooBar()
+ {
+ return self()->mFooBar;
+ }
+
+ /**
+ Set Age
+ */
+ static
+ void setAge( int v )
+ {
+ if (v < 8)
+ {
+ qDebug() << "setAge: value " << v << " is less than the minimum value of 8";
+ v = 8;
+ }
+
+ if (v > 88)
+ {
+ qDebug() << "setAge: value " << v << " is greater than the maximum value of 88";
+ v = 88;
+ }
+
+ if (!self()->isImmutable( QString::fromLatin1( "Age" ) ))
+ self()->mAge = v;
+ }
+
+ /**
+ Get Age
+ */
+ static
+ int age()
+ {
+ return self()->mAge;
+ }
+
+ protected:
+ Test4();
+ friend class Test4Helper;
+
+
+ // Foo
+ QColor mColor[4];
+ int mMouseAction[3];
+ QColor mGrayColor[11];
+ QString mColorString[11];
+ QString mFooBar;
+ int mAge;
+
+ private:
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test4.kcfg b/autotests/kconfig_compiler/test4.kcfg
new file mode 100644
index 00000000..0919b46f
--- /dev/null
+++ b/autotests/kconfig_compiler/test4.kcfg
@@ -0,0 +1,56 @@
+<?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="GrayColor$(Number)" type="Color" key="gray color #$(Number)">
+ <parameter name="Number" type="Int" max="10"/>
+ <label>Gray colors.</label>
+ <default code="true">
+ QColor::fromRgbF($(Number) / 10.0, $(Number) / 10.0, $(Number) / 10.0)
+ </default>
+ </entry>
+ <entry name="ColorString$(Number)" type="String" key="color string #$(Number)">
+ <parameter name="Number" type="Int" max="10"/>
+ <label>Gray colors as string.</label>
+ <default code="true">
+ QString::number($(Number))
+ </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/autotests/kconfig_compiler/test4.kcfgc b/autotests/kconfig_compiler/test4.kcfgc
new file mode 100644
index 00000000..754706df
--- /dev/null
+++ b/autotests/kconfig_compiler/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/autotests/kconfig_compiler/test4main.cpp b/autotests/kconfig_compiler/test4main.cpp
new file mode 100644
index 00000000..3ef924c8
--- /dev/null
+++ b/autotests/kconfig_compiler/test4main.cpp
@@ -0,0 +1,32 @@
+/*
+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 <QGuiApplication>
+
+int main( int argc, char **argv )
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ Test4 *t = Test4::self();
+ delete t;
+ return 0;
+}
diff --git a/autotests/kconfig_compiler/test5.cpp.ref b/autotests/kconfig_compiler/test5.cpp.ref
new file mode 100644
index 00000000..2a95dcda
--- /dev/null
+++ b/autotests/kconfig_compiler/test5.cpp.ref
@@ -0,0 +1,88 @@
+// This file is generated by kconfig_compiler from test5.kcfg.
+// All changes you do to this file will be lost.
+
+#include "test5.h"
+
+#include <qglobal.h>
+#include <QtCore/QFile>
+
+class Test5Helper
+{
+ public:
+ Test5Helper() : q(0) {}
+ ~Test5Helper() { delete q; }
+ Test5 *q;
+};
+Q_GLOBAL_STATIC(Test5Helper, s_globalTest5)
+Test5 *Test5::self()
+{
+ if (!s_globalTest5()->q) {
+ new Test5;
+ s_globalTest5()->q->readConfig();
+ }
+
+ return s_globalTest5()->q;
+}
+
+const char* const Test5::EnumButtonToString[] = { "right", "mid", "left" };
+
+Test5::Test5( )
+ : KConfigSkeleton( QLatin1String( "test4rc" ) )
+{
+ Q_ASSERT(!s_globalTest5()->q);
+ s_globalTest5()->q = this;
+ setCurrentGroup( QLatin1String( "Foo" ) );
+
+QColor defaultColor[4] = { Qt::red, Qt::blue, Qt::green, Qt::black };
+ KConfigSkeleton::ItemColor *itemColor[4];
+ itemColor[0] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "color #0" ), mColor[0], defaultColor[0] );
+ addItem( itemColor[0], QLatin1String( "Color0" ) );
+ itemColor[1] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "color #1" ), mColor[1], defaultColor[1] );
+ addItem( itemColor[1], QLatin1String( "Color1" ) );
+ itemColor[2] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "color #2" ), mColor[2], defaultColor[2] );
+ addItem( itemColor[2], QLatin1String( "Color2" ) );
+ itemColor[3] = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "color #3" ), mColor[3], defaultColor[3] );
+ addItem( itemColor[3], QLatin1String( "Color3" ) );
+ QList<KConfigSkeleton::ItemEnum::Choice> valuesMouseAction;
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("Encrypt");
+ valuesMouseAction.append( choice );
+ }
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("Decrypt");
+ valuesMouseAction.append( choice );
+ }
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("CrashNBurn");
+ valuesMouseAction.append( choice );
+ }
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("PumpNDump");
+ valuesMouseAction.append( choice );
+ }
+ KConfigSkeleton::ItemEnum *itemMouseAction[3];
+ itemMouseAction[0] = new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String( "right_mouse_action" ), mMouseAction[0], valuesMouseAction, Decrypt );
+ addItem( itemMouseAction[0], QLatin1String( "MouseActionright" ) );
+ itemMouseAction[1] = new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String( "mid_mouse_action" ), mMouseAction[1], valuesMouseAction, Encrypt );
+ addItem( itemMouseAction[1], QLatin1String( "MouseActionmid" ) );
+ itemMouseAction[2] = new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String( "left_mouse_action" ), mMouseAction[2], valuesMouseAction, PumpNDump );
+ addItem( itemMouseAction[2], QLatin1String( "MouseActionleft" ) );
+ KConfigSkeleton::ItemString *itemFooBar;
+ itemFooBar = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "foo bar" ), mFooBar );
+ addItem( itemFooBar, QLatin1String( "FooBar" ) );
+ KConfigSkeleton::ItemInt *itemAge;
+ itemAge = new KConfigSkeleton::ItemInt( currentGroup(), QLatin1String( "Age" ), mAge, 35 );
+ itemAge->setMinValue(8);
+ itemAge->setMaxValue(88);
+ addItem( itemAge, QLatin1String( "Age" ) );
+}
+
+Test5::~Test5()
+{
+ s_globalTest5()->q = 0;
+}
+
diff --git a/autotests/kconfig_compiler/test5.h.ref b/autotests/kconfig_compiler/test5.h.ref
new file mode 100644
index 00000000..46a591c1
--- /dev/null
+++ b/autotests/kconfig_compiler/test5.h.ref
@@ -0,0 +1,123 @@
+// 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 <QCoreApplication>
+#include <QDebug>
+
+class Test5 : public KConfigSkeleton
+{
+ public:
+ enum EnumMouseAction { Encrypt, Decrypt, CrashNBurn, PumpNDump };
+ enum EnumButton { right, mid, left };
+ static const char* const EnumButtonToString[];
+
+ static Test5 *self();
+ ~Test5();
+
+ /**
+ Set Block colors.
+ */
+ static
+ void setColor( int i, const QColor & v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "Color%1" ).arg( i ) ))
+ self()->mColor[i] = v;
+ }
+
+ /**
+ Get Block colors.
+ */
+ static
+ QColor color( int i )
+ {
+ return self()->mColor[i];
+ }
+
+ /**
+ Set Mouse actions.
+ */
+ static
+ void setMouseAction( int i, int v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "MouseAction%1" ).arg( QLatin1String( 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 QString & v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "FooBar" ) ))
+ self()->mFooBar = v;
+ }
+
+ /**
+ Get foo bar
+ */
+ static
+ QString fooBar()
+ {
+ return self()->mFooBar;
+ }
+
+ /**
+ Set Age
+ */
+ static
+ void setAge( int v )
+ {
+ if (v < 8)
+ {
+ qDebug() << "setAge: value " << v << " is less than the minimum value of 8";
+ v = 8;
+ }
+
+ if (v > 88)
+ {
+ qDebug() << "setAge: value " << v << " is greater than the maximum value of 88";
+ v = 88;
+ }
+
+ if (!self()->isImmutable( QString::fromLatin1( "Age" ) ))
+ self()->mAge = v;
+ }
+
+ /**
+ Get Age
+ */
+ static
+ int age()
+ {
+ return self()->mAge;
+ }
+
+ protected:
+ Test5();
+ friend class Test5Helper;
+
+
+ // Foo
+ QColor mColor[4];
+ int mMouseAction[3];
+ QString mFooBar;
+ int mAge;
+
+ private:
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test5.kcfg b/autotests/kconfig_compiler/test5.kcfg
new file mode 100644
index 00000000..d8ef2bfa
--- /dev/null
+++ b/autotests/kconfig_compiler/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/autotests/kconfig_compiler/test5.kcfgc b/autotests/kconfig_compiler/test5.kcfgc
new file mode 100644
index 00000000..663005e5
--- /dev/null
+++ b/autotests/kconfig_compiler/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/autotests/kconfig_compiler/test5main.cpp b/autotests/kconfig_compiler/test5main.cpp
new file mode 100644
index 00000000..55e30d07
--- /dev/null
+++ b/autotests/kconfig_compiler/test5main.cpp
@@ -0,0 +1,32 @@
+/*
+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 <QGuiApplication>
+
+int main( int argc, char **argv )
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ Test5 *t = Test5::self();
+ delete t;
+ return 0;
+}
diff --git a/autotests/kconfig_compiler/test6.cpp.ref b/autotests/kconfig_compiler/test6.cpp.ref
new file mode 100644
index 00000000..0fce03a3
--- /dev/null
+++ b/autotests/kconfig_compiler/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 QString & Number )
+ : KConfigSkeleton( QLatin1String( "test4rc" ) )
+ , mParamNumber(Number)
+{
+ setCurrentGroup( QLatin1String( "Foo" ) );
+
+ KConfigSkeleton::ItemColor *itemColor;
+ itemColor = new KConfigSkeleton::ItemColor( currentGroup(), QString( QLatin1String( "color #%1" ) ).arg( mParamNumber ), mColor, QColor( "red" ) );
+ addItem( itemColor, QLatin1String( "Color" ) );
+
+ setCurrentGroup( QString( QLatin1String( "Bar%1" ) ).arg( mParamNumber ) );
+
+ KConfigSkeleton::ItemString *itemFooBar;
+ itemFooBar = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "foo bar" ), mFooBar );
+ addItem( itemFooBar, QLatin1String( "FooBar" ) );
+ KConfigSkeleton::ItemInt *itemAge;
+ itemAge = new KConfigSkeleton::ItemInt( currentGroup(), QLatin1String( "Age" ), mAge, 35 );
+ itemAge->setMinValue(8);
+ itemAge->setMaxValue(88);
+ addItem( itemAge, QLatin1String( "Age" ) );
+}
+
+Test6::~Test6()
+{
+}
+
diff --git a/autotests/kconfig_compiler/test6.h.ref b/autotests/kconfig_compiler/test6.h.ref
new file mode 100644
index 00000000..f1fb59fd
--- /dev/null
+++ b/autotests/kconfig_compiler/test6.h.ref
@@ -0,0 +1,94 @@
+// 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 <QCoreApplication>
+#include <QDebug>
+
+class Test6 : public KConfigSkeleton
+{
+ public:
+
+ Test6( const QString & Number );
+ ~Test6();
+
+ /**
+ Set Block colors.
+ */
+ void setColor( const QColor & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "Color" ) ))
+ mColor = v;
+ }
+
+ /**
+ Get Block colors.
+ */
+ QColor color() const
+ {
+ return mColor;
+ }
+
+ /**
+ Set foo bar
+ */
+ void setFooBar( const QString & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "FooBar" ) ))
+ mFooBar = v;
+ }
+
+ /**
+ Get foo bar
+ */
+ QString fooBar() const
+ {
+ return mFooBar;
+ }
+
+ /**
+ Set Age
+ */
+ void setAge( int v )
+ {
+ if (v < 8)
+ {
+ qDebug() << "setAge: value " << v << " is less than the minimum value of 8";
+ v = 8;
+ }
+
+ if (v > 88)
+ {
+ qDebug() << "setAge: value " << v << " is greater than the maximum value of 88";
+ v = 88;
+ }
+
+ if (!isImmutable( QString::fromLatin1( "Age" ) ))
+ mAge = v;
+ }
+
+ /**
+ Get Age
+ */
+ int age() const
+ {
+ return mAge;
+ }
+
+ protected:
+ QString mParamNumber;
+
+ // Foo
+ QColor mColor;
+
+ // Bar$(Number)
+ QString mFooBar;
+ int mAge;
+
+ private:
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test6.kcfg b/autotests/kconfig_compiler/test6.kcfg
new file mode 100644
index 00000000..e59fa88f
--- /dev/null
+++ b/autotests/kconfig_compiler/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/autotests/kconfig_compiler/test6.kcfgc b/autotests/kconfig_compiler/test6.kcfgc
new file mode 100644
index 00000000..b69dc152
--- /dev/null
+++ b/autotests/kconfig_compiler/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/autotests/kconfig_compiler/test6main.cpp b/autotests/kconfig_compiler/test6main.cpp
new file mode 100644
index 00000000..a60d8378
--- /dev/null
+++ b/autotests/kconfig_compiler/test6main.cpp
@@ -0,0 +1,32 @@
+/*
+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 <QGuiApplication>
+
+int main( int argc, char **argv )
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ Test6 *t = new Test6(QString());
+ delete t;
+ return 0;
+}
diff --git a/autotests/kconfig_compiler/test7.cpp.ref b/autotests/kconfig_compiler/test7.cpp.ref
new file mode 100644
index 00000000..4ee7d280
--- /dev/null
+++ b/autotests/kconfig_compiler/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( QLatin1String( "test7rc" ) )
+ , mParamNumber(Number)
+{
+ setCurrentGroup( QLatin1String( "Foo" ) );
+
+ KConfigSkeleton::ItemColor *itemColor;
+ itemColor = new KConfigSkeleton::ItemColor( currentGroup(), QString( QLatin1String( "color #%1" ) ).arg( mParamNumber ), mColor, QColor( "red" ) );
+ addItem( itemColor, QLatin1String( "Color" ) );
+
+ setCurrentGroup( QString( QLatin1String( "Bar%1" ) ).arg( mParamNumber ) );
+
+ KConfigSkeleton::ItemString *itemFooBar;
+ itemFooBar = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "foo bar" ), mFooBar );
+ addItem( itemFooBar, QLatin1String( "FooBar" ) );
+ KConfigSkeleton::ItemInt *itemAge;
+ itemAge = new KConfigSkeleton::ItemInt( currentGroup(), QLatin1String( "Age" ), mAge, 35 );
+ itemAge->setMinValue(8);
+ itemAge->setMaxValue(88);
+ addItem( itemAge, QLatin1String( "Age" ) );
+}
+
+Test7::~Test7()
+{
+}
+
diff --git a/autotests/kconfig_compiler/test7.h.ref b/autotests/kconfig_compiler/test7.h.ref
new file mode 100644
index 00000000..417c75ad
--- /dev/null
+++ b/autotests/kconfig_compiler/test7.h.ref
@@ -0,0 +1,94 @@
+// 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 <QCoreApplication>
+#include <QDebug>
+
+class Test7 : public KConfigSkeleton
+{
+ public:
+
+ Test7( int Number );
+ ~Test7();
+
+ /**
+ Set Block colors.
+ */
+ void setColor( const QColor & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "Color" ) ))
+ mColor = v;
+ }
+
+ /**
+ Get Block colors.
+ */
+ QColor color() const
+ {
+ return mColor;
+ }
+
+ /**
+ Set foo bar
+ */
+ void setFooBar( const QString & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "FooBar" ) ))
+ mFooBar = v;
+ }
+
+ /**
+ Get foo bar
+ */
+ QString fooBar() const
+ {
+ return mFooBar;
+ }
+
+ /**
+ Set Age
+ */
+ void setAge( int v )
+ {
+ if (v < 8)
+ {
+ qDebug() << "setAge: value " << v << " is less than the minimum value of 8";
+ v = 8;
+ }
+
+ if (v > 88)
+ {
+ qDebug() << "setAge: value " << v << " is greater than the maximum value of 88";
+ v = 88;
+ }
+
+ if (!isImmutable( QString::fromLatin1( "Age" ) ))
+ mAge = v;
+ }
+
+ /**
+ Get Age
+ */
+ int age() const
+ {
+ return mAge;
+ }
+
+ protected:
+ int mParamNumber;
+
+ // Foo
+ QColor mColor;
+
+ // Bar$(Number)
+ QString mFooBar;
+ int mAge;
+
+ private:
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test7.kcfg b/autotests/kconfig_compiler/test7.kcfg
new file mode 100644
index 00000000..0a7fd327
--- /dev/null
+++ b/autotests/kconfig_compiler/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/autotests/kconfig_compiler/test7.kcfgc b/autotests/kconfig_compiler/test7.kcfgc
new file mode 100644
index 00000000..9a6c4095
--- /dev/null
+++ b/autotests/kconfig_compiler/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/autotests/kconfig_compiler/test7main.cpp b/autotests/kconfig_compiler/test7main.cpp
new file mode 100644
index 00000000..bf55be20
--- /dev/null
+++ b/autotests/kconfig_compiler/test7main.cpp
@@ -0,0 +1,32 @@
+/*
+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 <QGuiApplication>
+
+int main( int argc, char **argv )
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ Test7 *t = new Test7(42);
+ delete t;
+ return 0;
+}
diff --git a/autotests/kconfig_compiler/test8a.cpp.ref b/autotests/kconfig_compiler/test8a.cpp.ref
new file mode 100644
index 00000000..af85f0ce
--- /dev/null
+++ b/autotests/kconfig_compiler/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( QLatin1String( "Group" ) );
+
+ KConfigSkeleton::ItemFont *itemFont;
+ itemFont = new KConfigSkeleton::ItemFont( currentGroup(), QLatin1String( "Font" ), mFont, QFont() );
+ addItem( itemFont, QLatin1String( "Font" ) );
+ KConfigSkeleton::ItemFont *itemTitleFont;
+ itemTitleFont = new KConfigSkeleton::ItemFont( currentGroup(), QLatin1String( "TitleFont" ), mTitleFont, QFont() );
+ addItem( itemTitleFont, QLatin1String( "TitleFont" ) );
+}
+
+Test8a::~Test8a()
+{
+}
+
diff --git a/autotests/kconfig_compiler/test8a.h.ref b/autotests/kconfig_compiler/test8a.h.ref
new file mode 100644
index 00000000..fd1b3648
--- /dev/null
+++ b/autotests/kconfig_compiler/test8a.h.ref
@@ -0,0 +1,62 @@
+// 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 <qglobal.h>
+#include <kconfigskeleton.h>
+#include <QCoreApplication>
+#include <QDebug>
+
+class Test8a : public KConfigSkeleton
+{
+ public:
+
+ Test8a( KSharedConfig::Ptr config = KSharedConfig::openConfig() );
+ ~Test8a();
+
+ /**
+ Set Font
+ */
+ void setFont( const QFont & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "Font" ) ))
+ mFont = v;
+ }
+
+ /**
+ Get Font
+ */
+ QFont font() const
+ {
+ return mFont;
+ }
+
+ /**
+ Set TitleFont
+ */
+ void setTitleFont( const QFont & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "TitleFont" ) ))
+ mTitleFont = v;
+ }
+
+ /**
+ Get TitleFont
+ */
+ QFont titleFont() const
+ {
+ return mTitleFont;
+ }
+
+ protected:
+
+ // Group
+ QFont mFont;
+ QFont mTitleFont;
+
+ private:
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test8a.kcfg b/autotests/kconfig_compiler/test8a.kcfg
new file mode 100644
index 00000000..24038a69
--- /dev/null
+++ b/autotests/kconfig_compiler/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">QFont()</default>
+ </entry>
+
+ <entry name="TitleFont" type="Font">
+ <default code="true">QFont()</default>
+ </entry>
+ </group>
+</kcfg>
diff --git a/autotests/kconfig_compiler/test8a.kcfgc b/autotests/kconfig_compiler/test8a.kcfgc
new file mode 100644
index 00000000..5f63c31c
--- /dev/null
+++ b/autotests/kconfig_compiler/test8a.kcfgc
@@ -0,0 +1,3 @@
+File=test8a.kcfg
+ClassName=Test8a
+Mutators=true
diff --git a/autotests/kconfig_compiler/test8b.cpp.ref b/autotests/kconfig_compiler/test8b.cpp.ref
new file mode 100644
index 00000000..ba0c8b47
--- /dev/null
+++ b/autotests/kconfig_compiler/test8b.cpp.ref
@@ -0,0 +1,52 @@
+// This file is generated by kconfig_compiler from test8b.kcfg.
+// All changes you do to this file will be lost.
+
+#include "test8b.h"
+
+#include <qglobal.h>
+#include <QtCore/QFile>
+
+class Test8bHelper
+{
+ public:
+ Test8bHelper() : q(0) {}
+ ~Test8bHelper() { delete q; }
+ Test8b *q;
+};
+Q_GLOBAL_STATIC(Test8bHelper, s_globalTest8b)
+Test8b *Test8b::self()
+{
+ if (!s_globalTest8b()->q) {
+ new Test8b;
+ s_globalTest8b()->q->readConfig();
+ }
+
+ return s_globalTest8b()->q;
+}
+
+Test8b::Test8b( )
+ : Test8a()
+{
+ Q_ASSERT(!s_globalTest8b()->q);
+ s_globalTest8b()->q = this;
+ setCurrentGroup( QLatin1String( "Group8b1" ) );
+
+ Test8a::ItemUInt *itemSomething;
+ itemSomething = new Test8a::ItemUInt( currentGroup(), QLatin1String( "Something" ), mSomething, 60 );
+ addItem( itemSomething, QLatin1String( "Something" ) );
+
+ setCurrentGroup( QLatin1String( "Group8b2" ) );
+
+ Test8a::ItemBool *itemFooBoo;
+ itemFooBoo = new Test8a::ItemBool( currentGroup(), QLatin1String( "FooBoo" ), mFooBoo, false );
+ addItem( itemFooBoo, QLatin1String( "FooBoo" ) );
+ Test8a::ItemUInt *itemPort;
+ itemPort = new Test8a::ItemUInt( currentGroup(), QLatin1String( "Port" ), mPort, 1000 );
+ addItem( itemPort, QLatin1String( "Port" ) );
+}
+
+Test8b::~Test8b()
+{
+ s_globalTest8b()->q = 0;
+}
+
diff --git a/autotests/kconfig_compiler/test8b.h.ref b/autotests/kconfig_compiler/test8b.h.ref
new file mode 100644
index 00000000..140bbb90
--- /dev/null
+++ b/autotests/kconfig_compiler/test8b.h.ref
@@ -0,0 +1,92 @@
+// 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 <QCoreApplication>
+#include <QDebug>
+
+class Test8b : public Test8a
+{
+ public:
+
+ static Test8b *self();
+ ~Test8b();
+
+ /**
+ Set Something
+ */
+ static
+ void setSomething( uint v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "Something" ) ))
+ self()->mSomething = v;
+ }
+
+ /**
+ Get Something
+ */
+ static
+ uint something()
+ {
+ return self()->mSomething;
+ }
+
+ /**
+ Set FooBoo
+ */
+ static
+ void setFooBoo( bool v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "FooBoo" ) ))
+ self()->mFooBoo = v;
+ }
+
+ /**
+ Get FooBoo
+ */
+ static
+ bool fooBoo()
+ {
+ return self()->mFooBoo;
+ }
+
+ /**
+ Set Port
+ */
+ static
+ void setPort( uint v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "Port" ) ))
+ self()->mPort = v;
+ }
+
+ /**
+ Get Port
+ */
+ static
+ uint port()
+ {
+ return self()->mPort;
+ }
+
+ protected:
+ Test8b();
+ friend class Test8bHelper;
+
+
+ // Group8b1
+ uint mSomething;
+
+ // Group8b2
+ bool mFooBoo;
+ uint mPort;
+
+ private:
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test8b.kcfg b/autotests/kconfig_compiler/test8b.kcfg
new file mode 100644
index 00000000..3e203a15
--- /dev/null
+++ b/autotests/kconfig_compiler/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/autotests/kconfig_compiler/test8b.kcfgc b/autotests/kconfig_compiler/test8b.kcfgc
new file mode 100644
index 00000000..7be05520
--- /dev/null
+++ b/autotests/kconfig_compiler/test8b.kcfgc
@@ -0,0 +1,6 @@
+File=test8b.kcfg
+ClassName=Test8b
+Mutators=true
+Singleton=true
+IncludeFiles=test8a.h
+Inherits=Test8a
diff --git a/autotests/kconfig_compiler/test8main.cpp b/autotests/kconfig_compiler/test8main.cpp
new file mode 100644
index 00000000..c4576911
--- /dev/null
+++ b/autotests/kconfig_compiler/test8main.cpp
@@ -0,0 +1,36 @@
+/*
+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 <QGuiApplication>
+
+int main( int argc, char **argv )
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ Test8a *config1 = new Test8a( KSharedConfig::openConfig( QString() ) );
+ Test8a *config2 = new Test8a();
+ Test8b::self();
+ delete config1;
+ delete config2;
+ return 0;
+}
diff --git a/autotests/kconfig_compiler/test9.cpp.ref b/autotests/kconfig_compiler/test9.cpp.ref
new file mode 100644
index 00000000..af90acd9
--- /dev/null
+++ b/autotests/kconfig_compiler/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 QString & transport, const QString & folder )
+ : KConfigSkeleton( QLatin1String( "examplerc" ) )
+ , mParamtransport(transport)
+ , mParamfolder(folder)
+{
+ setCurrentGroup( QLatin1String( "MyOptionsXX" ) );
+
+ QStringList defaultMyStringList;
+ defaultMyStringList.append( QString::fromUtf8( "up" ) );
+ defaultMyStringList.append( QString::fromUtf8( "down" ) );
+
+ KConfigSkeleton::ItemStringList *itemMyStringList;
+ itemMyStringList = new KConfigSkeleton::ItemStringList( currentGroup(), QLatin1String( "MyStringList" ), mMyStringList, defaultMyStringList );
+ addItem( itemMyStringList, QLatin1String( "MyStringList" ) );
+ QStringList defaultMyPathList;
+ defaultMyPathList.append( QString::fromUtf8( "/home" ) );
+ defaultMyPathList.append( QString::fromUtf8( "~" ) );
+
+ KConfigSkeleton::ItemPathList *itemMyPathList;
+ itemMyPathList = new KConfigSkeleton::ItemPathList( currentGroup(), QLatin1String( "MyPathList" ), mMyPathList, defaultMyPathList );
+ addItem( itemMyPathList, QLatin1String( "MyPathList" ) );
+ KConfigSkeleton::ItemPathList *itemMyPathsList2;
+ itemMyPathsList2 = new KConfigSkeleton::ItemPathList( currentGroup(), QLatin1String( "MyPathsList2" ), mMyPathsList2, QStringList(QString::fromLatin1("/usr/bin")) << QDir::homePath() );
+ addItem( itemMyPathsList2, QLatin1String( "MyPathsList2" ) );
+}
+
+Test9::~Test9()
+{
+}
+
diff --git a/autotests/kconfig_compiler/test9.h.ref b/autotests/kconfig_compiler/test9.h.ref
new file mode 100644
index 00000000..02b3d479
--- /dev/null
+++ b/autotests/kconfig_compiler/test9.h.ref
@@ -0,0 +1,83 @@
+// 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 <QCoreApplication>
+#include <QDebug>
+
+#include <qdir.h>
+class Test9 : public KConfigSkeleton
+{
+ public:
+
+ Test9( const QString & transport, const QString & folder );
+ ~Test9();
+
+ /**
+ Set MyStringList
+ */
+ void setMyStringList( const QStringList & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "MyStringList" ) ))
+ mMyStringList = v;
+ }
+
+ /**
+ Get MyStringList
+ */
+ QStringList myStringList() const
+ {
+ return mMyStringList;
+ }
+
+ /**
+ Set This is a list of paths
+ */
+ void setMyPathList( const QStringList & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "MyPathList" ) ))
+ mMyPathList = v;
+ }
+
+ /**
+ Get This is a list of paths
+ */
+ QStringList myPathList() const
+ {
+ return mMyPathList;
+ }
+
+ /**
+ Set This is an additional test for PathList
+ */
+ void setMyPathsList2( const QStringList & v )
+ {
+ if (!isImmutable( QString::fromLatin1( "MyPathsList2" ) ))
+ mMyPathsList2 = v;
+ }
+
+ /**
+ Get This is an additional test for PathList
+ */
+ QStringList myPathsList2() const
+ {
+ return mMyPathsList2;
+ }
+
+ protected:
+ public:
+ QString mParamtransport;
+ QString mParamfolder;
+
+ // MyOptionsXX
+ QStringList mMyStringList;
+ QStringList mMyPathList;
+ QStringList mMyPathsList2;
+
+ private:
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test9.kcfg b/autotests/kconfig_compiler/test9.kcfg
new file mode 100644
index 00000000..73e96f49
--- /dev/null
+++ b/autotests/kconfig_compiler/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")) &lt;&lt; QDir::homePath()</default>
+ </entry>
+ </group>
+</kcfg>
diff --git a/autotests/kconfig_compiler/test9.kcfgc b/autotests/kconfig_compiler/test9.kcfgc
new file mode 100644
index 00000000..d4423338
--- /dev/null
+++ b/autotests/kconfig_compiler/test9.kcfgc
@@ -0,0 +1,18 @@
+# Code generation options for kconfig_compiler
+ClassName=Test9
+#
+# Singleton=false
+#
+# Inherits=KConfigSkeleton
+#
+# IncludeFiles=libkdepim/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/autotests/kconfig_compiler/test9main.cpp b/autotests/kconfig_compiler/test9main.cpp
new file mode 100644
index 00000000..352613aa
--- /dev/null
+++ b/autotests/kconfig_compiler/test9main.cpp
@@ -0,0 +1,45 @@
+/*
+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 <QtCore/QDir>
+#include <QGuiApplication>
+#include <QDebug>
+
+int main( int argc, char **argv )
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ Test9 *t = new Test9( QString(), QString() );
+
+ QStringList myPathsList2 = t->myPathsList2();
+ qWarning() << myPathsList2;
+
+ // add another path
+ QStringList newlist;
+ myPathsList2 << QDir::homePath() + QString::fromLatin1("/.kde");
+ qWarning() << myPathsList2;
+
+ t->setMyPathsList2(myPathsList2);
+ qWarning() << t->myPathsList2();
+
+ delete t;
+ return 0;
+}
diff --git a/autotests/kconfig_compiler/test_dpointer.cpp.ref b/autotests/kconfig_compiler/test_dpointer.cpp.ref
new file mode 100644
index 00000000..ffe931e5
--- /dev/null
+++ b/autotests/kconfig_compiler/test_dpointer.cpp.ref
@@ -0,0 +1,348 @@
+// 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 <qglobal.h>
+#include <QtCore/QFile>
+
+class TestDPointerPrivate
+{
+ public:
+
+ // General
+ bool autoSave;
+ int autoSaveInterval;
+ bool confirm;
+ QString archiveFile;
+ int destination;
+
+ // Views
+ int hourSize;
+ bool selectionStartsEditor;
+
+ // KOrganizer Plugins
+ QStringList selectedPlugins;
+
+ // Colors
+ QColor highlightColor;
+ QColor agendaBgColor;
+
+ // Fonts
+ QFont 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;
+};
+
+class TestDPointerHelper
+{
+ public:
+ TestDPointerHelper() : q(0) {}
+ ~TestDPointerHelper() { delete q; }
+ TestDPointer *q;
+};
+Q_GLOBAL_STATIC(TestDPointerHelper, s_globalTestDPointer)
+TestDPointer *TestDPointer::self()
+{
+ if (!s_globalTestDPointer()->q) {
+ new TestDPointer;
+ s_globalTestDPointer()->q->readConfig();
+ }
+
+ return s_globalTestDPointer()->q;
+}
+
+TestDPointer::TestDPointer( )
+ : KConfigSkeleton( QLatin1String( "korganizerrc" ) )
+{
+ d = new TestDPointerPrivate;
+ Q_ASSERT(!s_globalTestDPointer()->q);
+ s_globalTestDPointer()->q = this;
+ setCurrentGroup( QLatin1String( "General" ) );
+
+ d->autoSaveItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "Auto Save" ), d->autoSave, false );
+ d->autoSaveItem->setLabel( QCoreApplication::translate("TestDPointer", "Enable automatic saving of calendar") );
+ d->autoSaveItem->setWhatsThis( QCoreApplication::translate("TestDPointer", "WhatsThis text for AutoSave option") );
+ addItem( d->autoSaveItem, QLatin1String( "AutoSave" ) );
+ d->autoSaveIntervalItem = new KConfigSkeleton::ItemInt( currentGroup(), QLatin1String( "Auto Save Interval" ), d->autoSaveInterval, 10 );
+ d->autoSaveIntervalItem->setLabel( QCoreApplication::translate("TestDPointer", "Auto Save Interval") );
+ addItem( d->autoSaveIntervalItem, QLatin1String( "AutoSaveInterval" ) );
+ d->confirmItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "Confirm Deletes" ), d->confirm, true );
+ d->confirmItem->setLabel( QCoreApplication::translate("TestDPointer", "Confirm deletes") );
+ addItem( d->confirmItem, QLatin1String( "Confirm" ) );
+ d->archiveFileItem = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "Archive File" ), d->archiveFile );
+ d->archiveFileItem->setLabel( QCoreApplication::translate("TestDPointer", "Archive File") );
+ addItem( d->archiveFileItem, QLatin1String( "ArchiveFile" ) );
+ QList<KConfigSkeleton::ItemEnum::Choice> valuesDestination;
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("standardDestination");
+ valuesDestination.append( choice );
+ }
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("askDestination");
+ valuesDestination.append( choice );
+ }
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("argl1");
+ choice.label = QCoreApplication::translate("TestDPointer", "Argl1 Label");
+ valuesDestination.append( choice );
+ }
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("argl2");
+ choice.whatsThis = QCoreApplication::translate("TestDPointer", "Argl2 Whatsthis");
+ valuesDestination.append( choice );
+ }
+ {
+ KConfigSkeleton::ItemEnum::Choice choice;
+ choice.name = QLatin1String("argl3");
+ choice.label = QCoreApplication::translate("TestDPointer", "Argl3 Label");
+ choice.whatsThis = QCoreApplication::translate("TestDPointer", "Argl3 Whatsthis");
+ valuesDestination.append( choice );
+ }
+ d->destinationItem = new KConfigSkeleton::ItemEnum( currentGroup(), QLatin1String( "Destination" ), d->destination, valuesDestination, EnumDestination::standardDestination );
+ d->destinationItem->setLabel( QCoreApplication::translate("TestDPointer", "New Events/Todos Should") );
+ addItem( d->destinationItem, QLatin1String( "Destination" ) );
+
+ setCurrentGroup( QLatin1String( "Views" ) );
+
+ d->hourSizeItem = new KConfigSkeleton::ItemInt( currentGroup(), QLatin1String( "Hour Size" ), d->hourSize, 10 );
+ d->hourSizeItem->setLabel( QCoreApplication::translate("TestDPointer", "Hour Size") );
+ addItem( d->hourSizeItem, QLatin1String( "HourSize" ) );
+ d->selectionStartsEditorItem = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "SelectionStartsEditor" ), d->selectionStartsEditor, false );
+ d->selectionStartsEditorItem->setLabel( QCoreApplication::translate("TestDPointer", "Time range selection in agenda view starts event editor") );
+ addItem( d->selectionStartsEditorItem, QLatin1String( "SelectionStartsEditor" ) );
+
+ setCurrentGroup( QLatin1String( "KOrganizer Plugins" ) );
+
+ QStringList defaultSelectedPlugins;
+ defaultSelectedPlugins.append( QString::fromUtf8( "holidays" ) );
+ defaultSelectedPlugins.append( QString::fromUtf8( "webexport" ) );
+
+ d->selectedPluginsItem = new KConfigSkeleton::ItemStringList( currentGroup(), QLatin1String( "SelectedPlugins" ), d->selectedPlugins, defaultSelectedPlugins );
+ d->selectedPluginsItem->setLabel( QCoreApplication::translate("TestDPointer", "SelectedPlugins") );
+ addItem( d->selectedPluginsItem, QLatin1String( "SelectedPlugins" ) );
+
+ setCurrentGroup( QLatin1String( "Colors" ) );
+
+ d->highlightColorItem = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "Highlight Color" ), d->highlightColor, QColor( 100, 100, 255 ) );
+ d->highlightColorItem->setLabel( QCoreApplication::translate("TestDPointer", "Highlight color") );
+ addItem( d->highlightColorItem, QLatin1String( "HighlightColor" ) );
+ d->agendaBgColorItem = new KConfigSkeleton::ItemColor( currentGroup(), QLatin1String( "Agenda Background Color" ), d->agendaBgColor, QColor( 255, 255, 255 ) );
+ d->agendaBgColorItem->setLabel( QCoreApplication::translate("TestDPointer", "Agenda view background color") );
+ addItem( d->agendaBgColorItem, QLatin1String( "AgendaBgColor" ) );
+
+ setCurrentGroup( QLatin1String( "Fonts" ) );
+
+ d->timeBarFontItem = new KConfigSkeleton::ItemFont( currentGroup(), QLatin1String( "TimeBar Font" ), d->timeBarFont );
+ d->timeBarFontItem->setLabel( QCoreApplication::translate("TestDPointer", "Time bar") );
+ addItem( d->timeBarFontItem, QLatin1String( "TimeBarFont" ) );
+}
+
+void TestDPointer::setAutoSave( bool v )
+{
+ if (!self()->isImmutable( QString::fromLatin1( "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( QString::fromLatin1( "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( QString::fromLatin1( "Confirm" ) ))
+ self()->d->confirm = v;
+}
+
+bool TestDPointer::confirm()
+{
+ return self()->d->confirm;
+}
+
+
+KConfigSkeleton::ItemBool *TestDPointer::confirmItem()
+{
+ return d->confirmItem;
+}
+
+void TestDPointer::setArchiveFile( const QString & v )
+{
+ if (!self()->isImmutable( QString::fromLatin1( "ArchiveFile" ) ))
+ self()->d->archiveFile = v;
+}
+
+QString TestDPointer::archiveFile()
+{
+ return self()->d->archiveFile;
+}
+
+
+KConfigSkeleton::ItemString *TestDPointer::archiveFileItem()
+{
+ return d->archiveFileItem;
+}
+
+void TestDPointer::setDestination( int v )
+{
+ if (!self()->isImmutable( QString::fromLatin1( "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( QString::fromLatin1( "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( QString::fromLatin1( "SelectionStartsEditor" ) ))
+ self()->d->selectionStartsEditor = v;
+}
+
+bool TestDPointer::selectionStartsEditor()
+{
+ return self()->d->selectionStartsEditor;
+}
+
+
+KConfigSkeleton::ItemBool *TestDPointer::selectionStartsEditorItem()
+{
+ return d->selectionStartsEditorItem;
+}
+
+void TestDPointer::setSelectedPlugins( const QStringList & v )
+{
+ if (!self()->isImmutable( QString::fromLatin1( "SelectedPlugins" ) ))
+ self()->d->selectedPlugins = v;
+}
+
+QStringList TestDPointer::selectedPlugins()
+{
+ return self()->d->selectedPlugins;
+}
+
+
+KConfigSkeleton::ItemStringList *TestDPointer::selectedPluginsItem()
+{
+ return d->selectedPluginsItem;
+}
+
+void TestDPointer::setHighlightColor( const QColor & v )
+{
+ if (!self()->isImmutable( QString::fromLatin1( "HighlightColor" ) ))
+ self()->d->highlightColor = v;
+}
+
+QColor TestDPointer::highlightColor()
+{
+ return self()->d->highlightColor;
+}
+
+
+KConfigSkeleton::ItemColor *TestDPointer::highlightColorItem()
+{
+ return d->highlightColorItem;
+}
+
+void TestDPointer::setAgendaBgColor( const QColor & v )
+{
+ if (!self()->isImmutable( QString::fromLatin1( "AgendaBgColor" ) ))
+ self()->d->agendaBgColor = v;
+}
+
+QColor TestDPointer::agendaBgColor()
+{
+ return self()->d->agendaBgColor;
+}
+
+
+KConfigSkeleton::ItemColor *TestDPointer::agendaBgColorItem()
+{
+ return d->agendaBgColorItem;
+}
+
+void TestDPointer::setTimeBarFont( const QFont & v )
+{
+ if (!self()->isImmutable( QString::fromLatin1( "TimeBarFont" ) ))
+ self()->d->timeBarFont = v;
+}
+
+QFont TestDPointer::timeBarFont()
+{
+ return self()->d->timeBarFont;
+}
+
+
+KConfigSkeleton::ItemFont *TestDPointer::timeBarFontItem()
+{
+ return d->timeBarFontItem;
+}
+
+TestDPointer::~TestDPointer()
+{
+ delete d;
+ s_globalTestDPointer()->q = 0;
+}
+
diff --git a/autotests/kconfig_compiler/test_dpointer.h.ref b/autotests/kconfig_compiler/test_dpointer.h.ref
new file mode 100644
index 00000000..e10c8c7c
--- /dev/null
+++ b/autotests/kconfig_compiler/test_dpointer.h.ref
@@ -0,0 +1,220 @@
+// 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 <QCoreApplication>
+#include <QDebug>
+
+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 QString & v );
+
+ /**
+ Get Archive File
+ */
+ static
+ QString 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 QStringList & v );
+
+ /**
+ Get SelectedPlugins
+ */
+ static
+ QStringList selectedPlugins();
+
+ /**
+ Get Item object corresponding to SelectedPlugins()
+ */
+ ItemStringList *selectedPluginsItem();
+
+ /**
+ Set Highlight color
+ */
+ static
+ void setHighlightColor( const QColor & v );
+
+ /**
+ Get Highlight color
+ */
+ static
+ QColor highlightColor();
+
+ /**
+ Get Item object corresponding to HighlightColor()
+ */
+ ItemColor *highlightColorItem();
+
+ /**
+ Set Agenda view background color
+ */
+ static
+ void setAgendaBgColor( const QColor & v );
+
+ /**
+ Get Agenda view background color
+ */
+ static
+ QColor agendaBgColor();
+
+ /**
+ Get Item object corresponding to AgendaBgColor()
+ */
+ ItemColor *agendaBgColorItem();
+
+ /**
+ Set Time bar
+ */
+ static
+ void setTimeBarFont( const QFont & v );
+
+ /**
+ Get Time bar
+ */
+ static
+ QFont timeBarFont();
+
+ /**
+ Get Item object corresponding to TimeBarFont()
+ */
+ ItemFont *timeBarFontItem();
+
+ protected:
+ TestDPointer();
+ friend class TestDPointerHelper;
+
+ private:
+ TestDPointerPrivate *d;
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test_dpointer.kcfg b/autotests/kconfig_compiler/test_dpointer.kcfg
new file mode 100644
index 00000000..3b19e270
--- /dev/null
+++ b/autotests/kconfig_compiler/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/autotests/kconfig_compiler/test_dpointer.kcfgc b/autotests/kconfig_compiler/test_dpointer.kcfgc
new file mode 100644
index 00000000..48baa376
--- /dev/null
+++ b/autotests/kconfig_compiler/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/autotests/kconfig_compiler/test_dpointer_main.cpp b/autotests/kconfig_compiler/test_dpointer_main.cpp
new file mode 100644
index 00000000..6e4cb806
--- /dev/null
+++ b/autotests/kconfig_compiler/test_dpointer_main.cpp
@@ -0,0 +1,32 @@
+/*
+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 <QGuiApplication>
+
+int main( int argc, char **argv )
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ TestDPointer *t = TestDPointer::self();
+ delete t;
+ return 0;
+}
diff --git a/autotests/kconfig_compiler/test_signal.cpp.ref b/autotests/kconfig_compiler/test_signal.cpp.ref
new file mode 100644
index 00000000..1dad37b5
--- /dev/null
+++ b/autotests/kconfig_compiler/test_signal.cpp.ref
@@ -0,0 +1,73 @@
+// This file is generated by kconfig_compiler from test_signal.kcfg.
+// All changes you do to this file will be lost.
+
+#include "test_signal.h"
+
+#include <qglobal.h>
+#include <QtCore/QFile>
+
+class TestSignalHelper
+{
+ public:
+ TestSignalHelper() : q(0) {}
+ ~TestSignalHelper() { delete q; }
+ TestSignal *q;
+};
+Q_GLOBAL_STATIC(TestSignalHelper, s_globalTestSignal)
+TestSignal *TestSignal::self()
+{
+ if (!s_globalTestSignal()->q) {
+ new TestSignal;
+ s_globalTestSignal()->q->readConfig();
+ }
+
+ return s_globalTestSignal()->q;
+}
+
+TestSignal::TestSignal( )
+ : KConfigSkeleton( QLatin1String( "kconfig_compiler_test_rc" ) )
+ , mSettingsChanged(0)
+{
+ Q_ASSERT(!s_globalTestSignal()->q);
+ s_globalTestSignal()->q = this;
+ setCurrentGroup( QLatin1String( "Appearance" ) );
+
+ KConfigSkeleton::ItemString *itemEmoticonTheme;
+ itemEmoticonTheme = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "emoticonTheme" ), mEmoticonTheme, QLatin1String( "Default" ) );
+ addItem( itemEmoticonTheme, QLatin1String( "emoticonTheme" ) );
+ KConfigSkeleton::ItemBool *itemUseEmoticon;
+ itemUseEmoticon = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "useEmoticon" ), mUseEmoticon, true );
+ addItem( itemUseEmoticon, QLatin1String( "useEmoticon" ) );
+ KConfigSkeleton::ItemBool *itemEmoticonRequireSpace;
+ itemEmoticonRequireSpace = new KConfigSkeleton::ItemBool( currentGroup(), QLatin1String( "emoticonRequireSpace" ), mEmoticonRequireSpace, true );
+ addItem( itemEmoticonRequireSpace, QLatin1String( "emoticonRequireSpace" ) );
+ KConfigSkeleton::ItemString *itemStylePath;
+ itemStylePath = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "stylePath" ), mStylePath );
+ addItem( itemStylePath, QLatin1String( "stylePath" ) );
+ KConfigSkeleton::ItemString *itemStyleCSSVariant;
+ itemStyleCSSVariant = new KConfigSkeleton::ItemString( currentGroup(), QLatin1String( "styleVariant" ), mStyleCSSVariant );
+ addItem( itemStyleCSSVariant, QLatin1String( "StyleCSSVariant" ) );
+}
+
+TestSignal::~TestSignal()
+{
+ s_globalTestSignal()->q = 0;
+}
+
+bool TestSignal::usrWriteConfig()
+{
+ const bool res = KConfigSkeleton::usrWriteConfig();
+ if (!res) return false;
+
+ if ( mSettingsChanged & signalEmoticonSettingsChanged )
+ emit emoticonSettingsChanged();
+
+ if ( mSettingsChanged & signalStyleChanged )
+ emit styleChanged(mStylePath, mStyleCSSVariant);
+
+ mSettingsChanged = 0;
+ return true;
+}
+
+#include "test_signal.moc"
+
diff --git a/autotests/kconfig_compiler/test_signal.h.ref b/autotests/kconfig_compiler/test_signal.h.ref
new file mode 100644
index 00000000..801ff926
--- /dev/null
+++ b/autotests/kconfig_compiler/test_signal.h.ref
@@ -0,0 +1,153 @@
+// This file is generated by kconfig_compiler from test_signal.kcfg.
+// All changes you do to this file will be lost.
+#ifndef TESTSIGNAL_H
+#define TESTSIGNAL_H
+
+#include <kconfigskeleton.h>
+#include <QCoreApplication>
+#include <QDebug>
+
+class TestSignal : public KConfigSkeleton
+{
+ Q_OBJECT
+ public:
+
+ enum {
+ signalEmoticonSettingsChanged = 0x1,
+ signalStyleChanged = 0x2
+ };
+
+ static TestSignal *self();
+ ~TestSignal();
+
+ /**
+ Set Current emoticon theme.
+ */
+ static
+ void setEmoticonTheme( const QString & v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "emoticonTheme" ) )) {
+ self()->mEmoticonTheme = v;
+ self()->mSettingsChanged |= signalEmoticonSettingsChanged;
+ }
+ }
+
+ /**
+ Get Current emoticon theme.
+ */
+ static
+ QString emoticonTheme()
+ {
+ return self()->mEmoticonTheme;
+ }
+
+ /**
+ Set Enable emoticon support in Kopete.
+ */
+ static
+ void setUseEmoticon( bool v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "useEmoticon" ) )) {
+ self()->mUseEmoticon = v;
+ self()->mSettingsChanged |= signalEmoticonSettingsChanged;
+ }
+ }
+
+ /**
+ Get Enable emoticon support in Kopete.
+ */
+ static
+ bool useEmoticon()
+ {
+ return self()->mUseEmoticon;
+ }
+
+ /**
+ Set Use strict mode in emoticon parsing.
+ */
+ static
+ void setEmoticonRequireSpace( bool v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "emoticonRequireSpace" ) )) {
+ self()->mEmoticonRequireSpace = v;
+ self()->mSettingsChanged |= signalEmoticonSettingsChanged;
+ }
+ }
+
+ /**
+ Get Use strict mode in emoticon parsing.
+ */
+ static
+ bool emoticonRequireSpace()
+ {
+ return self()->mEmoticonRequireSpace;
+ }
+
+ /**
+ Set Absolute path to a directory containing a Adium/Kopete chat window style.
+ */
+ static
+ void setStylePath( const QString & v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "stylePath" ) )) {
+ self()->mStylePath = v;
+ self()->mSettingsChanged |= signalStyleChanged;
+ }
+ }
+
+ /**
+ Get Absolute path to a directory containing a Adium/Kopete chat window style.
+ */
+ static
+ QString stylePath()
+ {
+ return self()->mStylePath;
+ }
+
+ /**
+ Set Relative path to a CSS variant for the current style.
+ */
+ static
+ void setStyleCSSVariant( const QString & v )
+ {
+ if (!self()->isImmutable( QString::fromLatin1( "StyleCSSVariant" ) ))
+ self()->mStyleCSSVariant = v;
+ }
+
+ /**
+ Get Relative path to a CSS variant for the current style.
+ */
+ static
+ QString styleCSSVariant()
+ {
+ return self()->mStyleCSSVariant;
+ }
+
+
+ Q_SIGNALS:
+ void emoticonSettingsChanged();
+
+ /**
+ Tell when a complete style change.
+ */
+ void styleChanged(const QString & stylePath, const QString & StyleCSSVariant);
+
+ protected:
+ TestSignal();
+ friend class TestSignalHelper;
+
+ virtual bool usrWriteConfig();
+
+ // Appearance
+ QString mEmoticonTheme;
+ bool mUseEmoticon;
+ bool mEmoticonRequireSpace;
+ QString mStylePath;
+ QString mStyleCSSVariant;
+
+ private:
+ uint mSettingsChanged;
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test_signal.kcfg b/autotests/kconfig_compiler/test_signal.kcfg
new file mode 100644
index 00000000..1b2c36ec
--- /dev/null
+++ b/autotests/kconfig_compiler/test_signal.kcfg
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Author: Michaƫl Larouche-->
+<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="kconfig_compiler_test_rc"/>
+
+ <signal name="emoticonSettingsChanged" />
+
+ <signal name="styleChanged">
+ <label>Tell when a complete style change.</label>
+ <argument type="String">stylePath</argument>
+ <argument type="String">StyleCSSVariant</argument>
+ </signal>
+
+ <group name="Appearance">
+ <!-- Emoticon config -->
+ <entry key="emoticonTheme" type="String">
+ <label>Current emoticon theme.</label>
+ <default>Default</default>
+ <emit signal="emoticonSettingsChanged" />
+ </entry>
+ <entry key="useEmoticon" type="Bool">
+ <label>Enable emoticon support in Kopete.</label>
+ <default>true</default>
+ <emit signal="emoticonSettingsChanged" />
+ </entry>
+ <entry key="emoticonRequireSpace" type="Bool">
+ <label>Use strict mode in emoticon parsing.</label>
+ <default>true</default>
+ <emit signal="emoticonSettingsChanged" />
+ </entry>
+
+ <!-- Chat Window Style preferences -->
+ <entry key="stylePath" type="String">
+ <label>Absolute path to a directory containing a Adium/Kopete chat window style.</label>
+ <emit signal="styleChanged" />
+ </entry>
+
+ <entry key="styleVariant" type="String" name="StyleCSSVariant">
+ <label>Relative path to a CSS variant for the current style.</label>
+ </entry>
+ </group>
+</kcfg>
diff --git a/autotests/kconfig_compiler/test_signal.kcfgc b/autotests/kconfig_compiler/test_signal.kcfgc
new file mode 100644
index 00000000..b2a2fc06
--- /dev/null
+++ b/autotests/kconfig_compiler/test_signal.kcfgc
@@ -0,0 +1,7 @@
+File=test_signal.kcfg
+ClassName=TestSignal
+Singleton=true
+Mutators=true
+MemberVariables=private
+GlobalEnums=false
+ItemAccessors=false
diff --git a/autotests/kconfig_compiler/test_signal_main.cpp b/autotests/kconfig_compiler/test_signal_main.cpp
new file mode 100644
index 00000000..3189e79a
--- /dev/null
+++ b/autotests/kconfig_compiler/test_signal_main.cpp
@@ -0,0 +1,32 @@
+/*
+Copyright (c) 2006 Michael Larouche <michael.larouche@kdemail.net>
+
+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_signal.h"
+#include <QGuiApplication>
+
+int main( int argc, char **argv )
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ TestSignal *t = TestSignal::self();
+ delete t;
+ return 0;
+}