summaryrefslogtreecommitdiffabout
path: root/kaddressbook/kabprefs.cpp
Unidiff
Diffstat (limited to 'kaddressbook/kabprefs.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabprefs.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp
index b96d28a..ea254b7 100644
--- a/kaddressbook/kabprefs.cpp
+++ b/kaddressbook/kabprefs.cpp
@@ -1,154 +1,156 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 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 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 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program 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 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
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//US#ifdef KAB_EMBEDDED 24//US#ifdef KAB_EMBEDDED
25//#include <qstring.h> 25//#include <qstring.h>
26//#endif //KAB_EMBEDDED 26//#endif //KAB_EMBEDDED
27 27
28#include <qtextstream.h> 28#include <qtextstream.h>
29#include <qfile.h> 29#include <qfile.h>
30#include <qregexp.h> 30#include <qregexp.h>
31#include <stdlib.h> 31#include <stdlib.h>
32#include <libkdepim/kpimglobalprefs.h> 32#include <libkdepim/kpimglobalprefs.h>
33 33
34#include <kconfig.h> 34#include <kconfig.h>
35#include <klocale.h> 35#include <klocale.h>
36#include <kstaticdeleter.h> 36#include <kstaticdeleter.h>
37#include <kglobalsettings.h> 37#include <kglobalsettings.h>
38//US#include <kdebug.h> // defines kdDebug() 38//US#include <kdebug.h> // defines kdDebug()
39 39
40#include "kabprefs.h" 40#include "kabprefs.h"
41 41
42#ifdef DESKTOP_VERSION 42#ifdef DESKTOP_VERSION
43#include <qapplication.h> 43#include <qapplication.h>
44#endif 44#endif
45 45
46KABPrefs *KABPrefs::sInstance = 0; 46KABPrefs *KABPrefs::sInstance = 0;
47static KStaticDeleter<KABPrefs> staticDeleterAB; 47static KStaticDeleter<KABPrefs> staticDeleterAB;
48 48
49KABPrefs::KABPrefs() 49KABPrefs::KABPrefs()
50 : KPimPrefs("kaddressbookrc") 50 : KPimPrefs("kaddressbookrc")
51{ 51{
52 KPrefs::setCurrentGroup( "Views" ); 52 KPrefs::setCurrentGroup( "Views" );
53 addItemBool( "HonorSingleClick", &mHonorSingleClick, false ); 53 addItemBool( "HonorSingleClick", &mHonorSingleClick, false );
54 54
55 KPrefs::setCurrentGroup( "General" ); 55 KPrefs::setCurrentGroup( "General" );
56 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true ); 56 addItemBool( "AutomaticNameParsing", &mAutomaticNameParsing, true );
57 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 ); 57 addItemInt( "CurrentIncSearchField", &mCurrentIncSearchField, 0 );
58#ifdef KAB_EMBEDDED 58#ifdef KAB_EMBEDDED
59 addItemBool("AskForQuit",&mAskForQuit,true); 59 addItemBool("AskForQuit",&mAskForQuit,true);
60 addItemBool("ToolBarHor",&mToolBarHor, true ); 60 addItemBool("ToolBarHor",&mToolBarHor, true );
61 addItemBool("ToolBarUp",&mToolBarUp, false ); 61 addItemBool("ToolBarUp",&mToolBarUp, false );
62 addItemBool("SearchWithReturn",&mSearchWithReturn, false ); 62 addItemBool("SearchWithReturn",&mSearchWithReturn, false );
63 addItemBool("AutoSearchWithWildcard",&mAutoSearchWithWildcard, false );
64 addItemBool("HideSearchOnSwitch",&mHideSearchOnSwitch, false );
63 addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont()); 65 addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont());
64 66
65 67
66#endif //KAB_EMBEDDED 68#endif //KAB_EMBEDDED
67 69
68 KPrefs::setCurrentGroup( "MainWindow" ); 70 KPrefs::setCurrentGroup( "MainWindow" );
69 bool m_visible = false; 71 bool m_visible = false;
70#ifdef DESKTOP_VERSION 72#ifdef DESKTOP_VERSION
71 m_visible = true; 73 m_visible = true;
72#endif 74#endif
73 addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible ); 75 addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible );
74 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); 76 addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false );
75 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); 77 addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true );
76 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); 78 addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter );
77 addItemIntList( "DetailsSplitter", &mDetailsSplitter ); 79 addItemIntList( "DetailsSplitter", &mDetailsSplitter );
78 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); 80 addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true );
79 81
80 82
81 KPrefs::setCurrentGroup( "Extensions_General" ); 83 KPrefs::setCurrentGroup( "Extensions_General" );
82 QStringList defaultExtensions; 84 QStringList defaultExtensions;
83 defaultExtensions << "merge"; 85 defaultExtensions << "merge";
84 defaultExtensions << "distribution_list_editor"; 86 defaultExtensions << "distribution_list_editor";
85 addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); 87 addItemInt( "CurrentExtension", &mCurrentExtension, 0 );
86 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); 88 addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions );
87 89
88 KPrefs::setCurrentGroup( "Views" ); 90 KPrefs::setCurrentGroup( "Views" );
89 QString defaultView = i18n( "Default Table View" ); 91 QString defaultView = i18n( "Default Table View" );
90 addItemString( "CurrentView", &mCurrentView, defaultView ); 92 addItemString( "CurrentView", &mCurrentView, defaultView );
91 addItemStringList( "ViewNames", &mViewNames, defaultView ); 93 addItemStringList( "ViewNames", &mViewNames, defaultView );
92 94
93 KPrefs::setCurrentGroup( "Filters" ); 95 KPrefs::setCurrentGroup( "Filters" );
94 addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); 96 addItemInt( "CurrentFilter", &mCurrentFilter, 0 );
95 97
96} 98}
97 99
98KABPrefs::~KABPrefs() 100KABPrefs::~KABPrefs()
99{ 101{
100 //qDebug("KABPrefs::~KABPrefs() "); 102 //qDebug("KABPrefs::~KABPrefs() ");
101 if (sInstance == this) 103 if (sInstance == this)
102 sInstance = staticDeleterAB.setObject(0); 104 sInstance = staticDeleterAB.setObject(0);
103} 105}
104 106
105KABPrefs *KABPrefs::instance() 107KABPrefs *KABPrefs::instance()
106{ 108{
107 if ( !sInstance ) { 109 if ( !sInstance ) {
108#ifdef KAB_EMBEDDED 110#ifdef KAB_EMBEDDED
109 sInstance = staticDeleterAB.setObject( new KABPrefs() ); 111 sInstance = staticDeleterAB.setObject( new KABPrefs() );
110#else //KAB_EMBEDDED 112#else //KAB_EMBEDDED
111 //US the following line has changed ???. Why 113 //US the following line has changed ???. Why
112 staticDeleterAB.setObject( sInstance, new KABPrefs() ); 114 staticDeleterAB.setObject( sInstance, new KABPrefs() );
113#endif //KAB_EMBEDDED 115#endif //KAB_EMBEDDED
114 sInstance->readConfig(); 116 sInstance->readConfig();
115 } 117 }
116 118
117 return sInstance; 119 return sInstance;
118} 120}
119 121
120void KABPrefs::setCategoryDefaults() 122void KABPrefs::setCategoryDefaults()
121{ 123{
122 mCustomCategories.clear(); 124 mCustomCategories.clear();
123 125
124 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) 126 mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" )
125 << i18n( "Customer" ) << i18n( "Friend" ); 127 << i18n( "Customer" ) << i18n( "Friend" );
126} 128}
127 129
128 // US introduce a nonconst way to return the config object. 130 // US introduce a nonconst way to return the config object.
129KConfig* KABPrefs::getConfig() 131KConfig* KABPrefs::getConfig()
130{ 132{
131 return config(); 133 return config();
132} 134}
133void KABPrefs::usrReadConfig() 135void KABPrefs::usrReadConfig()
134{ 136{
135 KPimPrefs::usrReadConfig(); 137 KPimPrefs::usrReadConfig();
136} 138}
137 139
138 140
139/*US 141/*US
140void KABPrefs::usrSetDefaults() 142void KABPrefs::usrSetDefaults()
141{ 143{
142 KPimPrefs::usrSetDefaults(); 144 KPimPrefs::usrSetDefaults();
143} 145}
144 146
145void KABPrefs::usrReadConfig() 147void KABPrefs::usrReadConfig()
146{ 148{
147 KPimPrefs::usrReadConfig(); 149 KPimPrefs::usrReadConfig();
148} 150}
149 151
150void KABPrefs::usrWriteConfig() 152void KABPrefs::usrWriteConfig()
151{ 153{
152 KPimPrefs::usrWriteConfig(); 154 KPimPrefs::usrWriteConfig();
153} 155}
154*/ 156*/