summaryrefslogtreecommitdiffstats
path: root/libkdepim/cfgc
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /libkdepim/cfgc
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkdepim/cfgc')
-rw-r--r--libkdepim/cfgc/Makefile.am14
-rw-r--r--libkdepim/cfgc/README6
-rw-r--r--libkdepim/cfgc/autoexample.cpp66
-rw-r--r--libkdepim/cfgc/example.cfg40
-rw-r--r--libkdepim/cfgc/example.cpp55
-rw-r--r--libkdepim/cfgc/exampleprefs_base.kcfg42
-rw-r--r--libkdepim/cfgc/exampleprefs_base.kcfgc11
-rw-r--r--libkdepim/cfgc/general_base.ui46
-rw-r--r--libkdepim/cfgc/myoptions_base.ui46
9 files changed, 326 insertions, 0 deletions
diff --git a/libkdepim/cfgc/Makefile.am b/libkdepim/cfgc/Makefile.am
new file mode 100644
index 000000000..2a3bb2727
--- /dev/null
+++ b/libkdepim/cfgc/Makefile.am
@@ -0,0 +1,14 @@
+AM_CPPFLAGS = -I$(top_builddir)/libkdepim -I$(top_srcdir) $(all_includes)
+
+check_PROGRAMS = example
+#autoexample
+
+example_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+example_LDADD = ../libkdepim.la $(LIB_KDECORE)
+example_SOURCES = example.cpp exampleprefs_base.kcfgc
+
+#autoexample_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+#autoexample_LDADD = ../libkdepim.la $(LIB_KDECORE)
+#autoexample_SOURCES = general_base.ui myoptions_base.ui autoexample.cpp
+
+METASOURCES = AUTO
diff --git a/libkdepim/cfgc/README b/libkdepim/cfgc/README
new file mode 100644
index 000000000..6a7783817
--- /dev/null
+++ b/libkdepim/cfgc/README
@@ -0,0 +1,6 @@
+This directory contains text and example code for automatic creation of
+configuration dialogs based on KConfigSkeleton, kconfig_compiler and
+KPrefsDialog.
+
+If you have questions or comments please contact Cornelius Schumacher
+<schumacher@kde.org>.
diff --git a/libkdepim/cfgc/autoexample.cpp b/libkdepim/cfgc/autoexample.cpp
new file mode 100644
index 000000000..52ab961f8
--- /dev/null
+++ b/libkdepim/cfgc/autoexample.cpp
@@ -0,0 +1,66 @@
+/*
+ This file is part of KDE.
+
+ Copyright (c) 2003 Cornelius Schumacher <schumacher@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 "general_base.h"
+#include "myoptions_base.h"
+
+#include <libkdepim/kprefsdialog.h>
+
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kcmdlineargs.h>
+#include <kglobal.h>
+#include <kconfig.h>
+#include <kstandarddirs.h>
+#include <kautoconfigdialog.h>
+
+#include <qlabel.h>
+
+int main( int argc, char **argv )
+{
+ KAboutData aboutData( "example", I18N_NOOP("autoconfig example"), "0.1" );
+ aboutData.addAuthor( "Cornelius Schumacher", 0, "schumacher@kde.org" );
+
+ KCmdLineArgs::init( argc, argv, &aboutData );
+
+ KApplication app;
+
+ // Create a new dialog with the same name as the above checking code.
+ KAutoConfigDialog *dialog = new KAutoConfigDialog(0, "settings");
+
+ // Add the general page. Store the settings in the General group and
+ // use the icon package_settings.
+ GeneralBase *general = new GeneralBase( 0 );
+ dialog->addPage( general, i18n("General"), "General", "" );
+
+ MyOptionsBase *myOptions = new MyOptionsBase( 0 );
+
+// myOptions->show();
+ dialog->addPage( myOptions, i18n("MyOptions"), "MyOptions", "" );
+
+// app.setMainWidget( dialog );
+
+ dialog->show();
+
+ return app.exec();
+}
diff --git a/libkdepim/cfgc/example.cfg b/libkdepim/cfgc/example.cfg
new file mode 100644
index 000000000..51071980f
--- /dev/null
+++ b/libkdepim/cfgc/example.cfg
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE cfg SYSTEM "cfg.dtd">
+<cfg>
+ <cfgfile name="examplerc"/>
+ <class name="ExamplePrefsBase" file="exampleprefs_base" singleton="true">
+ <include file="libkdepim/kpimprefs.h" />
+ </class>
+ <group name="General">
+ <entry type="bool">
+ <name>OneOption</name>
+ <label>One option</label>
+ <default>true</default>
+ </entry>
+ <entry type="int">
+ <key>Another Option</key>
+ <label>Another option</label>
+ <default>5</default>
+ </entry>
+ <entry type="int">
+ <values>
+ <value>One</value>
+ <value>Two</value>
+ <value>Three</value>
+ </values>
+ <name>ListOption</name>
+ <default>One</default>
+ </entry>
+ </group>
+ <group name="MyOptions">
+ <entry type="QString">
+ <name>MyString</name>
+ <label>This is a string</label>
+ <default>Default String</default>
+ </entry>
+ <entry type="QStringList">
+ <name>MyStringList</name>
+ <default>up,down</default>
+ </entry>
+ </group>
+</cfg>
diff --git a/libkdepim/cfgc/example.cpp b/libkdepim/cfgc/example.cpp
new file mode 100644
index 000000000..f2838f2cb
--- /dev/null
+++ b/libkdepim/cfgc/example.cpp
@@ -0,0 +1,55 @@
+/*
+ This file is part of KDE.
+
+ Copyright (c) 2003 Cornelius Schumacher <schumacher@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 "exampleprefs_base.h"
+
+#include <kaboutdata.h>
+#include <kapplication.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kcmdlineargs.h>
+#include <kglobal.h>
+#include <kconfig.h>
+#include <kstandarddirs.h>
+
+#include <libkdepim/kprefsdialog.h>
+
+int main( int argc, char **argv )
+{
+ KAboutData aboutData( "example", I18N_NOOP("cfgc example"), "0.1" );
+ aboutData.addAuthor( "Cornelius Schumacher", 0, "schumacher@kde.org" );
+
+ KCmdLineArgs::init( argc, argv, &aboutData );
+
+ KApplication app;
+
+ ExamplePrefsBase *prefs = ExamplePrefsBase::self();
+
+ KPrefsDialog *dialog = new KPrefsDialog( prefs );
+
+ dialog->autoCreate();
+
+ app.setMainWidget( dialog );
+
+ dialog->show();
+
+ return app.exec();
+}
diff --git a/libkdepim/cfgc/exampleprefs_base.kcfg b/libkdepim/cfgc/exampleprefs_base.kcfg
new file mode 100644
index 000000000..e197ae7cd
--- /dev/null
+++ b/libkdepim/cfgc/exampleprefs_base.kcfg
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+ <kcfgfile name="examplerc"/>
+ <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">
+ <label>One</label>
+ </choice>
+ <choice name="Two">
+ <label>Two</label>
+ </choice>
+ <choice name="Three">
+ <label>Three</label>
+ </choice>
+ </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="MyStringList" type="StringList">
+ <default>up,down</default>
+ </entry>
+ </group>
+</kcfg>
diff --git a/libkdepim/cfgc/exampleprefs_base.kcfgc b/libkdepim/cfgc/exampleprefs_base.kcfgc
new file mode 100644
index 000000000..9ee413c76
--- /dev/null
+++ b/libkdepim/cfgc/exampleprefs_base.kcfgc
@@ -0,0 +1,11 @@
+# Code generation options for kconfig_compiler
+File=exampleprefs_base.kcfg
+ClassName=ExamplePrefsBase
+Singleton=true
+Mutators=true
+Inherits=KPimPrefs
+IncludeFiles=libkdepim/kpimprefs.h
+MemberVariables=public
+GlobalEnums=true
+ItemAccessors=true
+SetUserTexts=true
diff --git a/libkdepim/cfgc/general_base.ui b/libkdepim/cfgc/general_base.ui
new file mode 100644
index 000000000..fda2fc235
--- /dev/null
+++ b/libkdepim/cfgc/general_base.ui
@@ -0,0 +1,46 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>GeneralBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>GeneralBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>AutoExampleDialog</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QCheckBox" row="0" column="1">
+ <property name="name">
+ <cstring>OneOption</cstring>
+ </property>
+ <property name="text">
+ <string>OneOption</string>
+ </property>
+ </widget>
+ <widget class="QSpinBox" row="1" column="1">
+ <property name="name">
+ <cstring>Another_Option</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>AnotherOption:</string>
+ </property>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>
diff --git a/libkdepim/cfgc/myoptions_base.ui b/libkdepim/cfgc/myoptions_base.ui
new file mode 100644
index 000000000..60207f9e3
--- /dev/null
+++ b/libkdepim/cfgc/myoptions_base.ui
@@ -0,0 +1,46 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>MyOptionsBase</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>MyOptionsBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>480</height>
+ </rect>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>180</y>
+ <width>70</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>MyString:</string>
+ </property>
+ </widget>
+ <widget class="QLineEdit">
+ <property name="name">
+ <cstring>MyString</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>130</x>
+ <y>180</y>
+ <width>123</width>
+ <height>22</height>
+ </rect>
+ </property>
+ </widget>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+</UI>