summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdecore/kprefs.cpp50
-rw-r--r--microkde/kdecore/kprefs.h15
-rw-r--r--microkde/kutils/kcmultidialog.cpp20
-rw-r--r--microkde/kutils/kcmultidialog.h5
4 files changed, 87 insertions, 3 deletions
diff --git a/microkde/kdecore/kprefs.cpp b/microkde/kdecore/kprefs.cpp
index f5e5e5a..71050e7 100644
--- a/microkde/kdecore/kprefs.cpp
+++ b/microkde/kdecore/kprefs.cpp
@@ -75,2 +75,17 @@ class KPrefsItemColor : public KPrefsItem {
+class KPrefsItemSize : public KPrefsItem {
+ public:
+ KPrefsItemSize(const QString &group,const QString &name,QSize *,
+ const QSize &defaultValue=QSize());
+ ~KPrefsItemSize() {}
+
+ void setDefault();
+ void readConfig(KConfig *);
+ void writeConfig(KConfig *);
+
+ private:
+ QSize *mReference;
+ QSize mDefault;
+};
+
@@ -221,2 +236,29 @@ void KPrefsItemColor::readConfig(KConfig *config)
+KPrefsItemSize::KPrefsItemSize(const QString &group,const QString &name,
+ QSize *reference,const QSize &defaultValue) :
+ KPrefsItem(group,name)
+{
+ mReference = reference;
+ mDefault = defaultValue;
+}
+
+void KPrefsItemSize::setDefault()
+{
+ *mReference = mDefault;
+}
+
+void KPrefsItemSize::writeConfig(KConfig *config)
+{
+ config->setGroup(mGroup);
+ config->writeEntry(mName,*mReference);
+}
+
+void KPrefsItemSize::readConfig(KConfig *config)
+{
+ config->setGroup(mGroup);
+ *mReference = config->readSizeEntry(mName,&mDefault);
+
+}
+
+
KPrefsItemFont::KPrefsItemFont(const QString &group,const QString &name,
@@ -402,2 +444,3 @@ void KPrefs::readConfig()
usrReadConfig();
+ //qDebug("KPrefs::readConfig: %s", mConfig->getFileName().latin1());
}
@@ -412,3 +455,3 @@ void KPrefs::writeConfig()
usrWriteConfig();
-
+ //qDebug("KPrefs::WriteConfig: %s", mConfig->getFileName().latin1());
mConfig->sync();
@@ -442,2 +485,7 @@ void KPrefs::addItemFont(const QString &key,QFont *reference,const QFont &defaul
+void KPrefs::addItemSize(const QString &key,QSize *reference,const QSize &defaultValue)
+{
+ addItem(new KPrefsItemSize(*mCurrentGroup,key,reference,defaultValue));
+}
+
void KPrefs::addItemString(const QString &key,QString *reference,const QString &defaultValue)
diff --git a/microkde/kdecore/kprefs.h b/microkde/kdecore/kprefs.h
index 7014bb8..95d2724 100644
--- a/microkde/kdecore/kprefs.h
+++ b/microkde/kdecore/kprefs.h
@@ -26,2 +26,3 @@
#include <qfont.h>
+#include <qsize.h>
#include <qstringlist.h>
@@ -209,2 +210,16 @@ class KPrefs {
const QColor &defaultValue=QColor(128,128,128));
+
+ /**
+ Register an item of type QSize.
+
+ @param key Key used in config file.
+ @param reference Pointer to the variable, which is set by readConfig()
+ and setDefaults() calls and read by writeConfig() calls.
+ @param defaultValue Default value, which is used by setDefaults() and
+ when the config file does not yet contain the key of
+ this item.
+ */
+ void addItemSize(const QString &key,QSize *reference,
+ const QSize &defaultValue=QSize());
+
/**
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp
index e7aa9d1..c4ccede 100644
--- a/microkde/kutils/kcmultidialog.cpp
+++ b/microkde/kutils/kcmultidialog.cpp
@@ -69,3 +69,3 @@ void KCMultiDialog::slotDefault()
- int curPageIndex = mMainWidget->activePageIndex();
+ int curPageIndex = activePageIndex();
@@ -209 +209,19 @@ qDebug("KCMultiDialog::slotAboutToShow not implemented");
}
+
+
+bool KCMultiDialog::showPage( int index )
+{
+ return(mMainWidget->showPage(index) );
+}
+
+
+int KCMultiDialog::activePageIndex() const
+{
+ return( mMainWidget->activePageIndex() );
+}
+
+
+int KCMultiDialog::pageIndex( QWidget *widget ) const
+{
+ return( mMainWidget->pageIndex( widget) );
+}
diff --git a/microkde/kutils/kcmultidialog.h b/microkde/kutils/kcmultidialog.h
index 768faea..66412ac 100644
--- a/microkde/kutils/kcmultidialog.h
+++ b/microkde/kutils/kcmultidialog.h
@@ -75,3 +75,3 @@ public:
-//US special method for microkde. We dop noty want to load everything dynamically.
+//US special method for microkde. We do not want to load everything dynamically.
void addModule(KCModule* module );//, const QString& modulename, const QString& iconname);
@@ -80,2 +80,5 @@ public:
+ bool showPage( int index );
+ int activePageIndex() const;
+ int pageIndex( QWidget *widget ) const;