summaryrefslogtreecommitdiffabout
path: root/microkde/kdecore/kprefs.cpp
Unidiff
Diffstat (limited to 'microkde/kdecore/kprefs.cpp') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kdecore/kprefs.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/microkde/kdecore/kprefs.cpp b/microkde/kdecore/kprefs.cpp
index 0220a34..d4010fa 100644
--- a/microkde/kdecore/kprefs.cpp
+++ b/microkde/kdecore/kprefs.cpp
@@ -1,47 +1,49 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21// $Id$ 21// $Id$
22 22
23#include <qcolor.h> 23#include <qcolor.h>
24//Added by qt3to4:
25#include <Q3ValueList>
24 26
25#include <kconfig.h> 27#include <kconfig.h>
26#include <kstandarddirs.h> 28#include <kstandarddirs.h>
27#include <kglobal.h> 29#include <kglobal.h>
28#include <kdebug.h> 30#include <kdebug.h>
29 31
30#include "kprefs.h" 32#include "kprefs.h"
31 33
32class KPrefsItemBool : public KPrefsItem { 34class KPrefsItemBool : public KPrefsItem {
33 public: 35 public:
34 KPrefsItemBool(const QString &group,const QString &name,bool *,bool defaultValue=true); 36 KPrefsItemBool(const QString &group,const QString &name,bool *,bool defaultValue=true);
35 virtual ~KPrefsItemBool() {} 37 virtual ~KPrefsItemBool() {}
36 38
37 void setDefault(); 39 void setDefault();
38 void readConfig(KConfig *); 40 void readConfig(KConfig *);
39 void writeConfig(KConfig *); 41 void writeConfig(KConfig *);
40 42
41 private: 43 private:
42 bool *mReference; 44 bool *mReference;
43 bool mDefault; 45 bool mDefault;
44}; 46};
45 47
46class KPrefsItemInt : public KPrefsItem { 48class KPrefsItemInt : public KPrefsItem {
47 public: 49 public:
@@ -119,59 +121,59 @@ class KPrefsItemString : public KPrefsItem {
119 QString *mReference; 121 QString *mReference;
120 QString mDefault; 122 QString mDefault;
121 bool mPassword; 123 bool mPassword;
122}; 124};
123 125
124 126
125class KPrefsItemStringList : public KPrefsItem { 127class KPrefsItemStringList : public KPrefsItem {
126 public: 128 public:
127 KPrefsItemStringList(const QString &group,const QString &name,QStringList *, 129 KPrefsItemStringList(const QString &group,const QString &name,QStringList *,
128 const QStringList &defaultValue=QStringList()); 130 const QStringList &defaultValue=QStringList());
129 virtual ~KPrefsItemStringList() {} 131 virtual ~KPrefsItemStringList() {}
130 132
131 void setDefault(); 133 void setDefault();
132 void readConfig(KConfig *); 134 void readConfig(KConfig *);
133 void writeConfig(KConfig *); 135 void writeConfig(KConfig *);
134 136
135 private: 137 private:
136 QStringList *mReference; 138 QStringList *mReference;
137 QStringList mDefault; 139 QStringList mDefault;
138}; 140};
139 141
140 142
141class KPrefsItemIntList : public KPrefsItem { 143class KPrefsItemIntList : public KPrefsItem {
142 public: 144 public:
143 KPrefsItemIntList(const QString &group,const QString &name,QValueList<int> *, 145 KPrefsItemIntList(const QString &group,const QString &name,Q3ValueList<int> *,
144 const QValueList<int> &defaultValue=QValueList<int>()); 146 const Q3ValueList<int> &defaultValue=Q3ValueList<int>());
145 virtual ~KPrefsItemIntList() {} 147 virtual ~KPrefsItemIntList() {}
146 148
147 void setDefault(); 149 void setDefault();
148 void readConfig(KConfig *); 150 void readConfig(KConfig *);
149 void writeConfig(KConfig *); 151 void writeConfig(KConfig *);
150 152
151 private: 153 private:
152 QValueList<int> *mReference; 154 Q3ValueList<int> *mReference;
153 QValueList<int> mDefault; 155 Q3ValueList<int> mDefault;
154}; 156};
155 157
156 158
157KPrefsItemBool::KPrefsItemBool(const QString &group,const QString &name, 159KPrefsItemBool::KPrefsItemBool(const QString &group,const QString &name,
158 bool *reference,bool defaultValue) : 160 bool *reference,bool defaultValue) :
159 KPrefsItem(group,name) 161 KPrefsItem(group,name)
160{ 162{
161 mReference = reference; 163 mReference = reference;
162 mDefault = defaultValue; 164 mDefault = defaultValue;
163} 165}
164 166
165void KPrefsItemBool::setDefault() 167void KPrefsItemBool::setDefault()
166{ 168{
167 *mReference = mDefault; 169 *mReference = mDefault;
168} 170}
169 171
170void KPrefsItemBool::writeConfig(KConfig *config) 172void KPrefsItemBool::writeConfig(KConfig *config)
171{ 173{
172 config->setGroup(mGroup); 174 config->setGroup(mGroup);
173 config->writeEntry(mName,*mReference); 175 config->writeEntry(mName,*mReference);
174} 176}
175 177
176 178
177void KPrefsItemBool::readConfig(KConfig *config) 179void KPrefsItemBool::readConfig(KConfig *config)
@@ -343,49 +345,49 @@ KPrefsItemStringList::KPrefsItemStringList(const QString &group,const QString &n
343{ 345{
344 mReference = reference; 346 mReference = reference;
345 mDefault = defaultValue; 347 mDefault = defaultValue;
346} 348}
347 349
348void KPrefsItemStringList::setDefault() 350void KPrefsItemStringList::setDefault()
349{ 351{
350 *mReference = mDefault; 352 *mReference = mDefault;
351} 353}
352 354
353void KPrefsItemStringList::writeConfig(KConfig *config) 355void KPrefsItemStringList::writeConfig(KConfig *config)
354{ 356{
355 config->setGroup(mGroup); 357 config->setGroup(mGroup);
356 config->writeEntry(mName,*mReference); 358 config->writeEntry(mName,*mReference);
357} 359}
358 360
359void KPrefsItemStringList::readConfig(KConfig *config) 361void KPrefsItemStringList::readConfig(KConfig *config)
360{ 362{
361 config->setGroup(mGroup); 363 config->setGroup(mGroup);
362 *mReference = config->readListEntry(mName); 364 *mReference = config->readListEntry(mName);
363} 365}
364 366
365 367
366KPrefsItemIntList::KPrefsItemIntList(const QString &group,const QString &name, 368KPrefsItemIntList::KPrefsItemIntList(const QString &group,const QString &name,
367 QValueList<int> *reference,const QValueList<int> &defaultValue) : 369 Q3ValueList<int> *reference,const Q3ValueList<int> &defaultValue) :
368 KPrefsItem(group,name) 370 KPrefsItem(group,name)
369{ 371{
370 mReference = reference; 372 mReference = reference;
371 mDefault = defaultValue; 373 mDefault = defaultValue;
372} 374}
373 375
374void KPrefsItemIntList::setDefault() 376void KPrefsItemIntList::setDefault()
375{ 377{
376 *mReference = mDefault; 378 *mReference = mDefault;
377} 379}
378 380
379void KPrefsItemIntList::writeConfig(KConfig *config) 381void KPrefsItemIntList::writeConfig(KConfig *config)
380{ 382{
381 config->setGroup(mGroup); 383 config->setGroup(mGroup);
382 config->writeEntry(mName,*mReference); 384 config->writeEntry(mName,*mReference);
383} 385}
384 386
385void KPrefsItemIntList::readConfig(KConfig *config) 387void KPrefsItemIntList::readConfig(KConfig *config)
386{ 388{
387 config->setGroup(mGroup); 389 config->setGroup(mGroup);
388 *mReference = config->readIntListEntry(mName); 390 *mReference = config->readIntListEntry(mName);
389} 391}
390 392
391 393
@@ -484,29 +486,29 @@ void KPrefs::addItemFont(const QString &key,QFont *reference,const QFont &defaul
484 addItem(new KPrefsItemFont(*mCurrentGroup,key,reference,defaultValue)); 486 addItem(new KPrefsItemFont(*mCurrentGroup,key,reference,defaultValue));
485} 487}
486 488
487void KPrefs::addItemSize(const QString &key,QSize *reference,const QSize &defaultValue) 489void KPrefs::addItemSize(const QString &key,QSize *reference,const QSize &defaultValue)
488{ 490{
489 addItem(new KPrefsItemSize(*mCurrentGroup,key,reference,defaultValue)); 491 addItem(new KPrefsItemSize(*mCurrentGroup,key,reference,defaultValue));
490} 492}
491 493
492void KPrefs::addItemString(const QString &key,QString *reference,const QString &defaultValue) 494void KPrefs::addItemString(const QString &key,QString *reference,const QString &defaultValue)
493{ 495{
494 addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,false)); 496 addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,false));
495} 497}
496 498
497void KPrefs::addItemPassword(const QString &key,QString *reference,const QString &defaultValue) 499void KPrefs::addItemPassword(const QString &key,QString *reference,const QString &defaultValue)
498{ 500{
499 addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,true)); 501 addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,true));
500} 502}
501 503
502void KPrefs::addItemStringList(const QString &key,QStringList *reference, 504void KPrefs::addItemStringList(const QString &key,QStringList *reference,
503 const QStringList &defaultValue) 505 const QStringList &defaultValue)
504{ 506{
505 addItem(new KPrefsItemStringList(*mCurrentGroup,key,reference,defaultValue)); 507 addItem(new KPrefsItemStringList(*mCurrentGroup,key,reference,defaultValue));
506} 508}
507 509
508void KPrefs::addItemIntList(const QString &key,QValueList<int> *reference, 510void KPrefs::addItemIntList(const QString &key,Q3ValueList<int> *reference,
509 const QValueList<int> &defaultValue) 511 const Q3ValueList<int> &defaultValue)
510{ 512{
511 addItem(new KPrefsItemIntList(*mCurrentGroup,key,reference,defaultValue)); 513 addItem(new KPrefsItemIntList(*mCurrentGroup,key,reference,defaultValue));
512} 514}