Commit 077f57aa authored by Cornelius Schumacher's avatar Cornelius Schumacher
Browse files

Use kcfg.

svn path=/trunk/kdepim/; revision=257455
parent 123b72ec
......@@ -4,7 +4,7 @@ INCLUDES = -I$(top_srcdir)/libkdepim -I$(top_srcdir)/kontact/interfaces \
lib_LTLIBRARIES = libkontact.la
libkontact_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -version-info 1:0
libkontact_la_LIBADD = $(LIB_KDECORE)
libkontact_la_SOURCES = prefs.cpp
libkontact_la_SOURCES = prefs.kcfgc
bin_PROGRAMS = kontact
......
/*
This file is part of KDE Kontact.
Copyright (c) 2003 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.
*/
#include <kconfig.h>
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
#include <kstaticdeleter.h>
#include "prefs.h"
using namespace Kontact;
Prefs *Prefs::mInstance = 0;
static KStaticDeleter<Prefs> insd;
Prefs::Prefs()
: KConfigSkeleton( "kontactrc" )
{
KConfigSkeleton::setCurrentGroup( "View" );
QStringList values;
values.append( "SidePaneBars" );
values.append( "SidePaneIcons" );
mSidePaneTypeItem =
new KConfigSkeleton::ItemEnum( KConfigSkeleton::currentGroup(),
"SidePaneType", mSidePaneType,
values, SidePaneIcons );
addItem( "", mSidePaneTypeItem );
mSidePaneTypeItem->setLabel( i18n( "Side Pane Type" ) );
addItemString( "", "ActivePlugin", mActivePlugin, "summary" );
addItemIntList( "", "SidePaneSplitter", mSidePaneSplitter );
}
Prefs::~Prefs()
{
if ( mInstance == this )
mInstance = insd.setObject( 0 );
}
Prefs *Prefs::self()
{
if ( !mInstance ) {
mInstance = insd.setObject( new Prefs() );
mInstance->readConfig();
}
return mInstance;
}
/*
This file is part of KDE Kontact.
Copyright (c) 2003 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.
*/
#ifndef KONTACT_PREFS_H
#define KONTACT_PREFS_H
#include <kconfigskeleton.h>
namespace Kontact {
class Prefs : public KConfigSkeleton
{
public:
enum { SidePaneBars, SidePaneIcons };
virtual ~Prefs();
/**
Get instance of Prefs. It is made sure that there is only one
instance (singleton design pattern).
*/
static Prefs *self();
private:
/**
Constructor disabled for public. Use self() to create a Prefs
object.
*/
Prefs();
static Prefs *mInstance;
public:
// preferences data
int mSidePaneType;
QString mActivePlugin;
QValueList<int> mSidePaneSplitter;
KConfigSkeleton::ItemEnum *sidePaneTypeItem() { return mSidePaneTypeItem; }
private:
KConfigSkeleton::ItemEnum *mSidePaneTypeItem;
};
}
#endif
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd">
<kcfg>
<kcfgfile name="kontactrc"/>
<group name="View">
<entry type="String" name="ActivePlugin">
<default>summary</default>
</entry>
<entry type="IntList" name="SidePaneSplitter">
</entry>
<entry type="Enum" name="SidePaneType">
<label>Side Pane Type</label>
<values>
<value>SidePaneBars</value>
<value>SidePaneIcons</value>
</values>
<default>SidePaneIcons</default>
</entry>
</group>
</kcfg>
# Code generation options for kconfig_compiler
File=prefs.kcfg
NameSpace=Kontact
ClassName=Prefs
Singleton=true
Mutators=true
#Inherits=KPimPrefs
#IncludeFiles=libkdepim/kpimprefs.h
MemberVariables=public
GlobalEnums=true
ItemAccessors=true
SetUserTexts=true
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment