summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabprefs.cpp
authorzautrix <zautrix>2004-06-26 19:01:18 (UTC)
committer zautrix <zautrix>2004-06-26 19:01:18 (UTC)
commitb9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff)
tree2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /kaddressbook/kabprefs.cpp
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'kaddressbook/kabprefs.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabprefs.cpp127
1 files changed, 127 insertions, 0 deletions
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
new file mode 100644
index 0000000..5b3b1ab
--- a/dev/null
+++ b/kaddressbook/kabprefs.cpp
@@ -0,0 +1,127 @@
1/*
2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
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
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23
24//US#ifdef KAB_EMBEDDED
25//#include <qstring.h>
26//#endif //KAB_EMBEDDED
27
28
29#include <kconfig.h>
30#include <klocale.h>
31#include <kstaticdeleter.h>
32//US#include <kdebug.h> // defines kdDebug()
33
34#include "kabprefs.h"
35
36KABPrefs *KABPrefs::sInstance = 0;
37static KStaticDeleter<KABPrefs> staticDeleter;
38
39KABPrefs::KABPrefs()
40 : KPimPrefs("kaddressbookrc")
41{
42 KPrefs::setCurrentGroup( "Views" );
43 addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
44
45 KPrefs::setCurrentGroup( "General" );
46 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true );
47 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 );
48
49#ifdef KAB_EMBEDDED
50 addItemBool("AskForQuit",&mAskForQuit,false);
51 addItemBool("ToolBarHor",&mToolBarHor, true );
52 addItemBool("ToolBarUp",&mToolBarUp, false );
53#endif //KAB_EMBEDDED
54
55 KPrefs::setCurrentGroup( "MainWindow" );
56 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false );
57 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true );
58 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter );
59 addItemIntList( "DetailsSplitter", &mDetailsSplitter );
60
61 KPrefs::setCurrentGroup( "Extensions_General" );
62 QStringList defaultExtensions;
63 defaultExtensions << "merge";
64 defaultExtensions << "distribution_list_editor";
65 addItemInt( "CurrentExtension", &mCurrentExtension, 0 );
66 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions );
67
68 KPrefs::setCurrentGroup( "Views" );
69 QString defaultView = i18n( "Default Table View" );
70 addItemString( "CurrentView", &mCurrentView, defaultView );
71 addItemStringList( "ViewNames", &mViewNames, defaultView );
72
73 KPrefs::setCurrentGroup( "Filters" );
74 addItemInt( "CurrentFilter", &mCurrentFilter, 0 );
75
76}
77
78KABPrefs::~KABPrefs()
79{
80}
81
82KABPrefs *KABPrefs::instance()
83{
84 if ( !sInstance ) {
85#ifdef KAB_EMBEDDED
86 sInstance = staticDeleter.setObject( new KABPrefs() );
87#else //KAB_EMBEDDED
88 //US the following line has changed ???. Why
89 staticDeleter.setObject( sInstance, new KABPrefs() );
90#endif //KAB_EMBEDDED
91 sInstance->readConfig();
92 }
93
94 return sInstance;
95}
96
97void KABPrefs::setCategoryDefaults()
98{
99 mCustomCategories.clear();
100
101 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
102 << i18n( "Customer" ) << i18n( "Friend" );
103}
104
105 // US introduce a nonconst way to return the config object.
106KConfig* KABPrefs::getConfig()
107{
108 return config();
109}
110
111
112/*US
113void KABPrefs::usrSetDefaults()
114{
115 KPimPrefs::usrSetDefaults();
116}
117
118void KABPrefs::usrReadConfig()
119{
120 KPimPrefs::usrReadConfig();
121}
122
123void KABPrefs::usrWriteConfig()
124{
125 KPimPrefs::usrWriteConfig();
126}
127*/