summaryrefslogtreecommitdiffabout
Unidiff
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
@@ -70,12 +70,27 @@ class KPrefsItemColor : public KPrefsItem {
70 70
71 private: 71 private:
72 QColor *mReference; 72 QColor *mReference;
73 QColor mDefault; 73 QColor mDefault;
74}; 74};
75 75
76class KPrefsItemSize : public KPrefsItem {
77 public:
78 KPrefsItemSize(const QString &group,const QString &name,QSize *,
79 const QSize &defaultValue=QSize());
80 ~KPrefsItemSize() {}
81
82 void setDefault();
83 void readConfig(KConfig *);
84 void writeConfig(KConfig *);
85
86 private:
87 QSize *mReference;
88 QSize mDefault;
89};
90
76 91
77class KPrefsItemFont : public KPrefsItem { 92class KPrefsItemFont : public KPrefsItem {
78 public: 93 public:
79 KPrefsItemFont(const QString &group,const QString &name,QFont *, 94 KPrefsItemFont(const QString &group,const QString &name,QFont *,
80 const QFont &defaultValue=QFont("helvetica",12)); 95 const QFont &defaultValue=QFont("helvetica",12));
81 virtual ~KPrefsItemFont() {} 96 virtual ~KPrefsItemFont() {}
@@ -216,12 +231,39 @@ void KPrefsItemColor::readConfig(KConfig *config)
216 config->setGroup(mGroup); 231 config->setGroup(mGroup);
217 *mReference = config->readColorEntry(mName,&mDefault); 232 *mReference = config->readColorEntry(mName,&mDefault);
218 233
219} 234}
220 235
221 236
237KPrefsItemSize::KPrefsItemSize(const QString &group,const QString &name,
238 QSize *reference,const QSize &defaultValue) :
239 KPrefsItem(group,name)
240{
241 mReference = reference;
242 mDefault = defaultValue;
243}
244
245void KPrefsItemSize::setDefault()
246{
247 *mReference = mDefault;
248}
249
250void KPrefsItemSize::writeConfig(KConfig *config)
251{
252 config->setGroup(mGroup);
253 config->writeEntry(mName,*mReference);
254}
255
256void KPrefsItemSize::readConfig(KConfig *config)
257{
258 config->setGroup(mGroup);
259 *mReference = config->readSizeEntry(mName,&mDefault);
260
261}
262
263
222KPrefsItemFont::KPrefsItemFont(const QString &group,const QString &name, 264KPrefsItemFont::KPrefsItemFont(const QString &group,const QString &name,
223 QFont *reference,const QFont &defaultValue) : 265 QFont *reference,const QFont &defaultValue) :
224 KPrefsItem(group,name) 266 KPrefsItem(group,name)
225{ 267{
226 mReference = reference; 268 mReference = reference;
227 mDefault = defaultValue; 269 mDefault = defaultValue;
@@ -397,23 +439,24 @@ void KPrefs::readConfig()
397 KPrefsItem *item; 439 KPrefsItem *item;
398 for(item = mItems.first();item;item = mItems.next()) { 440 for(item = mItems.first();item;item = mItems.next()) {
399 item->readConfig(mConfig); 441 item->readConfig(mConfig);
400 } 442 }
401 443
402 usrReadConfig(); 444 usrReadConfig();
445 //qDebug("KPrefs::readConfig: %s", mConfig->getFileName().latin1());
403} 446}
404 447
405void KPrefs::writeConfig() 448void KPrefs::writeConfig()
406{ 449{
407 KPrefsItem *item; 450 KPrefsItem *item;
408 for(item = mItems.first();item;item = mItems.next()) { 451 for(item = mItems.first();item;item = mItems.next()) {
409 item->writeConfig(mConfig); 452 item->writeConfig(mConfig);
410 } 453 }
411 454
412 usrWriteConfig(); 455 usrWriteConfig();
413 456 //qDebug("KPrefs::WriteConfig: %s", mConfig->getFileName().latin1());
414 mConfig->sync(); 457 mConfig->sync();
415} 458}
416 459
417 460
418void KPrefs::addItem(KPrefsItem *item) 461void KPrefs::addItem(KPrefsItem *item)
419{ 462{
@@ -437,12 +480,17 @@ void KPrefs::addItemColor(const QString &key,QColor *reference,const QColor &def
437 480
438void KPrefs::addItemFont(const QString &key,QFont *reference,const QFont &defaultValue) 481void KPrefs::addItemFont(const QString &key,QFont *reference,const QFont &defaultValue)
439{ 482{
440 addItem(new KPrefsItemFont(*mCurrentGroup,key,reference,defaultValue)); 483 addItem(new KPrefsItemFont(*mCurrentGroup,key,reference,defaultValue));
441} 484}
442 485
486void KPrefs::addItemSize(const QString &key,QSize *reference,const QSize &defaultValue)
487{
488 addItem(new KPrefsItemSize(*mCurrentGroup,key,reference,defaultValue));
489}
490
443void KPrefs::addItemString(const QString &key,QString *reference,const QString &defaultValue) 491void KPrefs::addItemString(const QString &key,QString *reference,const QString &defaultValue)
444{ 492{
445 addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,false)); 493 addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,false));
446} 494}
447 495
448void KPrefs::addItemPassword(const QString &key,QString *reference,const QString &defaultValue) 496void KPrefs::addItemPassword(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
@@ -21,12 +21,13 @@
21#define _KPREFS_H 21#define _KPREFS_H
22// $Id$ 22// $Id$
23 23
24#include <qptrlist.h> 24#include <qptrlist.h>
25#include <qcolor.h> 25#include <qcolor.h>
26#include <qfont.h> 26#include <qfont.h>
27#include <qsize.h>
27#include <qstringlist.h> 28#include <qstringlist.h>
28 29
29class KConfig; 30class KConfig;
30 31
31/** 32/**
32 @short Class for storing a preferences setting 33 @short Class for storing a preferences setting
@@ -204,12 +205,26 @@ class KPrefs {
204 @param defaultValue Default value, which is used by setDefaults() and 205 @param defaultValue Default value, which is used by setDefaults() and
205 when the config file does not yet contain the key of 206 when the config file does not yet contain the key of
206 this item. 207 this item.
207 */ 208 */
208 void addItemColor(const QString &key,QColor *reference, 209 void addItemColor(const QString &key,QColor *reference,
209 const QColor &defaultValue=QColor(128,128,128)); 210 const QColor &defaultValue=QColor(128,128,128));
211
212 /**
213 Register an item of type QSize.
214
215 @param key Key used in config file.
216 @param reference Pointer to the variable, which is set by readConfig()
217 and setDefaults() calls and read by writeConfig() calls.
218 @param defaultValue Default value, which is used by setDefaults() and
219 when the config file does not yet contain the key of
220 this item.
221 */
222 void addItemSize(const QString &key,QSize *reference,
223 const QSize &defaultValue=QSize());
224
210 /** 225 /**
211 Register an item of type QFont. 226 Register an item of type QFont.
212 227
213 @param key Key used in config file. 228 @param key Key used in config file.
214 @param reference Pointer to the variable, which is set by readConfig() 229 @param reference Pointer to the variable, which is set by readConfig()
215 and setDefaults() calls and read by writeConfig() calls. 230 and setDefaults() calls and read by writeConfig() calls.
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
@@ -64,13 +64,13 @@ KCMultiDialog::~KCMultiDialog()
64//US moduleDict.setAutoDelete(true); 64//US moduleDict.setAutoDelete(true);
65} 65}
66 66
67void KCMultiDialog::slotDefault() 67void KCMultiDialog::slotDefault()
68{ 68{
69 69
70 int curPageIndex = mMainWidget->activePageIndex(); 70 int curPageIndex = activePageIndex();
71 71
72 QPtrListIterator<KCModule> it(modules); 72 QPtrListIterator<KCModule> it(modules);
73 for (; it.current(); ++it) 73 for (; it.current(); ++it)
74 { 74 {
75 if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex) 75 if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex)
76 { 76 {
@@ -204,6 +204,24 @@ void KCMultiDialog::slotAboutToShow(QWidget *page)
204 204
205 QApplication::restoreOverrideCursor(); 205 QApplication::restoreOverrideCursor();
206*/ 206*/
207 207
208qDebug("KCMultiDialog::slotAboutToShow not implemented"); 208qDebug("KCMultiDialog::slotAboutToShow not implemented");
209} 209}
210
211
212bool KCMultiDialog::showPage( int index )
213{
214 return(mMainWidget->showPage(index) );
215}
216
217
218int KCMultiDialog::activePageIndex() const
219{
220 return( mMainWidget->activePageIndex() );
221}
222
223
224int KCMultiDialog::pageIndex( QWidget *widget ) const
225{
226 return( mMainWidget->pageIndex( widget) );
227}
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
@@ -70,17 +70,20 @@ public:
70 * @param withfallback Try harder to load the module. Might result 70 * @param withfallback Try harder to load the module. Might result
71 * in the module appearing outside the dialog. 71 * in the module appearing outside the dialog.
72 **/ 72 **/
73//US void addModule(const QString& module, bool withfallback=true); 73//US void addModule(const QString& module, bool withfallback=true);
74 74
75 75
76//US special method for microkde. We dop noty want to load everything dynamically. 76//US special method for microkde. We do not want to load everything dynamically.
77 void addModule(KCModule* module );//, const QString& modulename, const QString& iconname); 77 void addModule(KCModule* module );//, const QString& modulename, const QString& iconname);
78 QVBox* getNewVBoxPage(const QString & modulename) ; 78 QVBox* getNewVBoxPage(const QString & modulename) ;
79 79
80 80
81 bool showPage( int index );
82 int activePageIndex() const;
83 int pageIndex( QWidget *widget ) const;
81 84
82protected slots: 85protected slots:
83 /** 86 /**
84 * This slot is called when the user presses the "Default" Button 87 * This slot is called when the user presses the "Default" Button
85 * You can reimplement it if needed. 88 * You can reimplement it if needed.
86 * 89 *