author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kdecore/kprefs.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | microkde/kdecore/kprefs.cpp | 16 |
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 | |||
@@ -8,32 +8,34 @@ | |||
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 | ||
32 | class KPrefsItemBool : public KPrefsItem { | 34 | class 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 *); |
@@ -127,43 +129,43 @@ class KPrefsItemStringList : public KPrefsItem { | |||
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 | ||
141 | class KPrefsItemIntList : public KPrefsItem { | 143 | class 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 | ||
157 | KPrefsItemBool::KPrefsItemBool(const QString &group,const QString &name, | 159 | KPrefsItemBool::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 | ||
165 | void KPrefsItemBool::setDefault() | 167 | void KPrefsItemBool::setDefault() |
166 | { | 168 | { |
167 | *mReference = mDefault; | 169 | *mReference = mDefault; |
168 | } | 170 | } |
169 | 171 | ||
@@ -351,33 +353,33 @@ void KPrefsItemStringList::setDefault() | |||
351 | } | 353 | } |
352 | 354 | ||
353 | void KPrefsItemStringList::writeConfig(KConfig *config) | 355 | void 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 | ||
359 | void KPrefsItemStringList::readConfig(KConfig *config) | 361 | void 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 | ||
366 | KPrefsItemIntList::KPrefsItemIntList(const QString &group,const QString &name, | 368 | KPrefsItemIntList::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 | ||
374 | void KPrefsItemIntList::setDefault() | 376 | void KPrefsItemIntList::setDefault() |
375 | { | 377 | { |
376 | *mReference = mDefault; | 378 | *mReference = mDefault; |
377 | } | 379 | } |
378 | 380 | ||
379 | void KPrefsItemIntList::writeConfig(KConfig *config) | 381 | void 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 | } |
@@ -492,21 +494,21 @@ void KPrefs::addItemSize(const QString &key,QSize *reference,const QSize &defaul | |||
492 | void KPrefs::addItemString(const QString &key,QString *reference,const QString &defaultValue) | 494 | void 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 | ||
497 | void KPrefs::addItemPassword(const QString &key,QString *reference,const QString &defaultValue) | 499 | void 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 | ||
502 | void KPrefs::addItemStringList(const QString &key,QStringList *reference, | 504 | void 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 | ||
508 | void KPrefs::addItemIntList(const QString &key,QValueList<int> *reference, | 510 | void 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 | } |