summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/kpimprefs.cpp4
-rw-r--r--microkde/kdecore/kprefs.cpp1
2 files changed, 2 insertions, 3 deletions
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index a05e65f..d68ccb6 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -1,84 +1,82 @@
/*
This file is part of libkdepim.
Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <kglobal.h>
#include <kconfig.h>
#include <klocale.h>
#include <kdebug.h>
#include "kpimprefs.h"
KPimPrefs::KPimPrefs( const QString &name ) :
KPrefs( name )
{
#ifdef _WIN32_
QString hdp= locateLocal("data","korganizer")+"\\\\";
#else
QString hdp= locateLocal("data","korganizer")+"/";
#endif
- config()->setGroup("SyncOptions");
+ setCurrentGroup("SyncOptions");
addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" );
addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" );
addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
addItemBool("PassiveSyncWithDesktop",&mPassiveSyncWithDesktop,false );
addItemBool("PassiveSyncAutoStart",&mPassiveSyncAutoStart,false );
addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
}
KPimPrefs::~KPimPrefs()
{
}
void KPimPrefs::usrSetDefaults()
{
setCategoryDefaults();
}
void KPimPrefs::usrReadConfig()
{
- kdDebug(5300) << "KPimPrefs::usrReadConfig()" << endl;
-
config()->setGroup("General");
mCustomCategories = config()->readListEntry("Custom Categories");
if (mCustomCategories.isEmpty()) setCategoryDefaults();
}
void KPimPrefs::usrWriteConfig()
{
config()->setGroup("General");
config()->writeEntry("Custom Categories",mCustomCategories);
}
void KPimPrefs::setCategoryDefaults()
{
// empty implementation
}
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
@@ -352,96 +352,97 @@ void KPrefsItemStringList::setDefault()
void KPrefsItemStringList::writeConfig(KConfig *config)
{
config->setGroup(mGroup);
config->writeEntry(mName,*mReference);
}
void KPrefsItemStringList::readConfig(KConfig *config)
{
config->setGroup(mGroup);
*mReference = config->readListEntry(mName);
}
KPrefsItemIntList::KPrefsItemIntList(const QString &group,const QString &name,
QValueList<int> *reference,const QValueList<int> &defaultValue) :
KPrefsItem(group,name)
{
mReference = reference;
mDefault = defaultValue;
}
void KPrefsItemIntList::setDefault()
{
*mReference = mDefault;
}
void KPrefsItemIntList::writeConfig(KConfig *config)
{
config->setGroup(mGroup);
config->writeEntry(mName,*mReference);
}
void KPrefsItemIntList::readConfig(KConfig *config)
{
config->setGroup(mGroup);
*mReference = config->readIntListEntry(mName);
}
QString *KPrefs::mCurrentGroup = 0;
KPrefs::KPrefs(const QString &configname)
{
if (!configname.isEmpty()) {
//qDebug("KPrefs::KPrefs %s",configname.latin1() );
mConfig = new KConfig(locateLocal("config",configname));
} else {
+ qDebug("KPrefs::Global config ");
mConfig = KGlobal::config();
}
mItems.setAutoDelete(true);
// Set default group
if (mCurrentGroup == 0) mCurrentGroup = new QString("No Group");
}
KPrefs::~KPrefs()
{
if (mConfig != KGlobal::config()) {
delete mConfig;
}
}
void KPrefs::setCurrentGroup(const QString &group)
{
if (mCurrentGroup) delete mCurrentGroup;
mCurrentGroup = new QString(group);
}
KConfig *KPrefs::config() const
{
return mConfig;
}
void KPrefs::setDefaults()
{
KPrefsItem *item;
for(item = mItems.first();item;item = mItems.next()) {
item->setDefault();
}
usrSetDefaults();
}
void KPrefs::readConfig()
{
KPrefsItem *item;
for(item = mItems.first();item;item = mItems.next()) {
item->readConfig(mConfig);
}
usrReadConfig();
//qDebug("KPrefs::readConfig: %s", mConfig->getFileName().latin1());
}