summaryrefslogtreecommitdiffabout
path: root/microkde
Side-by-side diff
Diffstat (limited to 'microkde') (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
@@ -68,16 +68,31 @@ class KPrefsItemColor : public KPrefsItem {
void readConfig(KConfig *);
void writeConfig(KConfig *);
private:
QColor *mReference;
QColor mDefault;
};
+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;
+};
+
class KPrefsItemFont : public KPrefsItem {
public:
KPrefsItemFont(const QString &group,const QString &name,QFont *,
const QFont &defaultValue=QFont("helvetica",12));
virtual ~KPrefsItemFont() {}
void setDefault();
@@ -214,16 +229,43 @@ void KPrefsItemColor::writeConfig(KConfig *config)
void KPrefsItemColor::readConfig(KConfig *config)
{
config->setGroup(mGroup);
*mReference = config->readColorEntry(mName,&mDefault);
}
+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,
QFont *reference,const QFont &defaultValue) :
KPrefsItem(group,name)
{
mReference = reference;
mDefault = defaultValue;
}
@@ -395,27 +437,28 @@ void KPrefs::setDefaults()
void KPrefs::readConfig()
{
KPrefsItem *item;
for(item = mItems.first();item;item = mItems.next()) {
item->readConfig(mConfig);
}
usrReadConfig();
+ //qDebug("KPrefs::readConfig: %s", mConfig->getFileName().latin1());
}
void KPrefs::writeConfig()
{
KPrefsItem *item;
for(item = mItems.first();item;item = mItems.next()) {
item->writeConfig(mConfig);
}
usrWriteConfig();
-
+ //qDebug("KPrefs::WriteConfig: %s", mConfig->getFileName().latin1());
mConfig->sync();
}
void KPrefs::addItem(KPrefsItem *item)
{
mItems.append(item);
}
@@ -435,16 +478,21 @@ void KPrefs::addItemColor(const QString &key,QColor *reference,const QColor &def
addItem(new KPrefsItemColor(*mCurrentGroup,key,reference,defaultValue));
}
void KPrefs::addItemFont(const QString &key,QFont *reference,const QFont &defaultValue)
{
addItem(new KPrefsItemFont(*mCurrentGroup,key,reference,defaultValue));
}
+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)
{
addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,false));
}
void KPrefs::addItemPassword(const QString &key,QString *reference,const QString &defaultValue)
{
addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,true));
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
@@ -19,16 +19,17 @@
*/
#ifndef _KPREFS_H
#define _KPREFS_H
// $Id$
#include <qptrlist.h>
#include <qcolor.h>
#include <qfont.h>
+#include <qsize.h>
#include <qstringlist.h>
class KConfig;
/**
@short Class for storing a preferences setting
@author Cornelius Schumacher
@see KPref
@@ -202,16 +203,30 @@ class KPrefs {
@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 addItemColor(const QString &key,QColor *reference,
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());
+
/**
Register an item of type QFont.
@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
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
@@ -62,17 +62,17 @@ KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const ch
KCMultiDialog::~KCMultiDialog()
{
//US moduleDict.setAutoDelete(true);
}
void KCMultiDialog::slotDefault()
{
- int curPageIndex = mMainWidget->activePageIndex();
+ int curPageIndex = activePageIndex();
QPtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
{
if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex)
{
(*it)->defaults();
clientChanged(true);
@@ -202,8 +202,26 @@ void KCMultiDialog::slotAboutToShow(QWidget *page)
delete loadInfo;
QApplication::restoreOverrideCursor();
*/
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
@@ -68,21 +68,24 @@ public:
* to the list of modules the dialog will show.
*
* @param withfallback Try harder to load the module. Might result
* in the module appearing outside the dialog.
**/
//US void addModule(const QString& module, bool withfallback=true);
-//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);
QVBox* getNewVBoxPage(const QString & modulename) ;
+ bool showPage( int index );
+ int activePageIndex() const;
+ int pageIndex( QWidget *widget ) const;
protected slots:
/**
* This slot is called when the user presses the "Default" Button
* You can reimplement it if needed.
*
* @note Make sure you call the original implementation!
**/