diff options
author | Jenkins CI <null@kde.org> | 2013-12-18 00:45:18 +0000 |
---|---|---|
committer | Jenkins CI <null@kde.org> | 2013-12-18 00:45:18 +0000 |
commit | 867e7a50e6396338ab4fe9aa22ad141e4cd344d2 (patch) | |
tree | 1d6f8d6c912fa04dc268b5580bcfe696fa538743 /tier1/kconfig/autotests | |
parent | c38b88497a833e482e6892b72c8f52adec6de857 (diff) | |
download | kconfig-867e7a50e6396338ab4fe9aa22ad141e4cd344d2.tar.gz kconfig-867e7a50e6396338ab4fe9aa22ad141e4cd344d2.tar.bz2 |
Move kconfig code to the root directory.
Diffstat (limited to 'tier1/kconfig/autotests')
110 files changed, 0 insertions, 10522 deletions
diff --git a/tier1/kconfig/autotests/CMakeLists.txt b/tier1/kconfig/autotests/CMakeLists.txt deleted file mode 100644 index e4790f69..00000000 --- a/tier1/kconfig/autotests/CMakeLists.txt +++ /dev/null @@ -1,59 +0,0 @@ - -remove_definitions(-DQT_NO_CAST_FROM_ASCII) - -include(ECMMarkAsTest) - -find_package(Qt5 5.2.0 CONFIG REQUIRED Concurrent Test Widgets) - -macro(KCONFIGCORE_UNIT_TESTS) - foreach(_testname ${ARGN}) - add_executable(${_testname} ${_testname}.cpp) # TODO NOGUI - add_test(kconfigcore-${_testname} ${_testname}) - target_link_libraries(${_testname} KF5::ConfigCore Qt5::Test Qt5::Concurrent) - ecm_mark_as_test(${_testname}) - endforeach() -endmacro() - -macro(KCONFIGGUI_UNIT_TESTS) - foreach(_testname ${ARGN}) - add_executable(${_testname} ${_testname}.cpp) - add_test(kconfiggui-${_testname} ${_testname}) - target_link_libraries(${_testname} KF5::ConfigGui Qt5::Test) - ecm_mark_as_test(${_testname}) - endforeach() -endmacro() - -kconfigcore_unit_tests( - kconfignokdehometest - kconfigtest - kdesktopfiletest - ksharedconfigtest - test_kconf_update -) - -target_include_directories(test_kconf_update PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/../src/kconf_update) - -# compile KEntryMap into the test since it's not exported -set(kentrymaptest_SRCS kentrymaptest.cpp ../src/core/kconfigdata.cpp) -add_executable(kentrymaptest ${kentrymaptest_SRCS}) -add_test(kconfigcore-kentrymaptest kentrymaptest) -target_link_libraries(kentrymaptest KF5::ConfigCore Qt5::Test) -ecm_mark_as_test(kentrymaptest) - -# compile KConfigUtils into the test since it's not exported -set(test_kconfigutils_SRCS test_kconfigutils ../src/kconf_update/kconfigutils.cpp) -add_executable(test_kconfigutils ${test_kconfigutils_SRCS}) -add_test(kconfigcore-test_kconfigutils test_kconfigutils) -target_link_libraries(test_kconfigutils KF5::ConfigCore Qt5::Test) -target_include_directories(test_kconfigutils PRIVATE ../src/kconf_update) -ecm_mark_as_test(test_kconfigutils) - -kconfiggui_unit_tests( - kconfigguitest - kconfigloadertest - kconfigskeletontest - kstandardshortcuttest -) - -add_subdirectory(kconfig_compiler) - diff --git a/tier1/kconfig/autotests/kconfig_compiler/CMakeLists.txt b/tier1/kconfig/autotests/kconfig_compiler/CMakeLists.txt deleted file mode 100644 index ef2fd407..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/CMakeLists.txt +++ /dev/null @@ -1,212 +0,0 @@ - -#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/tier1/kconfig/autotests/kconfig_compiler/kconfigcompiler_test.cpp b/tier1/kconfig/autotests/kconfig_compiler/kconfigcompiler_test.cpp deleted file mode 100644 index a9bf52c8..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/kconfigcompiler_test.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* - 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/tier1/kconfig/autotests/kconfig_compiler/kconfigcompiler_test.h b/tier1/kconfig/autotests/kconfig_compiler/kconfigcompiler_test.h deleted file mode 100644 index 53ad18a0..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/kconfigcompiler_test.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - 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/tier1/kconfig/autotests/kconfig_compiler/myprefs.h b/tier1/kconfig/autotests/kconfig_compiler/myprefs.h deleted file mode 100644 index 4d12eeb7..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/myprefs.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef MYPREFS_H -#define MYPREFS_H - -#include <kconfigskeleton.h> - -class MyPrefs : public KConfigSkeleton -{ - public: - MyPrefs( const QString &a ) : KConfigSkeleton( a ) {} -}; - -#endif diff --git a/tier1/kconfig/autotests/kconfig_compiler/test1.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test1.cpp.ref deleted file mode 100644 index 611ce5c1..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test1.cpp.ref +++ /dev/null @@ -1,72 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test1.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test1.h.ref deleted file mode 100644 index 57fa4bf8..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test1.h.ref +++ /dev/null @@ -1,197 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test1.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test1.kcfg deleted file mode 100644 index 819bdac5..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test1.kcfg +++ /dev/null @@ -1,55 +0,0 @@ -<?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/tier1/kconfig/autotests/kconfig_compiler/test1.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test1.kcfgc deleted file mode 100644 index 6e0edd36..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test1.kcfgc +++ /dev/null @@ -1,18 +0,0 @@ -# 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/tier1/kconfig/autotests/kconfig_compiler/test10.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test10.cpp.ref deleted file mode 100644 index ac28ab2f..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test10.cpp.ref +++ /dev/null @@ -1,46 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test10.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test10.h.ref deleted file mode 100644 index f3f441d3..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test10.h.ref +++ /dev/null @@ -1,50 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test10.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test10.kcfg deleted file mode 100644 index d7be2c3d..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test10.kcfg +++ /dev/null @@ -1,13 +0,0 @@ -<?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/tier1/kconfig/autotests/kconfig_compiler/test10.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test10.kcfgc deleted file mode 100644 index 83ac2111..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test10.kcfgc +++ /dev/null @@ -1,4 +0,0 @@ -# Code generation options for kconfig_compiler -File=test10.kcfg -ClassName=Test10 -Singleton=true diff --git a/tier1/kconfig/autotests/kconfig_compiler/test10main.cpp b/tier1/kconfig/autotests/kconfig_compiler/test10main.cpp deleted file mode 100644 index 9e9a7db8..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test10main.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test11.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test11.cpp.ref deleted file mode 100644 index 5a1f5b92..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test11.cpp.ref +++ /dev/null @@ -1,278 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test11.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test11.h.ref deleted file mode 100644 index b5eeb74c..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test11.h.ref +++ /dev/null @@ -1,572 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test11.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test11.kcfg deleted file mode 100644 index d82e1326..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test11.kcfg +++ /dev/null @@ -1,136 +0,0 @@ -<?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"><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></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< 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 ); - </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/tier1/kconfig/autotests/kconfig_compiler/test11.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test11.kcfgc deleted file mode 100644 index 2b6fee15..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test11.kcfgc +++ /dev/null @@ -1,13 +0,0 @@ -# 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/tier1/kconfig/autotests/kconfig_compiler/test11_types.h b/tier1/kconfig/autotests/kconfig_compiler/test11_types.h deleted file mode 100644 index 5b21aa97..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test11_types.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test11a.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test11a.cpp.ref deleted file mode 100644 index f826fc16..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test11a.cpp.ref +++ /dev/null @@ -1,187 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test11a.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test11a.h.ref deleted file mode 100644 index 4410ce29..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test11a.h.ref +++ /dev/null @@ -1,480 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test11a.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test11a.kcfg deleted file mode 100644 index da027067..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test11a.kcfg +++ /dev/null @@ -1,135 +0,0 @@ -<?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"><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></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< 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 ); - </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/tier1/kconfig/autotests/kconfig_compiler/test11a.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test11a.kcfgc deleted file mode 100644 index cf0b0d8d..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test11a.kcfgc +++ /dev/null @@ -1,13 +0,0 @@ -# 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/tier1/kconfig/autotests/kconfig_compiler/test11main.cpp b/tier1/kconfig/autotests/kconfig_compiler/test11main.cpp deleted file mode 100644 index 4f5fc80c..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test11main.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test12.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test12.cpp.ref deleted file mode 100644 index 69d5bba9..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test12.cpp.ref +++ /dev/null @@ -1,22 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test12.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test12.h.ref deleted file mode 100644 index d55414ec..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test12.h.ref +++ /dev/null @@ -1,36 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test12.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test12.kcfg deleted file mode 100644 index 57663ab9..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test12.kcfg +++ /dev/null @@ -1,10 +0,0 @@ -<?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/tier1/kconfig/autotests/kconfig_compiler/test12.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test12.kcfgc deleted file mode 100644 index 1ed82e7e..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test12.kcfgc +++ /dev/null @@ -1 +0,0 @@ -ClassName=Test12 diff --git a/tier1/kconfig/autotests/kconfig_compiler/test12main.cpp b/tier1/kconfig/autotests/kconfig_compiler/test12main.cpp deleted file mode 100644 index b8a05294..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test12main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test1main.cpp b/tier1/kconfig/autotests/kconfig_compiler/test1main.cpp deleted file mode 100644 index f1f61c0a..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test1main.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test2.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test2.cpp.ref deleted file mode 100644 index 476b34c5..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test2.cpp.ref +++ /dev/null @@ -1,96 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test2.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test2.h.ref deleted file mode 100644 index 49af161e..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test2.h.ref +++ /dev/null @@ -1,335 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test2.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test2.kcfg deleted file mode 100644 index 3b19e270..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test2.kcfg +++ /dev/null @@ -1,78 +0,0 @@ -<?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/tier1/kconfig/autotests/kconfig_compiler/test2.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test2.kcfgc deleted file mode 100644 index 56620d2f..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test2.kcfgc +++ /dev/null @@ -1,11 +0,0 @@ -# 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/tier1/kconfig/autotests/kconfig_compiler/test2main.cpp b/tier1/kconfig/autotests/kconfig_compiler/test2main.cpp deleted file mode 100644 index 80203c65..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test2main.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test3.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test3.cpp.ref deleted file mode 100644 index 0c9187a1..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test3.cpp.ref +++ /dev/null @@ -1,29 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test3.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test3.h.ref deleted file mode 100644 index 931e2e26..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test3.h.ref +++ /dev/null @@ -1,140 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test3.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test3.kcfg deleted file mode 100644 index 77916da4..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test3.kcfg +++ /dev/null @@ -1,26 +0,0 @@ -<?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/tier1/kconfig/autotests/kconfig_compiler/test3.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test3.kcfgc deleted file mode 100644 index ca2c2205..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test3.kcfgc +++ /dev/null @@ -1,12 +0,0 @@ -# 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/tier1/kconfig/autotests/kconfig_compiler/test3a.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test3a.cpp.ref deleted file mode 100644 index 34321e9e..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test3a.cpp.ref +++ /dev/null @@ -1,29 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test3a.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test3a.h.ref deleted file mode 100644 index 56d672a3..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test3a.h.ref +++ /dev/null @@ -1,142 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test3a.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test3a.kcfg deleted file mode 100644 index d49b4d65..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test3a.kcfg +++ /dev/null @@ -1,26 +0,0 @@ -<?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/tier1/kconfig/autotests/kconfig_compiler/test3a.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test3a.kcfgc deleted file mode 100644 index ca849a81..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test3a.kcfgc +++ /dev/null @@ -1,12 +0,0 @@ -# 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/tier1/kconfig/autotests/kconfig_compiler/test3amain.cpp b/tier1/kconfig/autotests/kconfig_compiler/test3amain.cpp deleted file mode 100644 index fa33f1cb..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test3amain.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test3main.cpp b/tier1/kconfig/autotests/kconfig_compiler/test3main.cpp deleted file mode 100644 index bf2846c1..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test3main.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test4.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test4.cpp.ref deleted file mode 100644 index 171d655d..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test4.cpp.ref +++ /dev/null @@ -1,178 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test4.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test4.h.ref deleted file mode 100644 index 991a4f7d..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test4.h.ref +++ /dev/null @@ -1,171 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test4.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test4.kcfg deleted file mode 100644 index 0919b46f..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test4.kcfg +++ /dev/null @@ -1,56 +0,0 @@ -<?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/tier1/kconfig/autotests/kconfig_compiler/test4.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test4.kcfgc deleted file mode 100644 index 754706df..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test4.kcfgc +++ /dev/null @@ -1,11 +0,0 @@ -# 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/tier1/kconfig/autotests/kconfig_compiler/test4main.cpp b/tier1/kconfig/autotests/kconfig_compiler/test4main.cpp deleted file mode 100644 index 3ef924c8..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test4main.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test5.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test5.cpp.ref deleted file mode 100644 index 2a95dcda..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test5.cpp.ref +++ /dev/null @@ -1,88 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test5.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test5.h.ref deleted file mode 100644 index 46a591c1..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test5.h.ref +++ /dev/null @@ -1,123 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test5.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test5.kcfg deleted file mode 100644 index d8ef2bfa..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test5.kcfg +++ /dev/null @@ -1,42 +0,0 @@ -<?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/tier1/kconfig/autotests/kconfig_compiler/test5.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test5.kcfgc deleted file mode 100644 index 663005e5..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test5.kcfgc +++ /dev/null @@ -1,11 +0,0 @@ -# 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/tier1/kconfig/autotests/kconfig_compiler/test5main.cpp b/tier1/kconfig/autotests/kconfig_compiler/test5main.cpp deleted file mode 100644 index 55e30d07..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test5main.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test6.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test6.cpp.ref deleted file mode 100644 index 0fce03a3..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test6.cpp.ref +++ /dev/null @@ -1,31 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test6.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test6.h.ref deleted file mode 100644 index f1fb59fd..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test6.h.ref +++ /dev/null @@ -1,94 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test6.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test6.kcfg deleted file mode 100644 index e59fa88f..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test6.kcfg +++ /dev/null @@ -1,25 +0,0 @@ -<?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/tier1/kconfig/autotests/kconfig_compiler/test6.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test6.kcfgc deleted file mode 100644 index b69dc152..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test6.kcfgc +++ /dev/null @@ -1,11 +0,0 @@ -# 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/tier1/kconfig/autotests/kconfig_compiler/test6main.cpp b/tier1/kconfig/autotests/kconfig_compiler/test6main.cpp deleted file mode 100644 index a60d8378..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test6main.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test7.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test7.cpp.ref deleted file mode 100644 index 4ee7d280..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test7.cpp.ref +++ /dev/null @@ -1,31 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test7.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test7.h.ref deleted file mode 100644 index 417c75ad..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test7.h.ref +++ /dev/null @@ -1,94 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test7.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test7.kcfg deleted file mode 100644 index 0a7fd327..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test7.kcfg +++ /dev/null @@ -1,25 +0,0 @@ -<?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/tier1/kconfig/autotests/kconfig_compiler/test7.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test7.kcfgc deleted file mode 100644 index 9a6c4095..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test7.kcfgc +++ /dev/null @@ -1,11 +0,0 @@ -# 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/tier1/kconfig/autotests/kconfig_compiler/test7main.cpp b/tier1/kconfig/autotests/kconfig_compiler/test7main.cpp deleted file mode 100644 index bf55be20..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test7main.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test8a.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test8a.cpp.ref deleted file mode 100644 index af85f0ce..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test8a.cpp.ref +++ /dev/null @@ -1,22 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test8a.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test8a.h.ref deleted file mode 100644 index fd1b3648..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test8a.h.ref +++ /dev/null @@ -1,62 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test8a.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test8a.kcfg deleted file mode 100644 index 24038a69..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test8a.kcfg +++ /dev/null @@ -1,17 +0,0 @@ -<?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/tier1/kconfig/autotests/kconfig_compiler/test8a.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test8a.kcfgc deleted file mode 100644 index 5f63c31c..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test8a.kcfgc +++ /dev/null @@ -1,3 +0,0 @@ -File=test8a.kcfg -ClassName=Test8a -Mutators=true diff --git a/tier1/kconfig/autotests/kconfig_compiler/test8b.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test8b.cpp.ref deleted file mode 100644 index ba0c8b47..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test8b.cpp.ref +++ /dev/null @@ -1,52 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test8b.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test8b.h.ref deleted file mode 100644 index 140bbb90..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test8b.h.ref +++ /dev/null @@ -1,92 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test8b.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test8b.kcfg deleted file mode 100644 index 3e203a15..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test8b.kcfg +++ /dev/null @@ -1,21 +0,0 @@ -<?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/tier1/kconfig/autotests/kconfig_compiler/test8b.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test8b.kcfgc deleted file mode 100644 index 7be05520..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test8b.kcfgc +++ /dev/null @@ -1,6 +0,0 @@ -File=test8b.kcfg -ClassName=Test8b -Mutators=true -Singleton=true -IncludeFiles=test8a.h -Inherits=Test8a diff --git a/tier1/kconfig/autotests/kconfig_compiler/test8main.cpp b/tier1/kconfig/autotests/kconfig_compiler/test8main.cpp deleted file mode 100644 index c4576911..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test8main.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test9.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test9.cpp.ref deleted file mode 100644 index af90acd9..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test9.cpp.ref +++ /dev/null @@ -1,35 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test9.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test9.h.ref deleted file mode 100644 index 02b3d479..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test9.h.ref +++ /dev/null @@ -1,83 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test9.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test9.kcfg deleted file mode 100644 index 73e96f49..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test9.kcfg +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 - http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > - <include>qdir.h</include> - <kcfgfile name="examplerc"> - <parameter name="transport" /> - <parameter name="folder" /> - </kcfgfile> - <group name="MyOptionsXX"> - <entry name="MyStringList" type="StringList"> - <default>up,down</default> - </entry> - <entry name="MyPathList" type="PathList"> - <label>This is a list of paths</label> - <default>/home,~</default> - </entry> - <entry name="MyPathsList2" type="PathList"> - <label>This is an additional test for PathList</label> - <default code="true">QStringList(QString::fromLatin1("/usr/bin")) << QDir::homePath()</default> - </entry> - </group> -</kcfg> diff --git a/tier1/kconfig/autotests/kconfig_compiler/test9.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test9.kcfgc deleted file mode 100644 index d4423338..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test9.kcfgc +++ /dev/null @@ -1,18 +0,0 @@ -# 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/tier1/kconfig/autotests/kconfig_compiler/test9main.cpp b/tier1/kconfig/autotests/kconfig_compiler/test9main.cpp deleted file mode 100644 index 352613aa..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test9main.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test_dpointer.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test_dpointer.cpp.ref deleted file mode 100644 index ffe931e5..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test_dpointer.cpp.ref +++ /dev/null @@ -1,348 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test_dpointer.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test_dpointer.h.ref deleted file mode 100644 index e10c8c7c..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test_dpointer.h.ref +++ /dev/null @@ -1,220 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test_dpointer.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test_dpointer.kcfg deleted file mode 100644 index 3b19e270..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test_dpointer.kcfg +++ /dev/null @@ -1,78 +0,0 @@ -<?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/tier1/kconfig/autotests/kconfig_compiler/test_dpointer.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test_dpointer.kcfgc deleted file mode 100644 index 48baa376..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test_dpointer.kcfgc +++ /dev/null @@ -1,11 +0,0 @@ -# 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/tier1/kconfig/autotests/kconfig_compiler/test_dpointer_main.cpp b/tier1/kconfig/autotests/kconfig_compiler/test_dpointer_main.cpp deleted file mode 100644 index 6e4cb806..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test_dpointer_main.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* -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/tier1/kconfig/autotests/kconfig_compiler/test_signal.cpp.ref b/tier1/kconfig/autotests/kconfig_compiler/test_signal.cpp.ref deleted file mode 100644 index 1dad37b5..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test_signal.cpp.ref +++ /dev/null @@ -1,73 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test_signal.h.ref b/tier1/kconfig/autotests/kconfig_compiler/test_signal.h.ref deleted file mode 100644 index 801ff926..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test_signal.h.ref +++ /dev/null @@ -1,153 +0,0 @@ -// 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/tier1/kconfig/autotests/kconfig_compiler/test_signal.kcfg b/tier1/kconfig/autotests/kconfig_compiler/test_signal.kcfg deleted file mode 100644 index 1b2c36ec..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test_signal.kcfg +++ /dev/null @@ -1,45 +0,0 @@ -<?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/tier1/kconfig/autotests/kconfig_compiler/test_signal.kcfgc b/tier1/kconfig/autotests/kconfig_compiler/test_signal.kcfgc deleted file mode 100644 index b2a2fc06..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test_signal.kcfgc +++ /dev/null @@ -1,7 +0,0 @@ -File=test_signal.kcfg -ClassName=TestSignal -Singleton=true -Mutators=true -MemberVariables=private -GlobalEnums=false -ItemAccessors=false diff --git a/tier1/kconfig/autotests/kconfig_compiler/test_signal_main.cpp b/tier1/kconfig/autotests/kconfig_compiler/test_signal_main.cpp deleted file mode 100644 index 3189e79a..00000000 --- a/tier1/kconfig/autotests/kconfig_compiler/test_signal_main.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* -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; -} diff --git a/tier1/kconfig/autotests/kconfigguitest.cpp b/tier1/kconfig/autotests/kconfigguitest.cpp deleted file mode 100644 index 225f1719..00000000 --- a/tier1/kconfig/autotests/kconfigguitest.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include <QtTest/QtTestGui> -#include "kconfigguitest.h" - -#include <kconfig.h> -#include <QDir> -#include <QFont> -#include <kconfiggroup.h> -#include <kconfigskeleton.h> - -QTEST_MAIN( KConfigTest ) - -#define COLORENTRY1 QColor("steelblue") -#define COLORENTRY2 QColor(235, 235, 100, 125) -#define COLORENTRY3 QColor(234, 234, 127) -#define FONTENTRY QFont("Times", 16, QFont::Normal) - -void KConfigTest::initTestCase() -{ - // cheat the linker on windows to link against kconfiggui - KConfigSkeleton foo; - Q_UNUSED(foo); - - KConfig sc( "kconfigtest" ); - - KConfigGroup cg(&sc, "ComplexTypes"); - cg.writeEntry( "colorEntry1", COLORENTRY1 ); - cg.writeEntry( "colorEntry2", COLORENTRY2 ); - cg.writeEntry( "colorEntry3", (QList<int>() << 234 << 234 << 127)); - cg.writeEntry( "colorEntry4", (QList<int>() << 235 << 235 << 100 << 125)); - cg.writeEntry( "fontEntry", FONTENTRY ); - QVERIFY(sc.sync()); - - KConfig sc1("kdebugrc"); - KConfigGroup sg0(&sc1, "0"); - sg0.writeEntry("AbortFatal", false); - sg0.writeEntry("WarnOutput", 0); - sg0.writeEntry("FatalOutput", 0); - QVERIFY(sc1.sync()); -} - -void KConfigTest::cleanupTestCase() -{ - QDir local(QDir::homePath() + "/.kde-unit-test/share/config"); - - Q_FOREACH(const QString &file, local.entryList(QDir::Files)) - if(!local.remove(file)) - qWarning("%s: removing failed", qPrintable( file )); - - QCOMPARE((int)local.entryList(QDir::Files).count(), 0); - - local.cdUp(); - local.rmpath("config"); -} - -void KConfigTest::testComplex() -{ - KConfig sc2( "kconfigtest" ); - KConfigGroup sc3(&sc2, "ComplexTypes"); - - QCOMPARE( QVariant(sc3.readEntry( "colorEntry1", QColor(Qt::black) )).toString(), - QVariant(COLORENTRY1).toString() ); - QCOMPARE( sc3.readEntry( "colorEntry1", QColor() ), COLORENTRY1 ); - QCOMPARE( sc3.readEntry( "colorEntry2", QColor() ), COLORENTRY2 ); - QCOMPARE( sc3.readEntry( "colorEntry3", QColor() ), COLORENTRY3 ); - QCOMPARE( sc3.readEntry( "colorEntry4", QColor() ), COLORENTRY2 ); - QCOMPARE( sc3.readEntry( "defaultColorTest", QColor("black") ), QColor("black") ); - QCOMPARE( sc3.readEntry( "fontEntry", QFont() ), FONTENTRY ); -} - -void KConfigTest::testInvalid() -{ - KConfig sc( "kconfigtest" ); - - // all of these should print a message to the kdebug.dbg file - KConfigGroup sc3(&sc, "InvalidTypes" ); - - QList<int> list; - - // 1 element list - list << 1; - sc3.writeEntry( QString("badList"), list); - QVERIFY(sc.sync()); - - QVERIFY( sc3.readEntry( "badList", QColor() ) == QColor() ); - - // 2 element list - list << 2; - sc3.writeEntry( "badList", list); - QVERIFY(sc.sync()); - - QVERIFY( sc3.readEntry( "badList", QColor() ) == QColor() ); - - // 3 element list - list << 303; - sc3.writeEntry( "badList", list); - QVERIFY(sc.sync()); - - QVERIFY( sc3.readEntry( "badList", QColor() ) == QColor() ); // out of bounds - - // 4 element list - list << 4; - sc3.writeEntry( "badList", list ); - QVERIFY(sc.sync()); - - QVERIFY( sc3.readEntry( "badList", QColor() ) == QColor() ); // out of bounds - - list[2] = -3; - sc3.writeEntry( "badList", list ); - QVERIFY(sc.sync()); - QVERIFY( sc3.readEntry( "badList", QColor() ) == QColor() ); // out of bounds - - // 5 element list - list[2] = 3; - list << 5; - sc3.writeEntry( "badList", list); - QVERIFY(sc.sync()); - - QVERIFY( sc3.readEntry( "badList", QColor() ) == QColor() ); - - // 6 element list - list << 6; - sc3.writeEntry( "badList", list); - QVERIFY(sc.sync()); - - QVERIFY( sc3.readEntry( "badList", QColor() ) == QColor() ); -} diff --git a/tier1/kconfig/autotests/kconfigguitest.h b/tier1/kconfig/autotests/kconfigguitest.h deleted file mode 100644 index 2ac7261d..00000000 --- a/tier1/kconfig/autotests/kconfigguitest.h +++ /dev/null @@ -1,35 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef KCONFIGTEST_H -#define KCONFIGTEST_H - -#include <QtCore/QObject> - -class KConfigTest : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void testComplex(); - void testInvalid(); - void initTestCase(); - void cleanupTestCase(); -}; - -#endif /* KCONFIGTEST_H */ diff --git a/tier1/kconfig/autotests/kconfigloadertest.cpp b/tier1/kconfig/autotests/kconfigloadertest.cpp deleted file mode 100644 index a4403da9..00000000 --- a/tier1/kconfig/autotests/kconfigloadertest.cpp +++ /dev/null @@ -1,208 +0,0 @@ -/******************************************************************************** -* Copyright 2010 by Martin Blumenstingl <darklight.xdarklight@googlemail.com> * -* * -* This library is free software; you can redistribute it and/or * -* modify it under the terms of the GNU Library General Public * -* License as published by the Free Software Foundation; either * -* version 2 of the License, or (at your option) any later version. * -* * -* This library is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * -* Library General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public License * -* along with this library; see the file COPYING.LIB. If not, write to * -* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * -* Boston, MA 02110-1301, USA. * -*********************************************************************************/ -#include "kconfigloadertest.h" - -#include <kconfig.h> -#include <kconfiggroup.h> -#include <kconfigskeleton.h> -#include <kconfigloader.h> - -Q_DECLARE_METATYPE(QList<int>) - -#define TEST_NAME QString::fromLatin1("kconfigloadertest") - -#define GET_CONFIG_ITEM_VALUE(type, configName) \ - KConfigSkeletonItem* item = cl->findItem(TEST_NAME, configName); \ - /* Check if we got back a valid item. */ \ - QVERIFY(item != 0); \ - /* Cast the item to the given type. */ \ - type typeItem = dynamic_cast<type>(item); \ - /* Make sure the cast was successful. */ \ - QVERIFY(typeItem != 0); - -void ConfigLoaderTest::init() -{ - QString fileName = TEST_NAME + QString::fromLatin1(".xml"); - configFile = new QFile(QFINDTESTDATA(QString::fromLatin1("/") + fileName)); - cl = new KConfigLoader(configFile->fileName(), configFile); -} - -void ConfigLoaderTest::cleanup() -{ - delete cl; - delete configFile; -} - -void ConfigLoaderTest::boolDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemBool*, "DefaultBoolItem"); - - QVERIFY(typeItem->isEqual(true)); -} - -void ConfigLoaderTest::colorDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemColor*, "DefaultColorItem"); - - QVERIFY(typeItem->isEqual(QColor("#00FF00"))); -} - -void ConfigLoaderTest::dateTimeDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemDateTime*, "DefaultDateTimeItem"); - - QVERIFY(typeItem->isEqual(QDateTime::fromString("Thu Sep 09 2010"))); -} - -void ConfigLoaderTest::enumDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemEnum*, "DefaultEnumItem"); - - QVERIFY(typeItem->isEqual(3)); -} - -void ConfigLoaderTest::fontDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemFont*, "DefaultFontItem"); - - QVERIFY(typeItem->isEqual(QFont("DejaVu Sans"))); -} - -void ConfigLoaderTest::intDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemInt*, "DefaultIntItem"); - - QVERIFY(typeItem->isEqual(27)); -} - -void ConfigLoaderTest::passwordDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemPassword*, "DefaultPasswordItem"); - - QVERIFY(typeItem->isEqual(QString::fromLatin1("h4x."))); -} - -void ConfigLoaderTest::pathDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemPath*, "DefaultPathItem"); - - QVERIFY(typeItem->isEqual(QString::fromLatin1("/dev/null"))); -} - -void ConfigLoaderTest::stringDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemString*, "DefaultStringItem"); - - QVERIFY(typeItem->isEqual(QString::fromLatin1("TestString"))); -} - -void ConfigLoaderTest::stringListDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KConfigSkeleton::ItemStringList*, "DefaultStringListItem"); - - // Create a string list with the expected values. - QStringList expected; - expected.append("One"); - expected.append("Two"); - expected.append("Three"); - expected.append("Four"); - expected.append("Five"); - - QVERIFY(typeItem->isEqual(expected)); -} - -void ConfigLoaderTest::uintDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemUInt*, "DefaultUIntItem"); - - QVERIFY(typeItem->isEqual(7U)); -} - -void ConfigLoaderTest::urlDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemUrl*, "DefaultUrlItem"); - - QVERIFY(typeItem->isEqual(QUrl("http://kde.org"))); -} - -void ConfigLoaderTest::doubleDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemDouble*, "DefaultDoubleItem"); - - QVERIFY(typeItem->isEqual(13.37)); -} - -void ConfigLoaderTest::intListDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemIntList*, "DefaultIntListItem"); - - // Create a int list with the expected values. - QList<int> expected; - expected.append(1); - expected.append(1); - expected.append(2); - expected.append(3); - expected.append(5); - expected.append(8); - - QVERIFY(typeItem->isEqual(qVariantFromValue(expected))); -} - -void ConfigLoaderTest::longLongDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemLongLong*, "DefaultLongLongItem"); - - QVERIFY(typeItem->isEqual(Q_INT64_C(-9211372036854775808))); -} - -void ConfigLoaderTest::pointDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemPoint*, "DefaultPointItem"); - - QVERIFY(typeItem->isEqual(QPoint(185, 857))); -} - -void ConfigLoaderTest::rectDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemRect*, "DefaultRectItem"); - - // Create a new QRect with the expected value. - QRect expected; - expected.setCoords(3, 7, 951, 358); - - QVERIFY(typeItem->isEqual(expected)); -} - -void ConfigLoaderTest::sizeDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemSize*, "DefaultSizeItem"); - - QVERIFY(typeItem->isEqual(QSize(640, 480))); -} - -void ConfigLoaderTest::ulongLongDefaultValue() -{ - GET_CONFIG_ITEM_VALUE(KCoreConfigSkeleton::ItemULongLong*, "DefaultULongLongItem"); - - QVERIFY(typeItem->isEqual(Q_UINT64_C(9223372036854775806))); -} - - -QTEST_MAIN(ConfigLoaderTest) - diff --git a/tier1/kconfig/autotests/kconfigloadertest.h b/tier1/kconfig/autotests/kconfigloadertest.h deleted file mode 100644 index be8c7629..00000000 --- a/tier1/kconfig/autotests/kconfigloadertest.h +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************** -* Copyright 2010 by Martin Blumenstingl <darklight.xdarklight@googlemail.com> * -* * -* This library is free software; you can redistribute it and/or * -* modify it under the terms of the GNU Library General Public * -* License as published by the Free Software Foundation; either * -* version 2 of the License, or (at your option) any later version. * -* * -* This library is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * -* Library General Public License for more details. * -* * -* You should have received a copy of the GNU Library General Public License * -* along with this library; see the file COPYING.LIB. If not, write to * -* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * -* Boston, MA 02110-1301, USA. * -*********************************************************************************/ - -#ifndef KCONFIGLOADERTEST_H -#define KCONFIGLOADERTEST_H - -#include <QtTest/QtTest> - -class KConfigLoader; - -class QFile; - -class ConfigLoaderTest : public QObject -{ - Q_OBJECT - -public Q_SLOTS: - void init(); - void cleanup(); - -private Q_SLOTS: - void boolDefaultValue(); - void colorDefaultValue(); - void dateTimeDefaultValue(); - void enumDefaultValue(); - void fontDefaultValue(); - void intDefaultValue(); - void passwordDefaultValue(); - void pathDefaultValue(); - void stringDefaultValue(); - void stringListDefaultValue(); - void uintDefaultValue(); - void urlDefaultValue(); - void doubleDefaultValue(); - void intListDefaultValue(); - void longLongDefaultValue(); - void pointDefaultValue(); - void rectDefaultValue(); - void sizeDefaultValue(); - void ulongLongDefaultValue(); - -private: - KConfigLoader* cl; - QFile* configFile; -}; - -#endif diff --git a/tier1/kconfig/autotests/kconfigloadertest.xml b/tier1/kconfig/autotests/kconfigloadertest.xml deleted file mode 100644 index 024880f4..00000000 --- a/tier1/kconfig/autotests/kconfigloadertest.xml +++ /dev/null @@ -1,71 +0,0 @@ -<?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="keystatusplasmoidrc"/> - - <group name="kconfigloadertest"> - <entry name="DefaultBoolItem" type="Bool"> - <default>true</default> - </entry> - <entry name="DefaultColorItem" type="Color"> - <default>#00FF00</default> - </entry> - <entry name="DefaultDateTimeItem" type="DateTime"> - <default>Thu Sep 09 2010</default> - </entry> - <entry name="DefaultEnumItem" type="Enum"> - <default>3</default> - <choice name="One" value="1" /> - <choice name="Two" value="2" /> - <choice name="Three" value="3" /> - <choice name="Four" value="4" /> - </entry> - <entry name="DefaultFontItem" type="Font"> - <default>DejaVu Sans</default> - </entry> - <entry name="DefaultIntItem" type="Int"> - <default>27</default> - </entry> - <entry name="DefaultPasswordItem" type="Password"> - <default>h4x.</default> - </entry> - <entry name="DefaultPathItem" type="Path"> - <default>/dev/null</default> - </entry> - <entry name="DefaultStringItem" type="String"> - <default>TestString</default> - </entry> - <entry name="DefaultStringListItem" type="StringList"> - <default>One,Two,Three,Four,Five</default> - </entry> - <entry name="DefaultUIntItem" type="UInt"> - <default>7</default> - </entry> - <entry name="DefaultUrlItem" type="Url"> - <default>http://kde.org</default> - </entry> - <entry name="DefaultDoubleItem" type="Double"> - <default>13.37</default> - </entry> - <entry name="DefaultIntListItem" type="IntList"> - <default>1,1,2,3,5,8</default> - </entry> - <entry name="DefaultLongLongItem" type="LongLong"> - <default>-9211372036854775808</default> - </entry> - <entry name="DefaultPointItem" type="Point"> - <default>185,857</default> - </entry> - <entry name="DefaultRectItem" type="Rect"> - <default>3,7,951,358</default> - </entry> - <entry name="DefaultSizeItem" type="Size"> - <default>640,480</default> - </entry> - <entry name="DefaultULongLongItem" type="ULongLong"> - <default>9223372036854775806</default> - </entry> - </group> -</kcfg> diff --git a/tier1/kconfig/autotests/kconfignokdehometest.cpp b/tier1/kconfig/autotests/kconfignokdehometest.cpp deleted file mode 100644 index 0c7d8265..00000000 --- a/tier1/kconfig/autotests/kconfignokdehometest.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2011 David Faure <faure@kde.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include <QObject> - -#include <QtTest/QtTest> -#include <QStandardPaths> -#include <ksharedconfig.h> - -#include <kconfig.h> -#include <kconfiggroup.h> - -class KConfigNoKdeHomeTest : public QObject -{ - Q_OBJECT - -private Q_SLOTS: - void testNoKdeHome(); -}; - - -void KConfigNoKdeHomeTest::testNoKdeHome() -{ - QStandardPaths::setTestModeEnabled(true); - QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); - QDir configDir(configPath); - configDir.removeRecursively(); - QVERIFY(!QFile::exists(configPath)); - - // Do what kf5-config does, and ensure the config directory doesn't get created (#233892) - QVERIFY(!QFile::exists(configPath)); - KSharedConfig::openConfig(); - QVERIFY(!QFile::exists(configPath)); - - // Now try to actually save something, see if it works. - KConfigGroup group(KSharedConfig::openConfig(), "Group"); - group.writeEntry("Key", "Value"); - group.sync(); - QVERIFY(QFile::exists(configPath)); - QVERIFY(QFile::exists(configPath + QStringLiteral("/kconfignokdehometestrc"))); - - // Cleanup - configDir.removeRecursively(); -} - -QTEST_MAIN(KConfigNoKdeHomeTest) - -#include "kconfignokdehometest.moc" diff --git a/tier1/kconfig/autotests/kconfigskeletontest.cpp b/tier1/kconfig/autotests/kconfigskeletontest.cpp deleted file mode 100644 index d3b30e84..00000000 --- a/tier1/kconfig/autotests/kconfigskeletontest.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2006 Olivier Goffart <ogoffart at kde.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "kconfigskeletontest.h" - -#include <kconfig.h> -#include <QFont> -#include <QtTest/QtTestGui> - - -QTEST_MAIN( KConfigSkeletonTest) - - -#define DEFAULT_SETTING1 false -#define DEFAULT_SETTING2 QColor(1,2,3) -#define DEFAULT_SETTING3 QFont("helvetica",12) -#define DEFAULT_SETTING4 QString("Hello World") - -#define WRITE_SETTING1 true -#define WRITE_SETTING2 QColor(3,2,1) -#define WRITE_SETTING3 QFont("helvetica",14) -#define WRITE_SETTING4 QString("KDE") - -void KConfigSkeletonTest::initTestCase() -{ - setCurrentGroup("MyGroup"); - addItemBool("MySetting1", mMyBool, DEFAULT_SETTING1); - addItemColor("MySetting2", mMyColor, DEFAULT_SETTING2); - - setCurrentGroup("MyOtherGroup"); - addItemFont("MySetting3", mMyFont, DEFAULT_SETTING3); - addItemString("MySetting4", mMyString, DEFAULT_SETTING4); - - QCOMPARE(mMyBool, DEFAULT_SETTING1); - QCOMPARE(mMyColor, DEFAULT_SETTING2); - QCOMPARE(mMyFont, DEFAULT_SETTING3); - QCOMPARE(mMyString, DEFAULT_SETTING4); -} - -void KConfigSkeletonTest::testSimple() -{ - mMyBool = WRITE_SETTING1; - mMyColor = WRITE_SETTING2; - mMyFont = WRITE_SETTING3; - mMyString = WRITE_SETTING4; - - writeConfig (); - - mMyBool = false; - mMyColor = QColor(); - mMyString.clear(); - mMyFont = QFont(); - - readConfig (); - - QCOMPARE(mMyBool, WRITE_SETTING1); - QCOMPARE(mMyColor, WRITE_SETTING2); - QCOMPARE(mMyFont, WRITE_SETTING3); - QCOMPARE(mMyString, WRITE_SETTING4); - -} - -void KConfigSkeletonTest::testRemoveItem() -{ - QVERIFY(findItem("MySetting1")); - removeItem("MySetting1"); - QVERIFY(!findItem("MySetting1")); -} - -void KConfigSkeletonTest::testClear() -{ - QVERIFY(findItem("MySetting2")); - QVERIFY(findItem("MySetting3")); - QVERIFY(findItem("MySetting4")); - - clearItems(); - - QVERIFY(!findItem("MySetting2")); - QVERIFY(!findItem("MySetting3")); - QVERIFY(!findItem("MySetting4")); -} - -void KConfigSkeletonTest::testDefaults() -{ - setDefaults (); - - QCOMPARE(mMyBool, DEFAULT_SETTING1); - QCOMPARE(mMyColor, DEFAULT_SETTING2); - QCOMPARE(mMyFont, DEFAULT_SETTING3); - QCOMPARE(mMyString, DEFAULT_SETTING4); - - writeConfig(); -} - - diff --git a/tier1/kconfig/autotests/kconfigskeletontest.h b/tier1/kconfig/autotests/kconfigskeletontest.h deleted file mode 100644 index f65739dc..00000000 --- a/tier1/kconfig/autotests/kconfigskeletontest.h +++ /dev/null @@ -1,44 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2006 Olivier Goffart <ogoffart at kde.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef KCONFIGSKELETONTEST_H -#define KCONFIGSKELETONTEST_H - -#include <kconfigskeleton.h> - -class KConfigSkeletonTest : public KConfigSkeleton -{ - Q_OBJECT - public: - -private Q_SLOTS: - void initTestCase(); - void testSimple(); - void testDefaults(); - void testRemoveItem(); - void testClear(); - -private: - bool mMyBool; - QColor mMyColor; - QFont mMyFont; - QString mMyString; - -}; - -#endif diff --git a/tier1/kconfig/autotests/kconfigtest.cpp b/tier1/kconfig/autotests/kconfigtest.cpp deleted file mode 100644 index 1aed5151..00000000 --- a/tier1/kconfig/autotests/kconfigtest.cpp +++ /dev/null @@ -1,1634 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -// Qt5 TODO: re-enable. No point in doing it before, it breaks on QString::fromUtf8(QByteArray), which exists in qt5. -#undef QT_NO_CAST_FROM_BYTEARRAY - -#include "kconfigtest.h" - -#include <QtTest/QtTest> -#include <qtemporarydir.h> -#include <QStandardPaths> -#include <kdesktopfile.h> - -#include <ksharedconfig.h> -#include <kconfiggroup.h> - -#ifdef Q_OS_UNIX -#include <utime.h> -#endif -#ifndef Q_OS_WIN -#include <unistd.h> // gethostname -#endif - -KCONFIGGROUP_DECLARE_ENUM_QOBJECT(KConfigTest,Testing) -KCONFIGGROUP_DECLARE_FLAGS_QOBJECT(KConfigTest,Flags) - -QTEST_MAIN( KConfigTest ) - -#define BOOLENTRY1 true -#define BOOLENTRY2 false -#define STRINGENTRY1 "hello" -#define STRINGENTRY2 " hello" -#define STRINGENTRY3 "hello " -#define STRINGENTRY4 " hello " -#define STRINGENTRY5 " " -#define STRINGENTRY6 "" -#define UTF8BITENTRY "Hello äöü" -#define TRANSLATEDSTRINGENTRY1 "bonjour" -#define BYTEARRAYENTRY QByteArray( "\x00\xff\x7f\x3c abc\x00\x00", 10 ) -#define ESCAPEKEY " []\0017[]==]" -#define ESCAPEENTRY "[]\170[]]=3=]\\] " -#define DOUBLEENTRY 123456.78912345 -#define FLOATENTRY 123.567f -#define POINTENTRY QPoint( 4351, 1235 ) -#define SIZEENTRY QSize( 10, 20 ) -#define RECTENTRY QRect( 10, 23, 5321, 13 ) -#define DATETIMEENTRY QDateTime( QDate( 2002, 06, 23 ), QTime( 12, 55, 40 ) ) -#define STRINGLISTENTRY (QStringList( "Hello," ) << " World") -#define STRINGLISTEMPTYENTRY QStringList() -#define STRINGLISTJUSTEMPTYELEMENT QStringList(QString()) -#define STRINGLISTEMPTYTRAINLINGELEMENT (QStringList( "Hi" ) << QString()) -#define STRINGLISTESCAPEODDENTRY (QStringList( "Hello\\\\\\" ) << "World") -#define STRINGLISTESCAPEEVENENTRY (QStringList( "Hello\\\\\\\\" ) << "World") -#define STRINGLISTESCAPECOMMAENTRY (QStringList( "Hel\\\\\\,\\\\,\\,\\\\\\\\,lo" ) << "World") -#define INTLISTENTRY1 QList<int>() << 1 << 2 << 3 << 4 -#define BYTEARRAYLISTENTRY1 QList<QByteArray>() << "" << "1,2" << "end" -#define VARIANTLISTENTRY (QVariantList() << true << false << QString("joe") << 10023) -#define VARIANTLISTENTRY2 (QVariantList() << POINTENTRY << SIZEENTRY) -#define HOMEPATH QString(QDir::homePath()+"/foo") -#define HOMEPATHESCAPE QString(QDir::homePath()+"/foo/$HOME") -#define DOLLARGROUP "$i" - -void KConfigTest::initTestCase() -{ - // ensure we don't use files in the real config directory - QStandardPaths::setTestModeEnabled(true); - QString testConfigDir = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); - - // to make sure all files from a previous failed run are deleted - cleanupTestCase(); - - - KConfig sc( "kconfigtest" ); - - KConfigGroup cg(&sc, "AAA"); - cg.writeEntry("stringEntry1", STRINGENTRY1, - KConfig::Persistent|KConfig::Global); - cg.deleteEntry("stringEntry2", KConfig::Global); - - cg = KConfigGroup(&sc, "Hello"); - cg.writeEntry( "boolEntry1", BOOLENTRY1 ); - cg.writeEntry( "boolEntry2", BOOLENTRY2 ); - - QByteArray data( UTF8BITENTRY ); - QCOMPARE( data.size(), 12 ); // the source file is in utf8 - QCOMPARE( QString::fromUtf8(data).length(), 9 ); - cg.writeEntry ("Test", data); - cg.writeEntry( "bytearrayEntry", BYTEARRAYENTRY ); - cg.writeEntry( ESCAPEKEY, ESCAPEENTRY ); - cg.writeEntry( "emptyEntry", ""); - cg.writeEntry( "stringEntry1", STRINGENTRY1 ); - cg.writeEntry( "stringEntry2", STRINGENTRY2 ); - cg.writeEntry( "stringEntry3", STRINGENTRY3 ); - cg.writeEntry( "stringEntry4", STRINGENTRY4 ); - cg.writeEntry( "stringEntry5", STRINGENTRY5 ); - cg.writeEntry( "urlEntry1", QUrl("http://qt-project.org") ); - cg.writeEntry( "keywith=equalsign", STRINGENTRY1 ); - cg.deleteEntry( "stringEntry5" ); - cg.deleteEntry( "stringEntry6" ); // deleting a nonexistent entry - cg.writeEntry( "byteArrayEntry1", QByteArray( STRINGENTRY1 ), - KConfig::Global|KConfig::Persistent ); - cg.writeEntry( "doubleEntry1", DOUBLEENTRY ); - cg.writeEntry( "floatEntry1", FLOATENTRY ); - - sc.deleteGroup("deleteMe"); // deleting a nonexistent group - - cg = KConfigGroup(&sc, "Complex Types"); - cg.writeEntry( "rectEntry", RECTENTRY ); - cg.writeEntry( "pointEntry", POINTENTRY ); - cg.writeEntry( "sizeEntry", SIZEENTRY ); - cg.writeEntry( "dateTimeEntry", DATETIMEENTRY ); - cg.writeEntry( "dateEntry", DATETIMEENTRY.date() ); - - KConfigGroup ct = cg; - cg = KConfigGroup(&ct, "Nested Group 1"); - cg.writeEntry("stringentry1", STRINGENTRY1); - - cg = KConfigGroup(&ct, "Nested Group 2"); - cg.writeEntry( "stringEntry2", STRINGENTRY2 ); - - cg = KConfigGroup(&cg, "Nested Group 2.1"); - cg.writeEntry( "stringEntry3", STRINGENTRY3 ); - - cg = KConfigGroup(&ct, "Nested Group 3"); - cg.writeEntry( "stringEntry3", STRINGENTRY3 ); - - cg = KConfigGroup(&sc, "List Types" ); - cg.writeEntry( "listOfIntsEntry1", INTLISTENTRY1 ); - cg.writeEntry( "listOfByteArraysEntry1", BYTEARRAYLISTENTRY1 ); - cg.writeEntry( "stringListEntry", STRINGLISTENTRY ); - cg.writeEntry( "stringListEmptyEntry", STRINGLISTEMPTYENTRY ); - cg.writeEntry( "stringListJustEmptyElement", STRINGLISTJUSTEMPTYELEMENT ); - cg.writeEntry( "stringListEmptyTrailingElement", STRINGLISTEMPTYTRAINLINGELEMENT ); - cg.writeEntry( "stringListEscapeOddEntry", STRINGLISTESCAPEODDENTRY ); - cg.writeEntry( "stringListEscapeEvenEntry", STRINGLISTESCAPEEVENENTRY ); - cg.writeEntry( "stringListEscapeCommaEntry", STRINGLISTESCAPECOMMAENTRY ); - cg.writeEntry( "variantListEntry", VARIANTLISTENTRY ); - - cg = KConfigGroup(&sc, "Path Type" ); - cg.writePathEntry( "homepath", HOMEPATH ); - cg.writePathEntry( "homepathescape", HOMEPATHESCAPE ); - - cg = KConfigGroup(&sc, "Enum Types" ); - writeEntry( cg, "enum-10", Tens ); - writeEntry( cg, "enum-100", Hundreds ); - writeEntry( cg, "flags-bit0", Flags(bit0)); - writeEntry( cg, "flags-bit0-bit1", Flags(bit0|bit1) ); - - cg = KConfigGroup(&sc, "ParentGroup" ); - KConfigGroup cg1(&cg, "SubGroup1" ); - cg1.writeEntry( "somestring", "somevalue" ); - cg.writeEntry( "parentgrpstring", "somevalue" ); - KConfigGroup cg2(&cg, "SubGroup2" ); - cg2.writeEntry( "substring", "somevalue" ); - KConfigGroup cg3(&cg, "SubGroup/3"); - cg3.writeEntry( "sub3string", "somevalue" ); - - QVERIFY(sc.isDirty()); - QVERIFY(sc.sync()); - QVERIFY(!sc.isDirty()); - - QVERIFY2(QFile::exists(testConfigDir + QStringLiteral("/kconfigtest")), - qPrintable(testConfigDir + QStringLiteral("/kconfigtest must exist"))); - QVERIFY2(QFile::exists(testConfigDir + QStringLiteral("/kdeglobals")), - qPrintable(testConfigDir + QStringLiteral("/kdeglobals must exist"))); - - - KConfig sc1("kdebugrc", KConfig::SimpleConfig); - KConfigGroup sg0(&sc1, "0"); - sg0.writeEntry("AbortFatal", false); - sg0.writeEntry("WarnOutput", 0); - sg0.writeEntry("FatalOutput", 0); - QVERIFY(sc1.sync()); - - //Setup stuff to test KConfig::addConfigSources() - KConfig devcfg("specificrc"); - KConfigGroup devonlygrp(&devcfg, "Specific Only Group"); - devonlygrp.writeEntry("ExistingEntry", "DevValue"); - KConfigGroup devandbasegrp(&devcfg, "Shared Group"); - devandbasegrp.writeEntry("SomeSharedEntry", "DevValue"); - devandbasegrp.writeEntry("SomeSpecificOnlyEntry", "DevValue"); - QVERIFY(devcfg.sync()); - KConfig basecfg("baserc"); - KConfigGroup basegrp(&basecfg, "Base Only Group"); - basegrp.writeEntry("ExistingEntry", "BaseValue"); - KConfigGroup baseanddevgrp(&basecfg, "Shared Group"); - baseanddevgrp.writeEntry("SomeSharedEntry", "BaseValue"); - baseanddevgrp.writeEntry("SomeBaseOnlyEntry", "BaseValue"); - QVERIFY(basecfg.sync()); - - KConfig gecfg("groupescapetest", KConfig::SimpleConfig); - cg = KConfigGroup(&gecfg, DOLLARGROUP); - cg.writeEntry( "entry", "doesntmatter" ); - -} - -void KConfigTest::cleanupTestCase() -{ - //ensure we don't delete the real directory - QStandardPaths::setTestModeEnabled(true); - QDir localConfig(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation)); - //qDebug() << "Erasing" << localConfig; - localConfig.removeRecursively(); - QVERIFY(!localConfig.exists()); -} - - -static QList<QByteArray> readLinesFrom(const QString& path) -{ - QFile file(path); - const bool opened = file.open(QIODevice::ReadOnly|QIODevice::Text); - Q_ASSERT(opened); - Q_UNUSED(opened); - QList<QByteArray> lines; - QByteArray line; - do { - line = file.readLine(); - if (!line.isEmpty()) - lines.append(line); - } while(!line.isEmpty()); - return lines; -} - -static QList<QByteArray> readLines(const char* fileName = "kconfigtest") -{ - const QString path = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + '/' + fileName; - Q_ASSERT(!path.isEmpty()); - return readLinesFrom(path); -} - -// see also testDefaults, which tests reverting with a defaults (global) file available -void KConfigTest::testDirtyAfterRevert() -{ - KConfig sc( "kconfigtest_revert" ); - - KConfigGroup cg(&sc, "Hello"); - cg.revertToDefault( "does_not_exist" ); - QVERIFY(!sc.isDirty()); - cg.writeEntry("Test", "Correct"); - QVERIFY(sc.isDirty()); - sc.sync(); - QVERIFY(!sc.isDirty()); - - cg.revertToDefault("Test"); - QVERIFY(sc.isDirty()); - QVERIFY(sc.sync()); - QVERIFY(!sc.isDirty()); - - cg.revertToDefault("Test"); - QVERIFY(!sc.isDirty()); -} - -void KConfigTest::testRevertAllEntries() -{ - // this tests the case were we revert (delete) all entries in a file, - // leaving a blank file - { - KConfig sc( "konfigtest2", KConfig::SimpleConfig ); - KConfigGroup cg( &sc, "Hello" ); - cg.writeEntry( "Test", "Correct" ); - } - - { - KConfig sc( "konfigtest2", KConfig::SimpleConfig ); - KConfigGroup cg( &sc, "Hello" ); - QCOMPARE( cg.readEntry( "Test", "Default" ), QString("Correct") ); - cg.revertToDefault( "Test" ); - } - - KConfig sc( "konfigtest2", KConfig::SimpleConfig ); - KConfigGroup cg( &sc, "Hello" ); - QCOMPARE( cg.readEntry( "Test", "Default" ), QString("Default") ); -} - -void KConfigTest::testSimple() -{ - // kdeglobals (which was created in initTestCase) must be found this way: - const QStringList kdeglobals = QStandardPaths::locateAll(QStandardPaths::GenericConfigLocation, QLatin1String("kdeglobals")); - QVERIFY(!kdeglobals.isEmpty()); - - KConfig sc2( "kconfigtest" ); - QCOMPARE(sc2.name(), QString("kconfigtest")); - - // make sure groupList() isn't returning something it shouldn't - Q_FOREACH(const QString& group, sc2.groupList()) { - QVERIFY(!group.isEmpty() && group != "<default>"); - QVERIFY(!group.contains(QChar(0x1d))); - } - - KConfigGroup sc3( &sc2, "AAA"); - - QVERIFY( sc3.hasKey( "stringEntry1" ) ); // from kdeglobals - QVERIFY( !sc3.isEntryImmutable("stringEntry1") ); - QCOMPARE( sc3.readEntry( "stringEntry1" ), QString( STRINGENTRY1 ) ); - - QVERIFY( !sc3.hasKey( "stringEntry2" ) ); - QCOMPARE( sc3.readEntry( "stringEntry2", QString("bla") ), QString( "bla" ) ); - - QVERIFY( !sc3.hasDefault( "stringEntry1" ) ); - - sc3 = KConfigGroup(&sc2, "Hello"); - QCOMPARE( sc3.readEntry( "Test", QByteArray() ), QByteArray( UTF8BITENTRY ) ); - QCOMPARE( sc3.readEntry( "bytearrayEntry", QByteArray() ), BYTEARRAYENTRY ); - QCOMPARE( sc3.readEntry( ESCAPEKEY ), QString( ESCAPEENTRY ) ); - QCOMPARE( sc3.readEntry( "Test", QString() ), QString::fromUtf8( UTF8BITENTRY ) ); - QCOMPARE( sc3.readEntry( "emptyEntry"/*, QString("Fietsbel")*/), QString("") ); - QCOMPARE( sc3.readEntry("emptyEntry", QString("Fietsbel")).isEmpty(), true ); - QCOMPARE( sc3.readEntry( "stringEntry1" ), QString( STRINGENTRY1 ) ); - QCOMPARE( sc3.readEntry( "stringEntry2" ), QString( STRINGENTRY2 ) ); - QCOMPARE( sc3.readEntry( "stringEntry3" ), QString( STRINGENTRY3 ) ); - QCOMPARE( sc3.readEntry( "stringEntry4" ), QString( STRINGENTRY4 ) ); - QVERIFY( !sc3.hasKey( "stringEntry5" ) ); - QCOMPARE( sc3.readEntry( "stringEntry5", QString("test") ), QString( "test" ) ); - QVERIFY( !sc3.hasKey( "stringEntry6" ) ); - QCOMPARE( sc3.readEntry( "stringEntry6", QString("foo") ), QString( "foo" ) ); - QCOMPARE( sc3.readEntry( "urlEntry1", QUrl() ), QUrl("http://qt-project.org") ); - QCOMPARE( sc3.readEntry( "boolEntry1", BOOLENTRY1 ), BOOLENTRY1 ); - QCOMPARE( sc3.readEntry( "boolEntry2", false ), BOOLENTRY2 ); - QCOMPARE( sc3.readEntry("keywith=equalsign", QString("wrong")), QString(STRINGENTRY1)); - QCOMPARE( sc3.readEntry( "byteArrayEntry1", QByteArray() ), - QByteArray( STRINGENTRY1 ) ); - QCOMPARE( sc3.readEntry( "doubleEntry1", 0.0 ), DOUBLEENTRY ); - QCOMPARE( sc3.readEntry( "floatEntry1", 0.0f ), FLOATENTRY ); -} - -void KConfigTest::testDefaults() -{ - KConfig config("defaulttest", KConfig::NoGlobals); - const QString defaultsFile = "defaulttest.defaults"; - KConfig defaults(defaultsFile, KConfig::SimpleConfig); - - const QString Default("Default"); - const QString NotDefault("Not Default"); - const QString Value1(STRINGENTRY1); - const QString Value2(STRINGENTRY2); - - KConfigGroup group = defaults.group("any group"); - group.writeEntry("entry1", Default); - QVERIFY(group.sync()); - - group = config.group("any group"); - group.writeEntry("entry1", Value1); - group.writeEntry("entry2", Value2); - QVERIFY(group.sync()); - - config.addConfigSources(QStringList() << QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + '/' + defaultsFile); - - config.setReadDefaults(true); - QCOMPARE(group.readEntry("entry1", QString()), Default); - QCOMPARE(group.readEntry("entry2", NotDefault), NotDefault); // no default for entry2 - - config.setReadDefaults(false); - QCOMPARE(group.readEntry("entry1", Default), Value1); - QCOMPARE(group.readEntry("entry2", NotDefault), Value2); - - group.revertToDefault("entry1"); - QCOMPARE(group.readEntry("entry1", QString()), Default); - group.revertToDefault("entry2"); - QCOMPARE(group.readEntry("entry2", QString()), QString()); - - // TODO test reverting localized entries - - Q_ASSERT(config.isDirty()); - group.sync(); - - // Check that everything is OK on disk, too - KConfig reader("defaulttest", KConfig::NoGlobals); - reader.addConfigSources(QStringList() << QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + '/' + defaultsFile); - KConfigGroup readerGroup = reader.group("any group"); - QCOMPARE(readerGroup.readEntry("entry1", QString()), Default); - QCOMPARE(readerGroup.readEntry("entry2", QString()), QString()); -} - -void KConfigTest::testLocale() -{ - KConfig config("kconfigtest.locales", KConfig::SimpleConfig); - const QString Translated(TRANSLATEDSTRINGENTRY1); - const QString Untranslated(STRINGENTRY1); - - KConfigGroup group = config.group("Hello"); - group.writeEntry("stringEntry1", Untranslated); - config.setLocale("fr"); - group.writeEntry("stringEntry1", Translated, KConfig::Localized|KConfig::Persistent); - QVERIFY(config.sync()); - - QCOMPARE(group.readEntry("stringEntry1", QString()), Translated); - QCOMPARE(group.readEntryUntranslated("stringEntry1"), Untranslated); - - config.setLocale("C"); // strings written in the "C" locale are written as nonlocalized - group.writeEntry("stringEntry1", Untranslated, KConfig::Localized|KConfig::Persistent); - QVERIFY(config.sync()); - - QCOMPARE(group.readEntry("stringEntry1", QString()), Untranslated); -} - -void KConfigTest::testEncoding() -{ - QString groupstr = QString::fromUtf8("UTF-8:\xc3\xb6l"); - - KConfig c( "kconfigtestencodings" ); - KConfigGroup cg(&c, groupstr); - cg.writeEntry("key", "value"); - QVERIFY(c.sync()); - - QList<QByteArray> lines = readLines("kconfigtestencodings"); - QCOMPARE(lines.count(), 2); - QCOMPARE(lines.first(), QByteArray("[UTF-8:\xc3\xb6l]\n")); - - KConfig c2( "kconfigtestencodings" ); - KConfigGroup cg2(&c2, groupstr); - QVERIFY(cg2.readEntry("key") == QByteArray("value")); - - QVERIFY(c2.groupList().contains(groupstr)); -} - -void KConfigTest::testLists() -{ - KConfig sc2( "kconfigtest" ); - KConfigGroup sc3(&sc2, "List Types"); - - QCOMPARE( sc3.readEntry( QString("stringListEntry"), QStringList()), - STRINGLISTENTRY ); - - QCOMPARE( sc3.readEntry( QString("stringListEmptyEntry"), QStringList("wrong") ), - STRINGLISTEMPTYENTRY ); - - QCOMPARE( sc3.readEntry( QString("stringListJustEmptyElement"), QStringList() ), - STRINGLISTJUSTEMPTYELEMENT ); - - QCOMPARE( sc3.readEntry( QString("stringListEmptyTrailingElement"), QStringList() ), - STRINGLISTEMPTYTRAINLINGELEMENT ); - - QCOMPARE( sc3.readEntry( QString("stringListEscapeOddEntry"), QStringList()), - STRINGLISTESCAPEODDENTRY ); - - QCOMPARE( sc3.readEntry( QString("stringListEscapeEvenEntry"), QStringList()), - STRINGLISTESCAPEEVENENTRY ); - - QCOMPARE( sc3.readEntry( QString("stringListEscapeCommaEntry"), QStringList()), - STRINGLISTESCAPECOMMAENTRY ); - - QCOMPARE( sc3.readEntry( "listOfIntsEntry1" ), QString::fromLatin1( "1,2,3,4" ) ); - QList<int> expectedIntList = INTLISTENTRY1; - QVERIFY( sc3.readEntry( "listOfIntsEntry1", QList<int>() ) == expectedIntList ); - - QCOMPARE( QVariant(sc3.readEntry( "variantListEntry", VARIANTLISTENTRY )).toStringList(), - QVariant(VARIANTLISTENTRY).toStringList() ); - - QCOMPARE( sc3.readEntry( "listOfByteArraysEntry1", QList<QByteArray>()), BYTEARRAYLISTENTRY1 ); -} - -void KConfigTest::testPath() -{ - KConfig sc2( "kconfigtest" ); - KConfigGroup sc3(&sc2, "Path Type"); - QCOMPARE( sc3.readPathEntry( "homepath", QString() ), HOMEPATH ); - QCOMPARE( sc3.readPathEntry( "homepathescape", QString() ), HOMEPATHESCAPE ); - QCOMPARE( sc3.entryMap()["homepath"], HOMEPATH ); - - { - QFile file(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/pathtest"); - file.open(QIODevice::WriteOnly|QIODevice::Text); - QTextStream out(&file); - out.setCodec("UTF-8"); - out << "[Test Group]" << endl - << "homePath=$HOME/foo" << endl - << "homePath2=file://$HOME/foo" << endl - << "withBraces[$e]=file://${HOME}/foo" << endl - << "URL[$e]=file://${HOME}/foo" << endl - << "hostname[$e]=$(hostname)" << endl - << "noeol=foo"; // no EOL - } - KConfig cf2("pathtest"); - KConfigGroup group = cf2.group("Test Group"); - QVERIFY(group.hasKey("homePath")); - QCOMPARE(group.readPathEntry("homePath", QString()), HOMEPATH); - QVERIFY(group.hasKey("homePath2")); - QCOMPARE(group.readPathEntry("homePath2", QString()), QString("file://" + HOMEPATH) ); - QVERIFY(group.hasKey("withBraces")); - QCOMPARE(group.readPathEntry("withBraces", QString()), QString("file://" + HOMEPATH) ); - QVERIFY(group.hasKey("URL")); - QCOMPARE(group.readEntry("URL", QString()), QString("file://" + HOMEPATH) ); -#if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) - // I don't know if this will work on windows - // This test hangs on OS X - QVERIFY(group.hasKey("hostname")); - char hostname[256]; - QVERIFY(::gethostname(hostname, sizeof(hostname)) == 0); - QCOMPARE(group.readEntry("hostname", QString()), QString::fromLatin1(hostname)); -#endif - QVERIFY(group.hasKey("noeol")); - QCOMPARE(group.readEntry("noeol", QString()), QString("foo")); -} - -void KConfigTest::testPersistenceOfExpandFlagForPath() -{ - // This test checks that a path entry starting with $HOME is still flagged - // with the expand flag after the config was altered without rewriting the - // path entry. - - // 1st step: Open the config, add a new dummy entry and then sync the config - // back to the storage. - { - KConfig sc2( "kconfigtest" ); - KConfigGroup sc3(&sc2, "Path Type"); - sc3.writeEntry( "dummy", "dummy" ); - QVERIFY(sc2.sync()); - } - - // 2nd step: Call testPath() again. Rewriting the config must not break - // the testPath() test. - testPath(); -} - -void KConfigTest::testComplex() -{ - KConfig sc2( "kconfigtest" ); - KConfigGroup sc3(&sc2, "Complex Types"); - - QCOMPARE( sc3.readEntry( "pointEntry", QPoint() ), POINTENTRY ); - QCOMPARE( sc3.readEntry( "sizeEntry", SIZEENTRY ), SIZEENTRY); - QCOMPARE( sc3.readEntry( "rectEntry", QRect(1,2,3,4) ), RECTENTRY ); - QCOMPARE( sc3.readEntry( "dateTimeEntry", QDateTime() ).toString(Qt::ISODate), - DATETIMEENTRY.toString(Qt::ISODate) ); - QCOMPARE( sc3.readEntry( "dateEntry", QDate() ).toString(Qt::ISODate), - DATETIMEENTRY.date().toString(Qt::ISODate) ); - QCOMPARE( sc3.readEntry( "dateTimeEntry", QDate() ), DATETIMEENTRY.date() ); -} - -void KConfigTest::testEnums() -{ - KConfig sc("kconfigtest"); - KConfigGroup sc3(&sc, "Enum Types" ); - - QCOMPARE( sc3.readEntry( "enum-10" ), QString("Tens")); - QVERIFY( readEntry( sc3, "enum-100", Ones) != Ones); - QVERIFY( readEntry( sc3, "enum-100", Ones) != Tens); - - QCOMPARE( sc3.readEntry( "flags-bit0" ), QString("bit0")); - QVERIFY( readEntry( sc3, "flags-bit0", Flags() ) == bit0 ); - - int eid = staticMetaObject.indexOfEnumerator( "Flags" ); - QVERIFY( eid != -1 ); - QMetaEnum me = staticMetaObject.enumerator( eid ); - Flags bitfield = bit0|bit1; - - QCOMPARE( sc3.readEntry( "flags-bit0-bit1" ), QString( me.valueToKeys(bitfield) ) ); - QVERIFY( readEntry( sc3, "flags-bit0-bit1", Flags() ) == bitfield ); -} - -void KConfigTest::testEntryMap() -{ - KConfig sc("kconfigtest"); - KConfigGroup cg(&sc, "Hello"); - QMap<QString, QString> entryMap = cg.entryMap(); - qDebug() << entryMap.keys(); - QCOMPARE(entryMap.value("stringEntry1"), QString(STRINGENTRY1)); - QCOMPARE(entryMap.value("stringEntry2"), QString(STRINGENTRY2)); - QCOMPARE(entryMap.value("stringEntry3"), QString(STRINGENTRY3)); - QCOMPARE(entryMap.value("stringEntry4"), QString(STRINGENTRY4)); - QVERIFY(!entryMap.contains("stringEntry5")); - QVERIFY(!entryMap.contains("stringEntry6")); - QCOMPARE(entryMap.value("Test"), QString::fromUtf8(UTF8BITENTRY)); - QCOMPARE(entryMap.value("bytearrayEntry"), QString::fromUtf8(BYTEARRAYENTRY)); - QCOMPARE(entryMap.value("emptyEntry"), QString()); - QVERIFY(entryMap.contains("emptyEntry")); - QCOMPARE(entryMap.value("boolEntry1"), QString(BOOLENTRY1?"true":"false")); - QCOMPARE(entryMap.value("boolEntry2"), QString(BOOLENTRY2?"true":"false")); - QCOMPARE(entryMap.value("keywith=equalsign"), QString(STRINGENTRY1)); - QCOMPARE(entryMap.value("byteArrayEntry1"), QString(STRINGENTRY1)); - QCOMPARE(entryMap.value("doubleEntry1"), QString::number(DOUBLEENTRY, 'g', 15)); - QCOMPARE(entryMap.value("floatEntry1"), QString::number(FLOATENTRY, 'g', 8)); -} - -void KConfigTest::testInvalid() -{ - KConfig sc( "kconfigtest" ); - - // all of these should print a message to the kdebug.dbg file - KConfigGroup sc3(&sc, "Invalid Types" ); - sc3.writeEntry( "badList", VARIANTLISTENTRY2 ); - - QList<int> list; - - // 1 element list - list << 1; - sc3.writeEntry( QString("badList"), list); - - QVERIFY( sc3.readEntry( "badList", QPoint() ) == QPoint() ); - QVERIFY( sc3.readEntry( "badList", QRect() ) == QRect() ); - QVERIFY( sc3.readEntry( "badList", QSize() ) == QSize() ); - QVERIFY( sc3.readEntry( "badList", QDate() ) == QDate() ); - QVERIFY( sc3.readEntry( "badList", QDateTime() ) == QDateTime() ); - - // 2 element list - list << 2; - sc3.writeEntry( "badList", list); - - QVERIFY( sc3.readEntry( "badList", QRect() ) == QRect() ); - QVERIFY( sc3.readEntry( "badList", QDate() ) == QDate() ); - QVERIFY( sc3.readEntry( "badList", QDateTime() ) == QDateTime() ); - - // 3 element list - list << 303; - sc3.writeEntry( "badList", list); - - QVERIFY( sc3.readEntry( "badList", QPoint() ) == QPoint() ); - QVERIFY( sc3.readEntry( "badList", QRect() ) == QRect() ); - QVERIFY( sc3.readEntry( "badList", QSize() ) == QSize() ); - QVERIFY( sc3.readEntry( "badList", QDate() ) == QDate() ); // out of bounds - QVERIFY( sc3.readEntry( "badList", QDateTime() ) == QDateTime() ); - - // 4 element list - list << 4; - sc3.writeEntry( "badList", list ); - - QVERIFY( sc3.readEntry( "badList", QPoint() ) == QPoint() ); - QVERIFY( sc3.readEntry( "badList", QSize() ) == QSize() ); - QVERIFY( sc3.readEntry( "badList", QDate() ) == QDate() ); - QVERIFY( sc3.readEntry( "badList", QDateTime() ) == QDateTime() ); - - // 5 element list - list[2] = 3; - list << 5; - sc3.writeEntry( "badList", list); - - QVERIFY( sc3.readEntry( "badList", QPoint() ) == QPoint() ); - QVERIFY( sc3.readEntry( "badList", QRect() ) == QRect() ); - QVERIFY( sc3.readEntry( "badList", QSize() ) == QSize() ); - QVERIFY( sc3.readEntry( "badList", QDate() ) == QDate() ); - QVERIFY( sc3.readEntry( "badList", QDateTime() ) == QDateTime() ); - - // 6 element list - list << 6; - sc3.writeEntry( "badList", list); - - QVERIFY( sc3.readEntry( "badList", QPoint() ) == QPoint() ); - QVERIFY( sc3.readEntry( "badList", QRect() ) == QRect() ); - QVERIFY( sc3.readEntry( "badList", QSize() ) == QSize() ); -} - -void KConfigTest::testChangeGroup() -{ - KConfig sc( "kconfigtest" ); - KConfigGroup sc3(&sc, "Hello"); - QCOMPARE(sc3.name(), QString("Hello")); - KConfigGroup newGroup(sc3); -#ifndef KDE_NO_DEPRECATED - newGroup.changeGroup("FooBar"); // deprecated! - QCOMPARE(newGroup.name(), QString("FooBar")); - QCOMPARE(sc3.name(), QString("Hello")); // unchanged - - // Write into the "changed group" and check that it works - newGroup.writeEntry("InFooBar", "FB"); - QCOMPARE(KConfigGroup(&sc, "FooBar").entryMap().value("InFooBar"), QString("FB")); - QCOMPARE(KConfigGroup(&sc, "Hello").entryMap().value("InFooBar"), QString()); -#endif - - KConfigGroup rootGroup(sc.group("")); - QCOMPARE(rootGroup.name(), QString("<default>")); - KConfigGroup sc32(rootGroup.group("Hello")); - QCOMPARE(sc32.name(), QString("Hello")); - KConfigGroup newGroup2(sc32); -#ifndef KDE_NO_DEPRECATED - newGroup2.changeGroup("FooBar"); // deprecated! - QCOMPARE(newGroup2.name(), QString("FooBar")); - QCOMPARE(sc32.name(), QString("Hello")); // unchanged -#endif -} - -// Simple test for deleteEntry -void KConfigTest::testDeleteEntry() -{ - const char* configFile = "kconfigdeletetest"; - { - KConfig conf(configFile); - conf.group("Hello").writeEntry("DelKey", "ToBeDeleted"); - } - const QList<QByteArray> lines = readLines(configFile); - Q_ASSERT(lines.contains("[Hello]\n")); - Q_ASSERT(lines.contains("DelKey=ToBeDeleted\n")); - - KConfig sc(configFile); - KConfigGroup group(&sc, "Hello"); - - group.deleteEntry("DelKey"); - QCOMPARE( group.readEntry("DelKey", QString("Fietsbel")), QString("Fietsbel") ); - - QVERIFY(group.sync()); - Q_ASSERT(!readLines(configFile).contains("DelKey=ToBeDeleted\n")); - QCOMPARE( group.readEntry("DelKey", QString("still deleted")), QString("still deleted") ); -} - -void KConfigTest::testDelete() -{ - KConfig sc( "kconfigtest" ); - - KConfigGroup ct(&sc, "Complex Types"); - - // First delete a nested group - KConfigGroup delgr(&ct, "Nested Group 3"); - QVERIFY(delgr.exists()); - QVERIFY(ct.hasGroup("Nested Group 3")); - delgr.deleteGroup(); - QVERIFY(!delgr.exists()); - QVERIFY(!ct.hasGroup("Nested Group 3")); - QVERIFY(ct.groupList().contains("Nested Group 3")); - - KConfigGroup ng(&ct, "Nested Group 2"); - QVERIFY(sc.hasGroup("Complex Types")); - QVERIFY(!sc.hasGroup("Does not exist")); - sc.deleteGroup("Complex Types"); - QCOMPARE(sc.group("Complex Types").keyList().count(), 0); - QVERIFY(!sc.hasGroup("Complex Types")); // #192266 - QVERIFY(!sc.group("Complex Types").exists()); - QVERIFY(!ct.hasGroup("Nested Group 1")); - - QCOMPARE(ct.group("Nested Group 1").keyList().count(), 0); - QCOMPARE(ct.group("Nested Group 2").keyList().count(), 0); - QCOMPARE(ng.group("Nested Group 2.1").keyList().count(), 0); - - KConfigGroup cg(&sc , "AAA" ); - cg.deleteGroup(); - QVERIFY( sc.entryMap("Complex Types").isEmpty() ); - QVERIFY( sc.entryMap("AAA").isEmpty() ); - QVERIFY( !sc.entryMap("Hello").isEmpty() ); //not deleted group - QVERIFY( sc.entryMap("FooBar").isEmpty() ); //inexistant group - - QVERIFY(cg.sync()); - // Check what happens on disk - const QList<QByteArray> lines = readLines(); - //qDebug() << lines; - QVERIFY(!lines.contains("[Complex Types]\n")); - QVERIFY(!lines.contains("[Complex Types][Nested Group 1]\n")); - QVERIFY(!lines.contains("[Complex Types][Nested Group 2]\n")); - QVERIFY(!lines.contains("[Complex Types][Nested Group 2.1]\n")); - QVERIFY(!lines.contains("[AAA]\n")); - QVERIFY(lines.contains("[Hello]\n")); // a group that was not deleted - - // test for entries that are marked as deleted when there is no default - KConfig cf("kconfigtest", KConfig::SimpleConfig); // make sure there are no defaults - cg = cf.group("Portable Devices"); - cg.writeEntry("devices|manual|(null)", "whatever"); - cg.writeEntry("devices|manual|/mnt/ipod", "/mnt/ipod"); - QVERIFY(cf.sync()); - - int count=0; - Q_FOREACH(const QByteArray& item, readLines()) - if (item.startsWith("devices|")) // krazy:exclude=strings - count++; - QCOMPARE(count, 2); - cg.deleteEntry("devices|manual|/mnt/ipod"); - QVERIFY(cf.sync()); - Q_FOREACH(const QByteArray& item, readLines()) - QVERIFY(!item.contains("ipod")); -} - -void KConfigTest::testDefaultGroup() -{ - KConfig sc( "kconfigtest" ); - KConfigGroup defaultGroup(&sc, "<default>"); - QCOMPARE(defaultGroup.name(), QString("<default>")); - QVERIFY(!defaultGroup.exists()); - defaultGroup.writeEntry("TestKey", "defaultGroup"); - QVERIFY(defaultGroup.exists()); - QCOMPARE(defaultGroup.readEntry("TestKey", QString()), QString("defaultGroup")); - QVERIFY(sc.sync()); - - { - // Test reading it - KConfig sc2("kconfigtest"); - KConfigGroup defaultGroup2(&sc2, "<default>"); - QCOMPARE(defaultGroup2.name(), QString("<default>")); - QVERIFY(defaultGroup2.exists()); - QCOMPARE(defaultGroup2.readEntry("TestKey", QString()), QString("defaultGroup")); - } - { - // Test reading it - KConfig sc2("kconfigtest"); - KConfigGroup emptyGroup(&sc2, ""); - QCOMPARE(emptyGroup.name(), QString("<default>")); - QVERIFY(emptyGroup.exists()); - QCOMPARE(emptyGroup.readEntry("TestKey", QString()), QString("defaultGroup")); - } - - QList<QByteArray> lines = readLines(); - QVERIFY(!lines.contains("[]\n")); - QCOMPARE(lines.first(), QByteArray("TestKey=defaultGroup\n")); - - // Now that the group exists make sure it isn't returned from groupList() - Q_FOREACH(const QString& group, sc.groupList()) { - QVERIFY(!group.isEmpty() && group != "<default>"); - } - - defaultGroup.deleteGroup(); - QVERIFY(sc.sync()); - - // Test if deleteGroup worked - lines = readLines(); - QVERIFY(lines.first() != QByteArray("TestKey=defaultGroup\n")); -} - -void KConfigTest::testEmptyGroup() -{ - KConfig sc( "kconfigtest" ); - KConfigGroup emptyGroup(&sc, ""); - QCOMPARE(emptyGroup.name(), QString("<default>")); // confusing, heh? - QVERIFY(!emptyGroup.exists()); - emptyGroup.writeEntry("TestKey", "emptyGroup"); - QVERIFY(emptyGroup.exists()); - QCOMPARE(emptyGroup.readEntry("TestKey", QString()), QString("emptyGroup")); - QVERIFY(sc.sync()); - - { - // Test reading it - KConfig sc2("kconfigtest"); - KConfigGroup defaultGroup(&sc2, "<default>"); - QCOMPARE(defaultGroup.name(), QString("<default>")); - QVERIFY(defaultGroup.exists()); - QCOMPARE(defaultGroup.readEntry("TestKey", QString()), QString("emptyGroup")); - } - { - // Test reading it - KConfig sc2("kconfigtest"); - KConfigGroup emptyGroup2(&sc2, ""); - QCOMPARE(emptyGroup2.name(), QString("<default>")); - QVERIFY(emptyGroup2.exists()); - QCOMPARE(emptyGroup2.readEntry("TestKey", QString()), QString("emptyGroup")); - } - - QList<QByteArray> lines = readLines(); - QVERIFY(!lines.contains("[]\n")); // there's no support for the [] group, in fact. - QCOMPARE(lines.first(), QByteArray("TestKey=emptyGroup\n")); - - // Now that the group exists make sure it isn't returned from groupList() - Q_FOREACH(const QString& group, sc.groupList()) { - QVERIFY(!group.isEmpty() && group != "<default>"); - } - emptyGroup.deleteGroup(); - QVERIFY(sc.sync()); - - // Test if deleteGroup worked - lines = readLines(); - QVERIFY(lines.first() != QByteArray("TestKey=defaultGroup\n")); -} - -void KConfigTest::testCascadingWithLocale() -{ - // This test relies on XDG_CONFIG_DIRS, which only has effect on Unix. - // Cascading (more than two levels) isn't available at all on Windows. -#ifdef Q_OS_UNIX - QTemporaryDir middleDir; - QTemporaryDir globalDir; - qputenv("XDG_CONFIG_DIRS", qPrintable(middleDir.path() + QString(":") + globalDir.path())); - - const QString globalConfigDir = globalDir.path(); - QVERIFY(QDir().mkpath(globalConfigDir)); - QFile global(globalConfigDir + "/foo.desktop"); - QVERIFY(global.open(QIODevice::WriteOnly|QIODevice::Text)); - QTextStream globalOut(&global); - globalOut << "[Group]" << endl - << "FromGlobal=true" << endl - << "FromGlobal[fr]=vrai" << endl - << "Name=Testing" << endl - << "Name[fr]=FR" << endl - << "Other=Global" << endl - << "Other[fr]=Global_FR" << endl; - global.close(); - - const QString middleConfigDir = middleDir.path(); - QVERIFY(QDir().mkpath(middleConfigDir)); - QFile local(middleConfigDir + "/foo.desktop"); - QVERIFY(local.open(QIODevice::WriteOnly|QIODevice::Text)); - QTextStream out(&local); - out << "[Group]" << endl - << "FromLocal=true" << endl - << "FromLocal[fr]=vrai" << endl - << "Name=Local Testing" << endl - << "Name[fr]=FR" << endl - << "Other=English Only" << endl; - local.close(); - - KConfig config("foo.desktop"); - KConfigGroup group = config.group("Group"); - QCOMPARE(group.readEntry("FromGlobal"), QString("true")); - QCOMPARE(group.readEntry("FromLocal"), QString("true")); - QCOMPARE(group.readEntry("Name"), QString("Local Testing")); - config.setLocale("fr"); - QCOMPARE(group.readEntry("FromGlobal"), QString("vrai")); - QCOMPARE(group.readEntry("FromLocal"), QString("vrai")); - QCOMPARE(group.readEntry("Name"), QString("FR")); - QCOMPARE(group.readEntry("Other"), QString("English Only")); // Global_FR is locally overriden -#endif -} - -void KConfigTest::testMerge() -{ - KConfig config("mergetest", KConfig::SimpleConfig); - - KConfigGroup cg = config.group("some group"); - cg.writeEntry("entry", " random entry"); - cg.writeEntry("another entry", "blah blah blah"); - - { // simulate writing by another process - QFile file(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/mergetest"); - file.open(QIODevice::WriteOnly|QIODevice::Text); - QTextStream out(&file); - out.setCodec("UTF-8"); - out << "[Merged Group]" << endl - << "entry1=Testing" << endl - << "entry2=More Testing" << endl - << "[some group]" << endl - << "entry[fr]=French" << endl - << "entry[es]=Spanish" << endl - << "entry[de]=German" << endl; - } - QVERIFY(config.sync()); - - { - QList<QByteArray> lines; - // this is what the file should look like - lines << "[Merged Group]\n" - << "entry1=Testing\n" - << "entry2=More Testing\n" - << "\n" - << "[some group]\n" - << "another entry=blah blah blah\n" - << "entry=\\srandom entry\n" - << "entry[de]=German\n" - << "entry[es]=Spanish\n" - << "entry[fr]=French\n"; - QFile file(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/mergetest"); - file.open(QIODevice::ReadOnly|QIODevice::Text); - Q_FOREACH (const QByteArray& line, lines) { - QCOMPARE(line, file.readLine()); - } - } -} - -void KConfigTest::testImmutable() -{ - { - QFile file(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/immutabletest"); - file.open(QIODevice::WriteOnly|QIODevice::Text); - QTextStream out(&file); - out.setCodec("UTF-8"); - out << "[$i]" << endl - << "entry1=Testing" << endl - << "[group][$i]" << endl - << "[group][subgroup][$i]" << endl; - } - - KConfig config("immutabletest", KConfig::SimpleConfig); - QVERIFY(config.isGroupImmutable(QByteArray())); - KConfigGroup cg = config.group(QByteArray()); - QVERIFY(cg.isEntryImmutable("entry1")); - KConfigGroup cg1 = config.group("group"); - QVERIFY(cg1.isImmutable()); - KConfigGroup cg1a = cg.group("group"); - QVERIFY(cg1a.isImmutable()); - KConfigGroup cg2 = cg1.group("subgroup"); - QVERIFY(cg2.isImmutable()); -} - -void KConfigTest::testOptionOrder() -{ - { - QFile file(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/doubleattrtest"); - file.open(QIODevice::WriteOnly|QIODevice::Text); - QTextStream out(&file); - out.setCodec("UTF-8"); - out << "[group3]" << endl - << "entry2=unlocalized" << endl - << "entry2[$i][de_DE]=t2" << endl; - } - KConfig config("doubleattrtest", KConfig::SimpleConfig); - config.setLocale("de_DE"); - KConfigGroup cg3 = config.group("group3"); - QVERIFY(!cg3.isImmutable()); - QCOMPARE(cg3.readEntry("entry2",""), QString("t2")); - QVERIFY(cg3.isEntryImmutable("entry2")); - config.setLocale("C"); - QCOMPARE(cg3.readEntry("entry2",""), QString("unlocalized")); - QVERIFY(!cg3.isEntryImmutable("entry2")); - cg3.writeEntry("entry2","modified"); - QVERIFY(config.sync()); - - { - QList<QByteArray> lines; - // this is what the file should look like - lines << "[group3]\n" - << "entry2=modified\n" - << "entry2[de_DE][$i]=t2\n"; - - QFile file(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/doubleattrtest"); - file.open(QIODevice::ReadOnly|QIODevice::Text); - Q_FOREACH (const QByteArray& line, lines) { - QCOMPARE(line, file.readLine()); - } - } -} - - -void KConfigTest::testGroupEscape() -{ - KConfig config("groupescapetest", KConfig::SimpleConfig); - QVERIFY( config.group(DOLLARGROUP).exists() ); -} - -void KConfigTest::testSubGroup() -{ - KConfig sc( "kconfigtest" ); - KConfigGroup cg( &sc, "ParentGroup" ); - QCOMPARE(cg.readEntry( "parentgrpstring", ""), QString("somevalue") ); - KConfigGroup subcg1( &cg, "SubGroup1"); - QCOMPARE(subcg1.name(), QString("SubGroup1")); - QCOMPARE(subcg1.readEntry( "somestring", ""), QString("somevalue") ); - KConfigGroup subcg2( &cg, "SubGroup2"); - QCOMPARE(subcg2.name(), QString("SubGroup2")); - QCOMPARE(subcg2.readEntry( "substring", ""), QString("somevalue") ); - KConfigGroup subcg3( &cg, "SubGroup/3"); - QCOMPARE(subcg3.readEntry( "sub3string", ""), QString("somevalue") ); - QCOMPARE(subcg3.name(), QString("SubGroup/3")); - KConfigGroup rcg( &sc, "" ); - KConfigGroup srcg( &rcg, "ParentGroup" ); - QCOMPARE(srcg.readEntry( "parentgrpstring", ""), QString("somevalue") ); - - QStringList groupList = cg.groupList(); - groupList.sort(); // comes from QSet, so order is undefined - QCOMPARE(groupList, (QStringList() << "SubGroup/3" << "SubGroup1" << "SubGroup2")); - - const QStringList expectedSubgroup3Keys = (QStringList() << "sub3string"); - QCOMPARE(subcg3.keyList(), expectedSubgroup3Keys); - const QStringList expectedParentGroupKeys(QStringList() << "parentgrpstring"); - - QCOMPARE(cg.keyList(), expectedParentGroupKeys); - - QCOMPARE(QStringList(cg.entryMap().keys()), expectedParentGroupKeys); - QCOMPARE(QStringList(subcg3.entryMap().keys()), expectedSubgroup3Keys); - - // Create A group containing only other groups. We want to make sure it - // shows up in groupList of sc - KConfigGroup neg(&sc, "NoEntryGroup"); - KConfigGroup negsub1(&neg, "NEG Child1"); - negsub1.writeEntry( "entry", "somevalue" ); - KConfigGroup negsub2(&neg, "NEG Child2"); - KConfigGroup negsub3(&neg, "NEG Child3"); - KConfigGroup negsub31(&negsub3, "NEG Child3-1"); - KConfigGroup negsub4(&neg, "NEG Child4"); - KConfigGroup negsub41(&negsub4, "NEG Child4-1"); - negsub41.writeEntry( "entry", "somevalue" ); - - // A group exists if it has content - QVERIFY(negsub1.exists()); - - // But it doesn't exist if it has no content - // Ossi and David say: this is how it's supposed to work. - // However you could add a dummy entry for now, or we could add a "Persist" feature to kconfig groups - // which would make it written out, much like "immutable" already makes them persistent. - QVERIFY(!negsub2.exists()); - - // A subgroup does not qualify as content if it is also empty - QVERIFY(!negsub3.exists()); - - // A subgroup with content is ok - QVERIFY(negsub4.exists()); - - // Only subgroups with content show up in groupList() - //QEXPECT_FAIL("", "Empty subgroups do not show up in groupList()", Continue); - //QCOMPARE(neg.groupList(), QStringList() << "NEG Child1" << "NEG Child2" << "NEG Child3" << "NEG Child4"); - // This is what happens - QStringList groups = neg.groupList(); - groups.sort(); // Qt5 made the ordering unreliable, due to QHash - QCOMPARE(groups, QStringList() << "NEG Child1" << "NEG Child4"); - - // make sure groupList() isn't returning something it shouldn't - Q_FOREACH(const QString& group, sc.groupList()) { - QVERIFY(!group.isEmpty() && group != "<default>"); - QVERIFY(!group.contains(QChar(0x1d))); - QVERIFY(!group.contains("subgroup")); - QVERIFY(!group.contains("SubGroup")); - } - - QVERIFY(sc.sync()); - - // Check that the empty groups are not written out. - const QList<QByteArray> lines = readLines(); - QVERIFY(lines.contains("[NoEntryGroup][NEG Child1]\n")); - QVERIFY(!lines.contains("[NoEntryGroup][NEG Child2]\n")); - QVERIFY(!lines.contains("[NoEntryGroup][NEG Child3]\n")); - QVERIFY(!lines.contains("[NoEntryGroup][NEG Child4]\n")); // implicit group, not written out - QVERIFY(lines.contains("[NoEntryGroup][NEG Child4][NEG Child4-1]\n")); -} - -void KConfigTest::testAddConfigSources() -{ - KConfig cf("specificrc"); - - cf.addConfigSources(QStringList() << QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/baserc"); - cf.reparseConfiguration(); - - KConfigGroup specificgrp(&cf, "Specific Only Group"); - QCOMPARE(specificgrp.readEntry("ExistingEntry", ""), QString("DevValue")); - - KConfigGroup sharedgrp(&cf, "Shared Group"); - QCOMPARE(sharedgrp.readEntry("SomeSpecificOnlyEntry",""), QString("DevValue")); - QCOMPARE(sharedgrp.readEntry("SomeBaseOnlyEntry",""), QString("BaseValue")); - QCOMPARE(sharedgrp.readEntry("SomeSharedEntry",""), QString("DevValue")); - - KConfigGroup basegrp(&cf, "Base Only Group"); - QCOMPARE(basegrp.readEntry("ExistingEntry", ""), QString("BaseValue")); - basegrp.writeEntry("New Entry Base Only", "SomeValue"); - - KConfigGroup newgrp(&cf, "New Group"); - newgrp.writeEntry("New Entry", "SomeValue"); - - QVERIFY(cf.sync()); - - KConfig plaincfg("specificrc"); - - KConfigGroup newgrp2(&plaincfg, "New Group"); - QCOMPARE(newgrp2.readEntry("New Entry", ""), QString("SomeValue")); - - KConfigGroup basegrp2(&plaincfg, "Base Only Group"); - QCOMPARE(basegrp2.readEntry("New Entry Base Only", ""), QString("SomeValue")); -} - -void KConfigTest::testGroupCopyTo() -{ - KConfig cf1("kconfigtest"); - KConfigGroup original = cf1.group("Enum Types"); - - KConfigGroup copy = cf1.group("Enum Types Copy"); - original.copyTo(©); // copy from one group to another - QCOMPARE(copy.entryMap(), original.entryMap()); - - KConfig cf2("copy_of_kconfigtest", KConfig::SimpleConfig); - QVERIFY(!cf2.hasGroup(original.name())); - QVERIFY(!cf2.hasGroup(copy.name())); - - KConfigGroup newGroup = cf2.group(original.name()); - original.copyTo(&newGroup); // copy from one file to another - QVERIFY(cf2.hasGroup(original.name())); - QVERIFY(!cf2.hasGroup(copy.name())); // make sure we didn't copy more than we wanted - QCOMPARE(newGroup.entryMap(), original.entryMap()); -} - -void KConfigTest::testConfigCopyToSync() -{ - KConfig cf1("kconfigtest"); - // Prepare source file - KConfigGroup group(&cf1, "CopyToTest"); - group.writeEntry("Type", "Test"); - QVERIFY(cf1.sync()); - - // Copy to "destination" - const QString destination = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/kconfigcopytotest"; - QFile::remove(destination); - - KConfig cf2("kconfigcopytotest"); - KConfigGroup group2(&cf2, "CopyToTest"); - - group.copyTo(&group2); - - QString testVal = group2.readEntry("Type"); - QCOMPARE(testVal, QString("Test")); - // should write to disk the copied data from group - QVERIFY(cf2.sync()); - QVERIFY(QFile::exists(destination)); -} - -void KConfigTest::testConfigCopyTo() -{ - KConfig cf1("kconfigtest"); - { - // Prepare source file - KConfigGroup group(&cf1, "CopyToTest"); - group.writeEntry("Type", "Test"); - QVERIFY(cf1.sync()); - } - - { - // Copy to "destination" - const QString destination = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/kconfigcopytotest"; - QFile::remove(destination); - KConfig cf2; - cf1.copyTo(destination, &cf2); - KConfigGroup group2(&cf2, "CopyToTest"); - QString testVal = group2.readEntry("Type"); - QCOMPARE(testVal, QString("Test")); - QVERIFY(cf2.sync()); - QVERIFY(QFile::exists(destination)); - } - - // Check copied config file on disk - KConfig cf3("kconfigcopytotest"); - KConfigGroup group3(&cf3, "CopyToTest"); - QString testVal = group3.readEntry("Type"); - QCOMPARE(testVal, QString("Test")); -} - -void KConfigTest::testReparent() -{ - KConfig cf("kconfigtest"); - const QString name("Enum Types"); - KConfigGroup group = cf.group(name); - const QMap<QString, QString> originalMap = group.entryMap(); - KConfigGroup parent = cf.group("Parent Group"); - - QVERIFY(!parent.hasGroup(name)); - - QVERIFY(group.entryMap() == originalMap); - - group.reparent(&parent); // see if it can be made a sub-group of another group - QVERIFY(parent.hasGroup(name)); - QCOMPARE(group.entryMap(), originalMap); - - group.reparent(&cf); // see if it can make it a top-level group again -// QVERIFY(!parent.hasGroup(name)); - QCOMPARE(group.entryMap(), originalMap); -} - -static void ageTimeStamp(const QString& path, int nsec) -{ -#ifdef Q_OS_UNIX - QDateTime mtime = QFileInfo(path).lastModified().addSecs(-nsec); - struct utimbuf utbuf; - utbuf.actime = mtime.toTime_t(); - utbuf.modtime = utbuf.actime; - utime(QFile::encodeName(path), &utbuf); -#else - QTest::qSleep(nsec * 1000); -#endif -} - -void KConfigTest::testWriteOnSync() -{ - QDateTime oldStamp, newStamp; - KConfig sc("kconfigtest", KConfig::IncludeGlobals); - - // Age the timestamp of global config file a few sec, and collect it. - QString globFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/kdeglobals"; - ageTimeStamp(globFile, 2); // age 2 sec - oldStamp = QFileInfo(globFile).lastModified(); - - // Add a local entry and sync the config. - // Should not rewrite the global config file. - KConfigGroup cgLocal(&sc, "Locals"); - cgLocal.writeEntry("someLocalString", "whatever"); - QVERIFY(sc.sync()); - - // Verify that the timestamp of global config file didn't change. - newStamp = QFileInfo(globFile).lastModified(); - QCOMPARE(newStamp, oldStamp); - - // Age the timestamp of local config file a few sec, and collect it. - QString locFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/kconfigtest"; - ageTimeStamp(locFile, 2); // age 2 sec - oldStamp = QFileInfo(locFile).lastModified(); - - // Add a global entry and sync the config. - // Should not rewrite the local config file. - KConfigGroup cgGlobal(&sc, "Globals"); - cgGlobal.writeEntry("someGlobalString", "whatever", - KConfig::Persistent|KConfig::Global); - QVERIFY(sc.sync()); - - // Verify that the timestamp of local config file didn't change. - newStamp = QFileInfo(locFile).lastModified(); - QCOMPARE(newStamp, oldStamp); -} - -void KConfigTest::testFailOnReadOnlyFileSync() -{ - KConfig sc("kconfigfailonreadonlytest"); - KConfigGroup cgLocal(&sc, "Locals"); - - cgLocal.writeEntry("someLocalString", "whatever"); - QVERIFY(cgLocal.sync()); - - QFile f(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + '/' + sc.name()); - QVERIFY(f.exists()); - QVERIFY(f.setPermissions(QFileDevice::ReadOwner)); - - cgLocal.writeEntry("someLocalString", "whatever2"); - QVERIFY(!cgLocal.sync()); - - QVERIFY(f.setPermissions(QFileDevice::ReadOwner | QFileDevice::WriteOwner)); - QVERIFY(f.remove()); -} - -void KConfigTest::testDirtyOnEqual() -{ - QDateTime oldStamp, newStamp; - KConfig sc("kconfigtest"); - - // Initialize value - KConfigGroup cgLocal(&sc, "random"); - cgLocal.writeEntry("theKey", "whatever"); - QVERIFY(sc.sync()); - - // Age the timestamp of local config file a few sec, and collect it. - QString locFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/kconfigtest"; - ageTimeStamp(locFile, 2); // age 2 sec - oldStamp = QFileInfo(locFile).lastModified(); - - // Write exactly the same again - cgLocal.writeEntry("theKey", "whatever"); - // This should be a no-op - QVERIFY(sc.sync()); - - // Verify that the timestamp of local config file didn't change. - newStamp = QFileInfo(locFile).lastModified(); - QCOMPARE(newStamp, oldStamp); -} - -void KConfigTest::testDirtyOnEqualOverdo() -{ - QByteArray val1("\0""one", 4); - QByteArray val2("\0""two", 4); - QByteArray defvalr; - - KConfig sc("kconfigtest"); - KConfigGroup cgLocal(&sc, "random"); - cgLocal.writeEntry("someKey", val1); - QCOMPARE(cgLocal.readEntry("someKey", defvalr), val1); - cgLocal.writeEntry("someKey", val2); - QCOMPARE(cgLocal.readEntry("someKey", defvalr), val2); -} - - -void KConfigTest::testCreateDir() -{ - // Test auto-creating the parent directory when needed (KConfigIniBackend::createEnclosing) - QString kdehome = QDir::home().canonicalPath() + "/.kde-unit-test"; - QString subdir = kdehome + "/newsubdir"; - QString file = subdir + "/foo.desktop"; - QFile::remove(file); - QDir().rmdir(subdir); - QVERIFY(!QDir().exists(subdir)); - KDesktopFile desktopFile(file); - desktopFile.desktopGroup().writeEntry("key", "value"); - QVERIFY(desktopFile.sync()); - QVERIFY(QFile::exists(file)); - - // Cleanup - QFile::remove(file); - QDir().rmdir(subdir); -} - -void KConfigTest::testSyncOnExit() -{ - // Often, the KGlobalPrivate global static's destructor ends up calling ~KConfig -> - // KConfig::sync ... and if that code triggers KGlobal code again then things could crash. - // So here's a test for modifying KSharedConfig::openConfig() and not syncing, the process exit will sync. - KConfigGroup grp(KSharedConfig::openConfig(), "syncOnExit"); - grp.writeEntry("key", "value"); -} - -void KConfigTest::testSharedConfig() -{ - // Can I use a KConfigGroup even after the KSharedConfigPtr goes out of scope? - KConfigGroup myConfigGroup; - { - KSharedConfigPtr config = KSharedConfig::openConfig("kconfigtest"); - myConfigGroup = KConfigGroup(config, "Hello"); - } - QCOMPARE(myConfigGroup.readEntry("stringEntry1"), QString(STRINGENTRY1)); -} - -void KConfigTest::testLocaleConfig() -{ - // Initialize the testdata - QDir dir; - QString subdir = QDir::home().canonicalPath() + "/.kde-unit-test/"; - dir.mkpath(subdir); - QString file = subdir + "/localized.test"; - QFile::remove(file); - QFile f(file); - QVERIFY(f.open(QIODevice::WriteOnly)); - QTextStream ts(&f); - ts << "[Test_Wrong]\n"; - ts << "foo[ca]=5\n"; - ts << "foostring[ca]=nice\n"; - ts << "foobool[ca]=true\n"; - ts << "[Test_Right]\n"; - ts << "foo=5\n"; - ts << "foo[ca]=5\n"; - ts << "foostring=primary\n"; - ts << "foostring[ca]=nice\n"; - ts << "foobool=primary\n"; - ts << "foobool[ca]=true\n"; - f.close(); - - // Load the testdata - QVERIFY(QFile::exists(file)); - KConfig config(file); - config.setLocale("ca"); - - // This group has only localized values. That is not supported. The values - // should be dropped on loading. - KConfigGroup cg(&config, "Test_Wrong"); - QEXPECT_FAIL("", "The localized values are not dropped", Continue); - QVERIFY(!cg.hasKey("foo")); - QEXPECT_FAIL("", "The localized values are not dropped", Continue); - QVERIFY(!cg.hasKey("foostring")); - QEXPECT_FAIL("", "The localized values are not dropped", Continue); - QVERIFY(!cg.hasKey("foobool")); - - // Now check the correct config group - KConfigGroup cg2(&config, "Test_Right"); - QCOMPARE(cg2.readEntry("foo"), QString("5")); - QCOMPARE(cg2.readEntry("foo", 3), 5); - QCOMPARE(cg2.readEntry("foostring"), QString("nice")); - QCOMPARE(cg2.readEntry("foostring", "ugly"), QString("nice")); - QCOMPARE(cg2.readEntry("foobool"), QString("true")); - QCOMPARE(cg2.readEntry("foobool", false), true); - - // Clean up after the testcase - QFile::remove(file); -} - - -void KConfigTest::testDeleteWhenLocalized() -{ - // Initialize the testdata - QDir dir; - QString subdir = QDir::home().canonicalPath() + "/.kde-unit-test/"; - dir.mkpath(subdir); - QString file = subdir + "/localized_delete.test"; - QFile::remove(file); - QFile f(file); - QVERIFY(f.open(QIODevice::WriteOnly)); - QTextStream ts(&f); - ts << "[Test4711]\n"; - ts << "foo=3\n"; - ts << "foo[ca]=5\n"; - ts << "foo[de]=7\n"; - ts << "foostring=ugly\n"; - ts << "foostring[ca]=nice\n"; - ts << "foostring[de]=schoen\n"; - ts << "foobool=false\n"; - ts << "foobool[ca]=true\n"; - ts << "foobool[de]=true\n"; - f.close(); - - // Load the testdata. We start in locale "ca". - QVERIFY(QFile::exists(file)); - KConfig config(file); - config.setLocale("ca"); - KConfigGroup cg(&config, "Test4711"); - - // Delete a value. Once with localized, once with Normal - cg.deleteEntry("foostring", KConfigBase::Persistent | KConfigBase::Localized); - cg.deleteEntry("foobool"); - QVERIFY(config.sync()); - - // The value is now gone. The others are still there. Everything correct - // here. - QVERIFY(!cg.hasKey("foostring")); - QVERIFY(!cg.hasKey("foobool")); - QVERIFY(cg.hasKey("foo")); - - // The current state is: (Just return before this comment.) - // [...] - // foobool[ca]=true - // foobool[de]=wahr - // foostring=ugly - // foostring[de]=schoen - - // Now switch the locale to "de" and repeat the checks. Results should be - // the same. But they currently are not. The localized value are - // independent of each other. All values are still there in "de". - config.setLocale("de"); - QEXPECT_FAIL("", "Currently localized values are not deleted correctly", Continue); - QVERIFY(!cg.hasKey("foostring")); - QEXPECT_FAIL("", "Currently localized values are not deleted correctly", Continue); - QVERIFY(!cg.hasKey("foobool")); - QVERIFY(cg.hasKey("foo")); - // Check where the wrong values come from. - // We get the "de" value. - QCOMPARE(cg.readEntry("foostring", "nothing"), QString("schoen")); - // We get the "de" value. - QCOMPARE(cg.readEntry("foobool", false), true); - - // Now switch the locale back "ca" and repeat the checks. Results are - // again different. - config.setLocale("ca"); - // This line worked above. But now it fails. - QEXPECT_FAIL("", "Currently localized values are not deleted correctly", Continue); - QVERIFY(!cg.hasKey("foostring")); - // This line worked above too. - QEXPECT_FAIL("", "Currently localized values are not deleted correctly", Continue); - QVERIFY(!cg.hasKey("foobool")); - QVERIFY(cg.hasKey("foo")); - // Check where the wrong values come from. - // We get the primary value because the "ca" value was deleted. - QCOMPARE(cg.readEntry("foostring", "nothing"), QString("ugly")); - // We get the "ca" value. - QCOMPARE(cg.readEntry("foobool", false), true); - - // Now test the deletion of a group. - cg.deleteGroup(); - QVERIFY(config.sync()); - - // Current state: [ca] and [de] entries left... oops. - //qDebug() << readLinesFrom(file); - - // Bug: The group still exists [because of the localized entries]... - QVERIFY(cg.exists()); - QVERIFY(!cg.hasKey("foo")); - QVERIFY(!cg.hasKey("foostring")); - QEXPECT_FAIL("", "Currently localized values are not deleted correctly", Continue); - QVERIFY(!cg.hasKey("foobool")); - - // Now switch the locale to "de" and repeat the checks. All values - // still here because only the primary values are deleted. - config.setLocale("de"); - QEXPECT_FAIL("", "Currently localized values are not deleted correctly", Continue); - QVERIFY(!cg.hasKey("foo")); - QEXPECT_FAIL("", "Currently localized values are not deleted correctly", Continue); - QVERIFY(!cg.hasKey("foostring")); - QEXPECT_FAIL("", "Currently localized values are not deleted correctly", Continue); - QVERIFY(!cg.hasKey("foobool")); - // Check where the wrong values come from. - // We get the "de" value. - QCOMPARE(cg.readEntry("foostring", "nothing"), QString("schoen")); - // We get the "de" value. - QCOMPARE(cg.readEntry("foobool", false), true); - // We get the "de" value. - QCOMPARE(cg.readEntry("foo", 0), 7); - - // Now switch the locale to "ca" and repeat the checks - // "foostring" is now really gone because both the primary value and the - // "ca" value are deleted. - config.setLocale("ca"); - QEXPECT_FAIL("", "Currently localized values are not deleted correctly", Continue); - QVERIFY(!cg.hasKey("foo")); - QVERIFY(!cg.hasKey("foostring")); - QEXPECT_FAIL("", "Currently localized values are not deleted correctly", Continue); - QVERIFY(!cg.hasKey("foobool")); - // Check where the wrong values come from. - // We get the "ca" value. - QCOMPARE(cg.readEntry("foobool", false), true); - // We get the "ca" value. - QCOMPARE(cg.readEntry("foo", 0), 5); - - // Cleanup - QFile::remove(file); -} - - -void KConfigTest::testKdeGlobals() -{ - { - KConfig glob("kdeglobals"); - KConfigGroup general(&glob, "General"); - general.writeEntry("testKG", "1"); - QVERIFY(glob.sync()); - } - - KConfig globRead("kdeglobals"); - const KConfigGroup general(&globRead, "General"); - QCOMPARE(general.readEntry("testKG"), QString("1")); - - // Check we wrote into kdeglobals - const QList<QByteArray> lines = readLines("kdeglobals"); - QVERIFY(lines.contains("[General]\n")); - QVERIFY(lines.contains("testKG=1\n")); - - // Writing using NoGlobals - { - KConfig glob("kdeglobals", KConfig::NoGlobals); - KConfigGroup general(&glob, "General"); - general.writeEntry("testKG", "2"); - QVERIFY(glob.sync()); - } - globRead.reparseConfiguration(); - QCOMPARE(general.readEntry("testKG"), QString("2")); - - // Reading using NoGlobals - { - KConfig globReadNoGlob("kdeglobals", KConfig::NoGlobals); - const KConfigGroup generalNoGlob(&globReadNoGlob, "General"); - QCOMPARE(generalNoGlob.readEntry("testKG"), QString("2")); - } - - // TODO now use kconfigtest and writeEntry(,Global) -> should go into kdeglobals -} - -void KConfigTest::testAnonymousConfig() -{ - KConfig anonConfig(QString(), KConfig::SimpleConfig); - KConfigGroup general(&anonConfig, "General"); - QCOMPARE(general.readEntry("testKG"), QString()); // no kdeglobals merging - general.writeEntry("Foo", "Bar"); - QCOMPARE(general.readEntry("Foo"), QString("Bar")); -} - -#include <QThreadPool> -#include <qtconcurrentrun.h> - -// To find multithreading bugs: valgrind --tool=helgrind --track-lockorders=no ./kconfigtest testThreads -void KConfigTest::testThreads() -{ - QThreadPool::globalInstance()->setMaxThreadCount(6); - QList<QFuture<void> > futures; - // Run in parallel some tests that work on different config files, - // otherwise unexpected things might indeed happen. - futures << QtConcurrent::run(this, &KConfigTest::testAddConfigSources); - futures << QtConcurrent::run(this, &KConfigTest::testSimple); - futures << QtConcurrent::run(this, &KConfigTest::testDefaults); - // QEXPECT_FAIL triggers race conditions, it should be fixed to use QThreadStorage... - //futures << QtConcurrent::run(this, &KConfigTest::testDeleteWhenLocalized); - //futures << QtConcurrent::run(this, &KConfigTest::testEntryMap); - Q_FOREACH(QFuture<void> f, futures) // krazy:exclude=foreach - f.waitForFinished(); -} diff --git a/tier1/kconfig/autotests/kconfigtest.h b/tier1/kconfig/autotests/kconfigtest.h deleted file mode 100644 index ba929086..00000000 --- a/tier1/kconfig/autotests/kconfigtest.h +++ /dev/null @@ -1,86 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 1997 Matthias Kalle Dalheimer (kalle@kde.org) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef KCONFIGTEST_H -#define KCONFIGTEST_H - -#include <QtCore/QObject> - -class KConfigTest : public QObject -{ - Q_OBJECT - Q_ENUMS(Testing) - Q_FLAGS(Flags) - -public: - enum Testing { Ones=1, Tens=10, Hundreds=100}; - enum bits { bit0=1, bit1=2, bit2=4, bit3=8 }; - Q_DECLARE_FLAGS(Flags, bits) - -private Q_SLOTS: - void initTestCase(); - void cleanupTestCase(); - void testSimple(); - void testDefaults(); - void testLists(); - void testLocale(); - void testEncoding(); - void testPath(); - void testPersistenceOfExpandFlagForPath(); - void testComplex(); - void testEnums(); - void testEntryMap(); - void testInvalid(); - void testDeleteEntry(); - void testDelete(); - void testDeleteWhenLocalized(); - void testDefaultGroup(); - void testEmptyGroup(); - void testCascadingWithLocale(); - void testMerge(); - void testImmutable(); - void testGroupEscape(); - void testRevertAllEntries(); - void testChangeGroup(); - void testGroupCopyTo(); - void testConfigCopyTo(); - void testConfigCopyToSync(); - void testReparent(); - void testAnonymousConfig(); - - void testSubGroup(); - void testAddConfigSources(); - void testWriteOnSync(); - void testFailOnReadOnlyFileSync(); - void testDirtyOnEqual(); - void testDirtyOnEqualOverdo(); - void testCreateDir(); - void testSharedConfig(); - void testOptionOrder(); - void testLocaleConfig(); - void testDirtyAfterRevert(); - void testKdeGlobals(); - - void testThreads(); - - // should be last - void testSyncOnExit(); -}; -Q_DECLARE_OPERATORS_FOR_FLAGS(KConfigTest::Flags) - -#endif /* KCONFIGTEST_H */ diff --git a/tier1/kconfig/autotests/kdesktopfiletest.cpp b/tier1/kconfig/autotests/kdesktopfiletest.cpp deleted file mode 100644 index d77e3a50..00000000 --- a/tier1/kconfig/autotests/kdesktopfiletest.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2006 David Faure <faure@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License version 2 as published by the Free Software Foundation; - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#include "kdesktopfiletest.h" -#include <kconfiggroup.h> -#include <qtemporaryfile.h> - -#include "kdesktopfile.h" - -#include <QtTest> - -QTEST_MAIN( KDesktopFileTest ) - -void KDesktopFileTest::testRead() -{ - QTemporaryFile file("testReadXXXXXX.desktop"); - QVERIFY( file.open() ); - const QString fileName = file.fileName(); - QTextStream ts( &file ); - ts << - "[Desktop Entry]\n" - "Type=Application\n" - "Name=My Application\n" - "Icon=foo\n" - "\n"; - file.close(); - QVERIFY(QFile::exists(fileName)); - QVERIFY(KDesktopFile::isDesktopFile(fileName)); - KDesktopFile df(fileName); - QCOMPARE(df.readType(), QString::fromLatin1("Application")); - QVERIFY(df.hasApplicationType()); - QCOMPARE(df.readName(), QString::fromLatin1("My Application")); - QCOMPARE(df.readIcon(), QString::fromLatin1("foo")); - QVERIFY(!df.hasLinkType()); - QCOMPARE(df.fileName(), QFileInfo(fileName).canonicalFilePath()); -} - -void KDesktopFileTest::testSuccessfulTryExec() -{ - QTemporaryFile file; - QVERIFY( file.open() ); - const QString fileName = file.fileName(); - QTextStream ts( &file ); - ts << - "[Desktop Entry]\n" - "TryExec=whoami\n" - "\n"; - file.close(); - QVERIFY(QFile::exists(fileName)); - KDesktopFile df(fileName); - QCOMPARE(df.tryExec(), true); -} - -void KDesktopFileTest::testUnsuccessfulTryExec() -{ - QTemporaryFile file; - QVERIFY( file.open() ); - const QString fileName = file.fileName(); - QTextStream ts( &file ); - ts << - "[Desktop Entry]\n" - "TryExec=/does/not/exist\n" - "\n"; - file.close(); - QVERIFY(QFile::exists(fileName)); - KDesktopFile df(fileName); - QCOMPARE(df.tryExec(), false); -} - -void KDesktopFileTest::testActionGroup() -{ - QTemporaryFile file; - QVERIFY( file.open() ); - const QString fileName = file.fileName(); - QTextStream ts( &file ); - ts << - "[Desktop Entry]\n" - "Actions=encrypt;\n" - "[Desktop Action encrypt]\n" - "Name=Encrypt file\n" - "\n"; - file.close(); - QVERIFY(QFile::exists(fileName)); - KDesktopFile df(fileName); - QCOMPARE(df.readType(), QString()); - QCOMPARE(df.fileName(), fileName); - QCOMPARE(df.readActions(), QStringList() << "encrypt"); - QCOMPARE(df.hasActionGroup("encrypt"), true); - QCOMPARE(df.hasActionGroup("doesnotexist"), false); - KConfigGroup cg = df.actionGroup("encrypt"); - QVERIFY(cg.hasKey("Name")); - QCOMPARE(cg.readEntry("Name"), QString("Encrypt file")); -} - -void KDesktopFileTest::testIsAuthorizedDesktopFile() -{ - QTemporaryFile file("testAuthXXXXXX.desktop"); - QVERIFY( file.open() ); - const QString fileName = file.fileName(); - QTextStream ts( &file ); - ts << - "[Desktop Entry]\n" - "Type=Application\n" - "Name=My Application\n" - "Exec=kfoo\n" - "\n"; - file.close(); - QVERIFY(QFile::exists(fileName)); - QVERIFY(!KDesktopFile::isAuthorizedDesktopFile(fileName)); - - const QString installedFile = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("/kde5/services/") + "http_cache_cleaner.desktop"); - if (!installedFile.isEmpty()) { - QVERIFY(KDesktopFile::isAuthorizedDesktopFile(installedFile)); - } else { - qWarning("Skipping test for http_cache_cleaner.desktop, not found. kio not installed?"); - } - - const QString autostartFile = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, QLatin1String("autostart/") + "plasma-desktop.desktop"); - if (!autostartFile.isEmpty()) { - QVERIFY(KDesktopFile::isAuthorizedDesktopFile(autostartFile)); - } else { - qWarning("Skipping test for plasma-desktop.desktop, not found. kde-workspace not installed?"); - } -} diff --git a/tier1/kconfig/autotests/kdesktopfiletest.h b/tier1/kconfig/autotests/kdesktopfiletest.h deleted file mode 100644 index d57351fd..00000000 --- a/tier1/kconfig/autotests/kdesktopfiletest.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2006 David Faure <faure@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License version 2 as published by the Free Software Foundation; - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef KDESKTOPFILETEST_H -#define KDESKTOPFILETEST_H - -#include <QtCore/QObject> - -class KDesktopFileTest : public QObject -{ - Q_OBJECT -private Q_SLOTS: - void testRead(); - void testUnsuccessfulTryExec(); - void testSuccessfulTryExec(); - void testActionGroup(); - void testIsAuthorizedDesktopFile(); - -}; - -#endif /* KDESKTOPFILETEST_H */ diff --git a/tier1/kconfig/autotests/kentrymaptest.cpp b/tier1/kconfig/autotests/kentrymaptest.cpp deleted file mode 100644 index 9e926d65..00000000 --- a/tier1/kconfig/autotests/kentrymaptest.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2007 Thomas Braxton (kde.braxton@gmail.com) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "kentrymaptest.h" - -#include <QtTest> -#include "kconfigdata.h" - - -const QByteArray group1("A Group"); -const QByteArray key1("A Key"); -const QByteArray key2("Another Key"); -const QByteArray value1("A value"); -const QByteArray value2("A different value"); - -QTEST_MAIN( KEntryMapTest ) - -void KEntryMapTest::testKeyOrder() -{ - const KEntryKey groupMarker(group1); - const KEntryKey entry(group1, key1); - const KEntryKey localized(group1, key1, true, false); - const KEntryKey localizedDefault(group1, key1, true, true); - const KEntryKey defaultEntry(group1, key1, false, true); - - // group marker should come before all entries - QVERIFY(groupMarker < entry); - QVERIFY(groupMarker < defaultEntry); - QVERIFY(groupMarker < localized); - QVERIFY(groupMarker < localizedDefault); - - // localized should come before entry - QVERIFY(localized < entry); - - // localized-default should come after localized entry - QVERIFY(localized < localizedDefault); - - // localized-default should come before non-localized entry - QVERIFY(localizedDefault < entry); - - // default should come after entry - QVERIFY(entry < defaultEntry); -} - -void KEntryMapTest::testSimple() -{ - KEntryMap map; - - map.setEntry(group1, key1, value1, EntryOptions()); - QCOMPARE(map.size(), 2); // the group marker & 1 key - map.setEntry(group1, key2, value2, EntryOptions()); - QCOMPARE(map.size(), 3); // the group marker & 2 keys - - QVERIFY(map.findEntry(group1) != map.end()); - QVERIFY(map.findEntry(group1.toLower()) == map.end()); - - QVERIFY(map.findEntry(group1, key1) != map.end()); - QVERIFY(map.findEntry(group1, key1.toLower()) == map.end()); - QVERIFY(map.findEntry(group1, key2) != map.end()); - QVERIFY(map.findEntry(group1, key2.toUpper()) == map.end()); - - QByteArray found = map.findEntry(group1, key1)->mValue; - QVERIFY(found == value1); - QVERIFY(found != value2); - - found = map.findEntry(group1, key2)->mValue; - QVERIFY(found != value1); - QVERIFY(found == value2); -} - -void KEntryMapTest::testDirty() -{ - KEntryMap map; - bool ret = map.setEntry(group1, key1, value1, EntryDefault); - QCOMPARE(ret, true); - ret = map.setEntry(group1, key1, value1, EntryDefault); - QCOMPARE(ret, false); - ret = map.setEntry(group1, key2, value2, EntryOptions()); - QCOMPARE(ret, true); - ret = map.setEntry(group1, key2, value2, EntryOptions()); - QCOMPARE(ret, false); -} - -void KEntryMapTest::testDefault() -{ - KEntryMap map; - - map.setEntry(group1, key1, value1, EntryDefault); - QCOMPARE(map.size(), 3); // group marker, default, entry - map.setEntry(group1, key2, value2, EntryOptions()); - QCOMPARE(map.size(), 4); // group marker, default1, entry1, entry2 - - const KEntryMap::ConstIterator defaultEntry(map.findEntry(group1, key1, SearchDefaults)); - const KEntryMap::ConstIterator entry1(map.findEntry(group1, key1)); - const KEntryMap::ConstIterator entry2(map.findEntry(group1, key2)); - - // default set for entry1 - QVERIFY(defaultEntry != map.constEnd()); - QCOMPARE(defaultEntry->mValue, entry1->mValue); - - // no default set for entry2 - QVERIFY(map.findEntry(group1, key2, SearchDefaults) == map.end()); - - // change from default - map.setEntry(group1, key1, value2, EntryOptions()); - QVERIFY(defaultEntry->mValue != entry1->mValue); - QVERIFY(entry1 != entry2); - QCOMPARE(entry1->mValue, entry2->mValue); - - // revert entry1 - map.revertEntry(group1, key1); - QCOMPARE(defaultEntry->mValue, entry1->mValue); - - // revert entry2, no default --> should be marked as deleted - map.revertEntry(group1, key2); - QCOMPARE(entry2->mValue, QByteArray()); - QVERIFY(entry2->bDirty); - QVERIFY(entry2->bReverted); -} - -void KEntryMapTest::testDelete() -{ - KEntryMap map; - - map.setEntry(group1, key1, value1, EntryDefault); - map.setEntry(group1, key2, value2, EntryDefault); - QCOMPARE(map.size(), 5); - - map.setEntry(group1, key2, QByteArray(), EntryDeleted|EntryDirty); - QCOMPARE(map.size(), 5); // entry should still be in map, so it can override merged entries later - QCOMPARE(map.findEntry(group1, key2)->mValue, QByteArray()); -} - -void KEntryMapTest::testGlobal() -{ - KEntryMap map; - - map.setEntry(group1, key1, value1, EntryGlobal); - QCOMPARE(map.findEntry(group1, key1)->bGlobal, true); - - // this should create a new key that is not "global" - map.setEntry(group1, key1, value2, EntryOptions()); - QVERIFY(!map.findEntry(group1, key1)->bGlobal); -} - -void KEntryMapTest::testImmutable() -{ - KEntryMap map; - - map.setEntry(group1, key1, value1, EntryImmutable); - QCOMPARE(map.findEntry(group1, key1)->bImmutable, true); // verify the immutable bit was set - - map.setEntry(group1, key1, value2, EntryOptions()); - QCOMPARE(map.findEntry(group1, key1)->mValue, value1); // verify the value didn't change - - map.clear(); - - map.setEntry(group1, QByteArray(), QByteArray(), EntryImmutable); - QCOMPARE(map.findEntry(group1)->bImmutable, true); // verify the group is immutable - - map.setEntry(group1, key1, value1, EntryOptions()); // should be ignored since the group is immutable - QVERIFY(map.findEntry(group1, key1) == map.end()); -} - -void KEntryMapTest::testLocale() -{ - const QByteArray translatedDefault("hola"); - const QByteArray translated("bonjour"); - const QByteArray untranslated("hello"); - KEntryMap map; - - map.setEntry(group1, key1, untranslated, EntryDefault); - QCOMPARE(map.findEntry(group1, key1)->mValue, untranslated); - QCOMPARE(map.findEntry(group1, key1, SearchLocalized)->mValue, untranslated); // no localized value yet - - map.setEntry(group1, key1, translated, EntryLocalized); - - QCOMPARE(map.findEntry(group1, key1, SearchLocalized)->mValue, translated); // has localized value now - QVERIFY(map.findEntry(group1, key1, SearchLocalized)->mValue != map.findEntry(group1, key1)->mValue); - QCOMPARE(map.findEntry(group1, key1, SearchDefaults|SearchLocalized)->mValue, untranslated); // default should still be untranslated - - map.setEntry(group1, key1, translatedDefault, EntryDefault|EntryLocalized); - QCOMPARE(map.findEntry(group1, key1, SearchLocalized)->mValue, translatedDefault); - map.setEntry(group1, key1, translated, EntryLocalized); // set the translated entry to a different locale - QCOMPARE(map.findEntry(group1, key1, SearchLocalized)->mValue, translated); -} diff --git a/tier1/kconfig/autotests/kentrymaptest.h b/tier1/kconfig/autotests/kentrymaptest.h deleted file mode 100644 index 2855b5c4..00000000 --- a/tier1/kconfig/autotests/kentrymaptest.h +++ /dev/null @@ -1,57 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2007 Thomas Braxton (kde.braxton@gmail.com) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef KENTRYMAPTEST_H -#define KENTRYMAPTEST_H - -#include <QtCore/QObject> -#include "kconfigdata.h" - -class KEntryMapTest : public QObject -{ - Q_OBJECT - -public: - typedef KEntryMap::EntryOptions EntryOptions; - typedef KEntryMap::SearchFlags SearchFlags; - - typedef KEntryMap::SearchFlag SearchFlag; - static const SearchFlag SearchLocalized=KEntryMap::SearchLocalized; - static const SearchFlag SearchDefaults=KEntryMap::SearchDefaults; - - typedef KEntryMap::EntryOption EntryOption; - static const EntryOption EntryDirty=KEntryMap::EntryDirty; - static const EntryOption EntryGlobal=KEntryMap::EntryGlobal; - static const EntryOption EntryImmutable=KEntryMap::EntryImmutable; - static const EntryOption EntryDeleted=KEntryMap::EntryDeleted; - static const EntryOption EntryExpansion=KEntryMap::EntryExpansion; - static const EntryOption EntryDefault=KEntryMap::EntryDefault; - static const EntryOption EntryLocalized=KEntryMap::EntryLocalized; -private Q_SLOTS: - void testKeyOrder(); - void testSimple(); - void testDirty(); - void testDefault(); - void testDelete(); - void testGlobal(); - void testImmutable(); - void testLocale(); -}; - -#endif // KENTRYMAPTEST_H diff --git a/tier1/kconfig/autotests/ksharedconfigtest.cpp b/tier1/kconfig/autotests/ksharedconfigtest.cpp deleted file mode 100644 index 165322a3..00000000 --- a/tier1/kconfig/autotests/ksharedconfigtest.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - This file is part of the KDE libraries - Copyright (c) 2012 David Faure <faure@kde.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include <QtTest> -#include <ksharedconfig.h> -#include <kconfiggroup.h> - -class KSharedConfigTest : public QObject -{ - Q_OBJECT -private Q_SLOTS: - void initTestCase(); - void testUnicity(); - void testReadWrite(); - void testReadWriteSync(); -private: - QString m_path; -}; - -void KSharedConfigTest::initTestCase() -{ - QStandardPaths::enableTestMode(true); - - m_path = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/ksharedconfigtestrc"; - QFile::remove(m_path); -} - -void KSharedConfigTest::testUnicity() -{ - KSharedConfig::Ptr cfg1 = KSharedConfig::openConfig(); - KSharedConfig::Ptr cfg2 = KSharedConfig::openConfig(); - QCOMPARE(cfg1.data(), cfg2.data()); -} - -void KSharedConfigTest::testReadWrite() -{ - const int value = 1; - { - KConfigGroup cg(KSharedConfig::openConfig(), "KSharedConfigTest"); - cg.writeEntry("NumKey", value); - } - { - KConfigGroup cg(KSharedConfig::openConfig(), "KSharedConfigTest"); - QCOMPARE(cg.readEntry("NumKey", 0), 1); - } -} - -void KSharedConfigTest::testReadWriteSync() -{ - const int value = 1; - { - KConfigGroup cg(KSharedConfig::openConfig(), "KSharedConfigTest"); - cg.writeEntry("NumKey", value); - } - QVERIFY(!QFile::exists(m_path)); - QVERIFY(KSharedConfig::openConfig()->sync()); - QVERIFY(QFile::exists(m_path)); - { - KConfigGroup cg(KSharedConfig::openConfig(), "KSharedConfigTest"); - QCOMPARE(cg.readEntry("NumKey", 0), 1); - } -} - -QTEST_MAIN(KSharedConfigTest) - -#include "ksharedconfigtest.moc" diff --git a/tier1/kconfig/autotests/kstandardshortcuttest.cpp b/tier1/kconfig/autotests/kstandardshortcuttest.cpp deleted file mode 100644 index 847cd074..00000000 --- a/tier1/kconfig/autotests/kstandardshortcuttest.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (c) 2005 David Faure <faure@kde.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include <QtTest/QtTest> -#include "kstandardshortcuttest.h" - -QTEST_MAIN( KStandardShortcutTest) // GUI needed by KAccel - -#include <kstandardshortcut.h> - -void KStandardShortcutTest::testShortcutDefault() -{ - QCOMPARE( QKeySequence::listToString(KStandardShortcut::hardcodedDefaultShortcut( KStandardShortcut::FullScreen )), QLatin1String( "Ctrl+Shift+F" ) ); - QCOMPARE( QKeySequence::listToString(KStandardShortcut::hardcodedDefaultShortcut( KStandardShortcut::BeginningOfLine )), QLatin1String( "Home" ) ); - QCOMPARE( QKeySequence::listToString(KStandardShortcut::hardcodedDefaultShortcut( KStandardShortcut::EndOfLine )), QLatin1String( "End" ) ); - QCOMPARE( QKeySequence::listToString(KStandardShortcut::hardcodedDefaultShortcut( KStandardShortcut::Home )), QLatin1String( "Alt+Home; Home Page" ) ); -} - -void KStandardShortcutTest::testName() -{ - QCOMPARE( KStandardShortcut::name( KStandardShortcut::BeginningOfLine ), QLatin1String( "BeginningOfLine" ) ); - QCOMPARE( KStandardShortcut::name( KStandardShortcut::EndOfLine ), QLatin1String( "EndOfLine" ) ); - QCOMPARE( KStandardShortcut::name( KStandardShortcut::Home ), QLatin1String( "Home" ) ); -} - -void KStandardShortcutTest::testLabel() -{ - // Tests run in English, right? - QCOMPARE( KStandardShortcut::label( KStandardShortcut::FindNext ), QLatin1String( "Find Next" ) ); - QCOMPARE( KStandardShortcut::label( KStandardShortcut::Home ), QLatin1String( "Home" ) ); -} - -void KStandardShortcutTest::testShortcut() -{ - QCOMPARE( QKeySequence::listToString(KStandardShortcut::shortcut( KStandardShortcut::ZoomIn )), QKeySequence::listToString(KStandardShortcut::zoomIn()) ); -} - -void KStandardShortcutTest::testFindStdAccel() -{ - QCOMPARE( KStandardShortcut::find( QString( "Ctrl+F" ) ), KStandardShortcut::Find ); - QCOMPARE( KStandardShortcut::find( QString( "Ctrl+Shift+Alt+G" ) ), KStandardShortcut::AccelNone ); -} - diff --git a/tier1/kconfig/autotests/kstandardshortcuttest.h b/tier1/kconfig/autotests/kstandardshortcuttest.h deleted file mode 100644 index 91be854b..00000000 --- a/tier1/kconfig/autotests/kstandardshortcuttest.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (c) 2005 David Faure <faure@kde.org> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef KSTDACCELTEST_H -#define KSTDACCELTEST_H - -#include <QtCore/QObject> - -class KStandardShortcutTest : public QObject -{ - Q_OBJECT -private Q_SLOTS: - // KStandardShortcut tests - void testShortcutDefault(); - void testName(); - void testLabel(); - void testShortcut(); - void testFindStdAccel(); -}; - - -#endif diff --git a/tier1/kconfig/autotests/test_kconf_update.cpp b/tier1/kconfig/autotests/test_kconf_update.cpp deleted file mode 100644 index 8fae1c74..00000000 --- a/tier1/kconfig/autotests/test_kconf_update.cpp +++ /dev/null @@ -1,553 +0,0 @@ -/* This file is part of the KDE libraries - Copyright 2010 Canonical Ltd - Author: Aurélien Gâteau <aurelien.gateau@canonical.com> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License (LGPL) as published by the Free Software Foundation; - either version 2 of the License, or (at your option) any later - version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "test_kconf_update.h" - -// Qt -#include <QFile> -#include <QDir> -#include <QSharedPointer> -#include <QtCore/QProcess> -#include <qtemporaryfile.h> -#include <qstandardpaths.h> -#include "config-kconf.h" - -#include <qtest.h> - -// QT5 TODO QTEST_GUILESS_MAIN(TestKConfUpdate) -QTEST_MAIN(TestKConfUpdate) - -static void writeFile(const QString &path, const QString &content) -{ - QFile file(path); - bool ok = file.open(QIODevice::WriteOnly); - Q_UNUSED(ok) // silence warnings - Q_ASSERT(ok); - file.write(content.toUtf8()); -} - -static QString readFile(const QString &path) -{ - QFile file(path); - bool ok = file.open(QIODevice::ReadOnly); - Q_UNUSED(ok) // silence warnings - Q_ASSERT(ok); - return QString::fromUtf8(file.readAll()); -} - -static QTemporaryFile* writeUpdFile(const QString &content) -{ - QTemporaryFile* file = new QTemporaryFile(QDir::tempPath() + QLatin1String("/test_kconf_update_XXXXXX.upd")); - bool ok = file->open(); - Q_UNUSED(ok) // silence warnings - Q_ASSERT(ok); - file->write(content.toUtf8()); - file->flush(); - return file; -} - -static void runKConfUpdate(const QString &updPath) -{ - QString exePath = KCONF_UPDATE_BINARY_DIR "/kconf_update"; - QVERIFY(QFile::exists(exePath)); - QProcess::execute(exePath, QStringList() << "--debug" << updPath); -} - -void TestKConfUpdate::test_data() -{ - QTest::addColumn<QString>("updContent"); - QTest::addColumn<QString>("oldConfName"); - QTest::addColumn<QString>("oldConfContent"); - QTest::addColumn<QString>("newConfName"); - QTest::addColumn<QString>("expectedNewConfContent"); - QTest::addColumn<QString>("expectedOldConfContent"); - - QTest::newRow("moveKeysSameFile") - << - "File=testrc\n" - "Group=group\n" - "Key=old,new\n" - "Options=overwrite\n" - << - "testrc" - << - "[group]\n" - "old=value\n" - << - "testrc" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "new=value\n" - << - "" - ; - QTest::newRow("moveKeysOtherFile") - << - "File=oldrc,newrc\n" - "Group=group1,group2\n" - "Key=old,new\n" - "Options=overwrite\n" - << - "oldrc" - << - "[group1]\n" - "old=value\n" - "[stay]\n" - "foo=bar\n" - << - "newrc" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group2]\n" - "new=value\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[stay]\n" - "foo=bar\n" - ; - QTest::newRow("allKeys") - << - "File=testrc\n" - "Group=group1,group2\n" - "AllKeys\n" - << - "testrc" - << - "[group1]\n" - "key1=value1\n" - "key2=value2\n" - "\n" - "[stay]\n" - "foo=bar\n" - << - "testrc" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group2]\n" - "key1=value1\n" - "key2=value2\n" - "\n" - "[stay]\n" - "foo=bar\n" - << - "" - ; - QTest::newRow("allKeysSubGroup") - << - "File=testrc\n" - "Group=[group][sub1],[group][sub2]\n" - "AllKeys\n" - << - "testrc" - << - "[group][sub1]\n" - "key1=value1\n" - "key2=value2\n" - "\n" - "[group][sub1][subsub]\n" - "key3=value3\n" - "key4=value4\n" - "\n" - "[stay]\n" - "foo=bar\n" - << - "testrc" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group][sub2]\n" - "key1=value1\n" - "key2=value2\n" - "\n" - "[group][sub2][subsub]\n" - "key3=value3\n" - "key4=value4\n" - "\n" - "[stay]\n" - "foo=bar\n" - << - "" - ; - QTest::newRow("removeGroup") - << - "File=testrc\n" - "RemoveGroup=remove\n" - << - "testrc" - << - "[keep]\n" - "key=value\n" - "" - "[remove]\n" - "key=value\n" - << - "testrc" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[keep]\n" - "key=value\n" - << - "" - ; - QTest::newRow("moveKeysSameFileDontExist") - << - "File=testrc\n" - "Group=group,group2\n" - "Key=key1\n" - "Key=key2\n" - << - "testrc" - << - "[group]\n" - "key1=value1\n" - "key3=value3\n" - << - "testrc" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "key3=value3\n" - "\n" - "[group2]\n" - "key1=value1\n" - << - "" - ; -} - -void TestKConfUpdate::test() -{ - QFETCH(QString, updContent); - QFETCH(QString, oldConfName); - QFETCH(QString, oldConfContent); - QFETCH(QString, newConfName); - QFETCH(QString, expectedNewConfContent); - QFETCH(QString, expectedOldConfContent); - - // Prepend the Id= field to the upd content - updContent = QString("Id=%1\n").arg(QTest::currentDataTag()) + updContent; - - QString oldConfPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + oldConfName; - QString newConfPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + newConfName; - - QFile::remove(oldConfPath); - QFile::remove(newConfPath); - - writeFile(oldConfPath, oldConfContent); - QSharedPointer<QTemporaryFile> updFile(writeUpdFile(updContent)); - runKConfUpdate(updFile->fileName()); - - QString updateInfo = QString("%1:%2") - .arg(updFile->fileName().section('/', -1)) - .arg(QTest::currentDataTag()); - - QString newConfContentAfter = readFile(newConfPath); - expectedNewConfContent = expectedNewConfContent.arg(updateInfo); - QCOMPARE(newConfContentAfter, expectedNewConfContent); - - if (oldConfName != newConfName) { - QString oldConfContentAfter = readFile(oldConfPath); - expectedOldConfContent = expectedOldConfContent.arg(updateInfo); - QCOMPARE(oldConfContentAfter, expectedOldConfContent); - } -} - -void TestKConfUpdate::testScript_data() -{ - QTest::addColumn<QString>("updContent"); - QTest::addColumn<QString>("updScript"); - QTest::addColumn<QString>("oldConfContent"); - QTest::addColumn<QString>("expectedNewConfContent"); - - QTest::newRow("delete-key") - << - "File=testrc\n" - "Group=group\n" - "Script=test.sh,sh\n" - << - "echo '# DELETE deprecated'\n" - << - "[group]\n" - "deprecated=foo\n" - "valid=bar\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "valid=bar\n" - ; - - QTest::newRow("delete-key2") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '# DELETE [group]deprecated'\n" - "echo '# DELETE [group][sub]deprecated2'\n" - << - "[group]\n" - "deprecated=foo\n" - "valid=bar\n" - "\n" - "[group][sub]\n" - "deprecated2=foo\n" - "valid2=bar\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "valid=bar\n" - "\n" - "[group][sub]\n" - "valid2=bar\n" - ; - - QTest::newRow("delete-group") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '# DELETEGROUP [group1]'\n" - "echo '# DELETEGROUP [group2][sub]'\n" - << - "[group1]\n" - "key=value\n" - "\n" - "[group2]\n" - "valid=bar\n" - "\n" - "[group2][sub]\n" - "key=value\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group2]\n" - "valid=bar\n" - ; - - QTest::newRow("delete-group2") - << - "File=testrc\n" - "Group=group\n" - "Script=test.sh,sh\n" - << - "echo '# DELETEGROUP'\n" - << - "[group]\n" - "key=value\n" - "\n" - "[group2]\n" - "valid=bar\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group2]\n" - "valid=bar\n" - ; - - QTest::newRow("new-key") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '[group]'\n" - "echo 'new=value'\n" - << - "[group]\n" - "valid=bar\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "new=value\n" - "valid=bar\n" - ; - - QTest::newRow("modify-key-no-overwrite") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '[group]'\n" - "echo 'existing=new'\n" - << - "[group]\n" - "existing=old\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "existing=old\n" - ; - - QTest::newRow("modify-key-overwrite") - << - "File=testrc\n" - "Options=overwrite\n" - "Script=test.sh,sh\n" - << - "echo '[group]'\n" - "echo 'existing=new'\n" - << - "[group]\n" - "existing=old\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "existing=new\n" - ; - - QTest::newRow("new-key-in-subgroup") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '[group][sub]'\n" - "echo 'new=value2'\n" - << - "[group][sub]\n" - "existing=foo\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group][sub]\n" - "existing=foo\n" - "new=value2\n" - ; - - QTest::newRow("new-key-in-subgroup2") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '[group][sub]'\n" - "echo 'new=value3'\n" - << - "[group][sub]\n" - "existing=foo\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group][sub]\n" - "existing=foo\n" - "new=value3\n" - ; - - QTest::newRow("filter") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '# DELETE [group]changed'\n" - "sed s/value/VALUE/\n" - << - "[group]\n" - "changed=value\n" - "unchanged=value\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "changed=VALUE\n" - "unchanged=value\n" - ; - - QTest::newRow("filter-subgroup") - << - "File=testrc\n" - "Script=test.sh,sh\n" - << - "echo '# DELETE [group][sub]changed'\n" - "sed s/value/VALUE/\n" - << - "[group]\n" - "unchanged=value\n" - "\n" - "[group][sub]\n" - "changed=value\n" - "unchanged=value\n" - << - "[$Version]\n" - "update_info=%1\n" - "\n" - "[group]\n" - "unchanged=value\n" - "\n" - "[group][sub]\n" - "changed=VALUE\n" - "unchanged=value\n" - ; -} - -void TestKConfUpdate::testScript() -{ - QFETCH(QString, updContent); - QFETCH(QString, updScript); - QFETCH(QString, oldConfContent); - QFETCH(QString, expectedNewConfContent); - - // Prepend the Id= field to the upd content - updContent = QString("Id=%1\n").arg(QTest::currentDataTag()) + updContent; - - QSharedPointer<QTemporaryFile> updFile(writeUpdFile(updContent)); - - const QString scriptDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/kconf_update"; - QVERIFY(QDir().mkpath(scriptDir)); - QString scriptPath = scriptDir + "/test.sh"; - writeFile(scriptPath, updScript); - - QString confPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + "testrc"; - writeFile(confPath, oldConfContent); - - runKConfUpdate(updFile->fileName()); - - QString updateInfo = QString("%1:%2") - .arg(updFile->fileName().section('/', -1)) - .arg(QTest::currentDataTag()); - QString newConfContent = readFile(confPath); - expectedNewConfContent = expectedNewConfContent.arg(updateInfo); - QCOMPARE(newConfContent, expectedNewConfContent); -} - diff --git a/tier1/kconfig/autotests/test_kconf_update.h b/tier1/kconfig/autotests/test_kconf_update.h deleted file mode 100644 index 1b3151f1..00000000 --- a/tier1/kconfig/autotests/test_kconf_update.h +++ /dev/null @@ -1,36 +0,0 @@ -/* This file is part of the KDE libraries - Copyright 2010 Canonical Ltd - Author: Aurélien Gâteau <aurelien.gateau@canonical.com> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License (LGPL) as published by the Free Software Foundation; - either version 2 of the License, or (at your option) any later - version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TEST_KCONF_UPDATE_H -#define TEST_KCONF_UPDATE_H - -#include <QObject> - -class TestKConfUpdate : public QObject -{ - Q_OBJECT -private Q_SLOTS: - void test_data(); - void test(); - void testScript_data(); - void testScript(); -}; - -#endif /* TEST_KCONF_UPDATE_H */ diff --git a/tier1/kconfig/autotests/test_kconfigutils.cpp b/tier1/kconfig/autotests/test_kconfigutils.cpp deleted file mode 100644 index 176d771f..00000000 --- a/tier1/kconfig/autotests/test_kconfigutils.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* This file is part of the KDE libraries - Copyright 2010 Canonical Ltd - Author: Aurélien Gâteau <aurelien.gateau@canonical.com> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License (LGPL) as published by the Free Software Foundation; - either version 2 of the License, or (at your option) any later - version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#include "test_kconfigutils.h" - -#include <qdebug.h> -#include <qtest.h> - -// Local -#include "kconfigutils.h" - -// QT5 TODO QTEST_GUILESS_MAIN(TestKConfigUtils) -QTEST_MAIN(TestKConfigUtils) - -void TestKConfigUtils::testParseGroupString_data() -{ - QTest::addColumn<QString>("input"); - QTest::addColumn<QStringList>("expected"); - QTest::addColumn<bool>("expectedOk"); - - QTest::newRow("simple-group") - << " group " - << (QStringList() << "group") - << true - ; - - QTest::newRow("sub-group") - << "[group][sub]" - << (QStringList() << "group" << "sub") - << true - ; - - QTest::newRow("crazy-sub-group") - << "[a\\ttab\\x5d[and some hex esc\\x61pe]" - << (QStringList() << "a\ttab" << "and some hex escape") - << true - ; - - QTest::newRow("missing-closing-brace") - << "[group][sub" - << QStringList() - << false - ; -} - -void TestKConfigUtils::testParseGroupString() -{ - QFETCH(QString, input); - QFETCH(QStringList, expected); - QFETCH(bool, expectedOk); - - bool ok; - QString error; - QStringList output = KConfigUtils::parseGroupString(input, &ok, &error); - QCOMPARE(output, expected); - QCOMPARE(ok, expectedOk); - if (ok) { - QVERIFY(error.isEmpty()); - } else { - QVERIFY(!error.isEmpty()); - qDebug() << error; - } -} - -void TestKConfigUtils::testUnescapeString_data() -{ - QTest::addColumn<QString>("input"); - QTest::addColumn<QString>("expected"); - QTest::addColumn<bool>("expectedOk"); - - QTest::newRow("plain") - << "Some text" - << "Some text" - << true - ; - - QTest::newRow("single-char-escapes") - << "01\\s23\\t45\\n67\\r89\\\\" - << "01 23\t45\n67\r89\\" - << true - ; - - QTest::newRow("hex-escapes") - << "kd\\x65" - << "kde" - << true - ; - - QTest::newRow("unfinished-hex-escape") - << "kd\\x6" - << "" - << false - ; - - QTest::newRow("invalid-hex-escape") - << "kd\\xzz" - << "" - << false - ; - - QTest::newRow("invalid-escape-sequence") - << "Foo\\a" - << "" - << false - ; - - QTest::newRow("unfinished-escape-sequence") - << "Foo\\" - << "" - << false - ; -} - -void TestKConfigUtils::testUnescapeString() -{ - QFETCH(QString, input); - QFETCH(QString, expected); - QFETCH(bool, expectedOk); - - bool ok; - QString error; - QString output = KConfigUtils::unescapeString(input, &ok, &error); - QCOMPARE(output, expected); - QCOMPARE(ok, expectedOk); - if (ok) { - QVERIFY(error.isEmpty()); - } else { - QVERIFY(!error.isEmpty()); - qDebug() << error; - } -} - diff --git a/tier1/kconfig/autotests/test_kconfigutils.h b/tier1/kconfig/autotests/test_kconfigutils.h deleted file mode 100644 index 2b8c5762..00000000 --- a/tier1/kconfig/autotests/test_kconfigutils.h +++ /dev/null @@ -1,36 +0,0 @@ -/* This file is part of the KDE libraries - Copyright 2010 Canonical Ltd - Author: Aurélien Gâteau <aurelien.gateau@canonical.com> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License (LGPL) as published by the Free Software Foundation; - either version 2 of the License, or (at your option) any later - version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -#ifndef TEST_KCONFIGUTILS_H -#define TEST_KCONFIGUTILS_H - -#include <QObject> - -class TestKConfigUtils : public QObject -{ - Q_OBJECT -private Q_SLOTS: - void testParseGroupString_data(); - void testParseGroupString(); - void testUnescapeString_data(); - void testUnescapeString(); -}; - -#endif /* TEST_KCONFIGUTILS_H */ |