author | zautrix <zautrix> | 2005-02-03 02:19:50 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-03 02:19:50 (UTC) |
commit | e0fce8c0f108e054cb6e4e4767affd04b398da45 (patch) (unidiff) | |
tree | 17414f89b5042809bab5b738dfcc37b4375b3b6d | |
parent | 7e3c508b7ee613c534c2bf0cacf38f96efaef613 (diff) | |
download | kdepimpi-e0fce8c0f108e054cb6e4e4767affd04b398da45.zip kdepimpi-e0fce8c0f108e054cb6e4e4767affd04b398da45.tar.gz kdepimpi-e0fce8c0f108e054cb6e4e4767affd04b398da45.tar.bz2 |
fixxx
-rw-r--r-- | libkdepim/kpimprefs.cpp | 6 | ||||
-rw-r--r-- | microkde/kdecore/kprefs.cpp | 1 |
2 files changed, 3 insertions, 4 deletions
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp index a05e65f..d68ccb6 100644 --- a/libkdepim/kpimprefs.cpp +++ b/libkdepim/kpimprefs.cpp | |||
@@ -14,71 +14,69 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kconfig.h> | 32 | #include <kconfig.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | 35 | ||
36 | #include "kpimprefs.h" | 36 | #include "kpimprefs.h" |
37 | 37 | ||
38 | KPimPrefs::KPimPrefs( const QString &name ) : | 38 | KPimPrefs::KPimPrefs( const QString &name ) : |
39 | KPrefs( name ) | 39 | KPrefs( name ) |
40 | { | 40 | { |
41 | #ifdef _WIN32_ | 41 | #ifdef _WIN32_ |
42 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 42 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
43 | #else | 43 | #else |
44 | QString hdp= locateLocal("data","korganizer")+"/"; | 44 | QString hdp= locateLocal("data","korganizer")+"/"; |
45 | #endif | 45 | #endif |
46 | config()->setGroup("SyncOptions"); | 46 | setCurrentGroup("SyncOptions"); |
47 | addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); | 47 | addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); |
48 | addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); | 48 | addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); |
49 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); | 49 | addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); |
50 | addItemBool("PassiveSyncWithDesktop",&mPassiveSyncWithDesktop,false ); | 50 | addItemBool("PassiveSyncWithDesktop",&mPassiveSyncWithDesktop,false ); |
51 | addItemBool("PassiveSyncAutoStart",&mPassiveSyncAutoStart,false ); | 51 | addItemBool("PassiveSyncAutoStart",&mPassiveSyncAutoStart,false ); |
52 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); | 52 | addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); |
53 | } | 53 | } |
54 | 54 | ||
55 | KPimPrefs::~KPimPrefs() | 55 | KPimPrefs::~KPimPrefs() |
56 | { | 56 | { |
57 | } | 57 | } |
58 | 58 | ||
59 | void KPimPrefs::usrSetDefaults() | 59 | void KPimPrefs::usrSetDefaults() |
60 | { | 60 | { |
61 | setCategoryDefaults(); | 61 | setCategoryDefaults(); |
62 | } | 62 | } |
63 | 63 | ||
64 | void KPimPrefs::usrReadConfig() | 64 | void KPimPrefs::usrReadConfig() |
65 | { | 65 | { |
66 | kdDebug(5300) << "KPimPrefs::usrReadConfig()" << endl; | 66 | config()->setGroup("General"); |
67 | |||
68 | config()->setGroup("General"); | ||
69 | mCustomCategories = config()->readListEntry("Custom Categories"); | 67 | mCustomCategories = config()->readListEntry("Custom Categories"); |
70 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 68 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
71 | } | 69 | } |
72 | 70 | ||
73 | 71 | ||
74 | void KPimPrefs::usrWriteConfig() | 72 | void KPimPrefs::usrWriteConfig() |
75 | { | 73 | { |
76 | config()->setGroup("General"); | 74 | config()->setGroup("General"); |
77 | config()->writeEntry("Custom Categories",mCustomCategories); | 75 | config()->writeEntry("Custom Categories",mCustomCategories); |
78 | } | 76 | } |
79 | 77 | ||
80 | void KPimPrefs::setCategoryDefaults() | 78 | void KPimPrefs::setCategoryDefaults() |
81 | { | 79 | { |
82 | // empty implementation | 80 | // empty implementation |
83 | } | 81 | } |
84 | 82 | ||
diff --git a/microkde/kdecore/kprefs.cpp b/microkde/kdecore/kprefs.cpp index 71050e7..0220a34 100644 --- a/microkde/kdecore/kprefs.cpp +++ b/microkde/kdecore/kprefs.cpp | |||
@@ -368,64 +368,65 @@ KPrefsItemIntList::KPrefsItemIntList(const QString &group,const QString &name, | |||
368 | KPrefsItem(group,name) | 368 | KPrefsItem(group,name) |
369 | { | 369 | { |
370 | mReference = reference; | 370 | mReference = reference; |
371 | mDefault = defaultValue; | 371 | mDefault = defaultValue; |
372 | } | 372 | } |
373 | 373 | ||
374 | void KPrefsItemIntList::setDefault() | 374 | void KPrefsItemIntList::setDefault() |
375 | { | 375 | { |
376 | *mReference = mDefault; | 376 | *mReference = mDefault; |
377 | } | 377 | } |
378 | 378 | ||
379 | void KPrefsItemIntList::writeConfig(KConfig *config) | 379 | void KPrefsItemIntList::writeConfig(KConfig *config) |
380 | { | 380 | { |
381 | config->setGroup(mGroup); | 381 | config->setGroup(mGroup); |
382 | config->writeEntry(mName,*mReference); | 382 | config->writeEntry(mName,*mReference); |
383 | } | 383 | } |
384 | 384 | ||
385 | void KPrefsItemIntList::readConfig(KConfig *config) | 385 | void KPrefsItemIntList::readConfig(KConfig *config) |
386 | { | 386 | { |
387 | config->setGroup(mGroup); | 387 | config->setGroup(mGroup); |
388 | *mReference = config->readIntListEntry(mName); | 388 | *mReference = config->readIntListEntry(mName); |
389 | } | 389 | } |
390 | 390 | ||
391 | 391 | ||
392 | QString *KPrefs::mCurrentGroup = 0; | 392 | QString *KPrefs::mCurrentGroup = 0; |
393 | 393 | ||
394 | KPrefs::KPrefs(const QString &configname) | 394 | KPrefs::KPrefs(const QString &configname) |
395 | { | 395 | { |
396 | if (!configname.isEmpty()) { | 396 | if (!configname.isEmpty()) { |
397 | //qDebug("KPrefs::KPrefs %s",configname.latin1() ); | 397 | //qDebug("KPrefs::KPrefs %s",configname.latin1() ); |
398 | mConfig = new KConfig(locateLocal("config",configname)); | 398 | mConfig = new KConfig(locateLocal("config",configname)); |
399 | } else { | 399 | } else { |
400 | qDebug("KPrefs::Global config "); | ||
400 | mConfig = KGlobal::config(); | 401 | mConfig = KGlobal::config(); |
401 | } | 402 | } |
402 | 403 | ||
403 | mItems.setAutoDelete(true); | 404 | mItems.setAutoDelete(true); |
404 | 405 | ||
405 | // Set default group | 406 | // Set default group |
406 | if (mCurrentGroup == 0) mCurrentGroup = new QString("No Group"); | 407 | if (mCurrentGroup == 0) mCurrentGroup = new QString("No Group"); |
407 | } | 408 | } |
408 | 409 | ||
409 | KPrefs::~KPrefs() | 410 | KPrefs::~KPrefs() |
410 | { | 411 | { |
411 | if (mConfig != KGlobal::config()) { | 412 | if (mConfig != KGlobal::config()) { |
412 | delete mConfig; | 413 | delete mConfig; |
413 | } | 414 | } |
414 | } | 415 | } |
415 | 416 | ||
416 | void KPrefs::setCurrentGroup(const QString &group) | 417 | void KPrefs::setCurrentGroup(const QString &group) |
417 | { | 418 | { |
418 | if (mCurrentGroup) delete mCurrentGroup; | 419 | if (mCurrentGroup) delete mCurrentGroup; |
419 | mCurrentGroup = new QString(group); | 420 | mCurrentGroup = new QString(group); |
420 | } | 421 | } |
421 | 422 | ||
422 | KConfig *KPrefs::config() const | 423 | KConfig *KPrefs::config() const |
423 | { | 424 | { |
424 | return mConfig; | 425 | return mConfig; |
425 | } | 426 | } |
426 | 427 | ||
427 | void KPrefs::setDefaults() | 428 | void KPrefs::setDefaults() |
428 | { | 429 | { |
429 | KPrefsItem *item; | 430 | KPrefsItem *item; |
430 | for(item = mItems.first();item;item = mItems.next()) { | 431 | for(item = mItems.first();item;item = mItems.next()) { |
431 | item->setDefault(); | 432 | item->setDefault(); |