-rw-r--r-- | kaddressbook/kabprefs.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kaddressbook/kabprefs.cpp b/kaddressbook/kabprefs.cpp index 42d541b..6f9c995 100644 --- a/kaddressbook/kabprefs.cpp +++ b/kaddressbook/kabprefs.cpp | |||
@@ -1,157 +1,157 @@ | |||
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 <q3textstream.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 | ||
46 | KABPrefs *KABPrefs::sInstance = 0; | 46 | KABPrefs *KABPrefs::sInstance = 0; |
47 | static KStaticDeleter<KABPrefs> staticDeleterAB; | 47 | static KStaticDeleter<KABPrefs> staticDeleterAB; |
48 | 48 | ||
49 | KABPrefs::KABPrefs() | 49 | KABPrefs::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("AskForDelete",&mAskForDelete,true); | 59 | addItemBool("AskForDelete",&mAskForDelete,true); |
60 | addItemBool("AskForQuit",&mAskForQuit,true); | 60 | addItemBool("AskForQuit",&mAskForQuit,true); |
61 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 61 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
62 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 62 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
63 | addItemBool("SearchWithReturn",&mSearchWithReturn, false ); | 63 | addItemBool("SearchWithReturn",&mSearchWithReturn, false ); |
64 | addItemBool("AutoSearchWithWildcard",&mAutoSearchWithWildcard, false ); | 64 | addItemBool("AutoSearchWithWildcard",&mAutoSearchWithWildcard, false ); |
65 | addItemBool("HideSearchOnSwitch",&mHideSearchOnSwitch, false ); | 65 | addItemBool("HideSearchOnSwitch",&mHideSearchOnSwitch, false ); |
66 | addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont()); | 66 | addItemFont("DetailsFont",&mDetailsFont,KGlobalSettings::generalFont()); |
67 | 67 | ||
68 | 68 | ||
69 | #endif //KAB_EMBEDDED | 69 | #endif //KAB_EMBEDDED |
70 | 70 | ||
71 | KPrefs::setCurrentGroup( "MainWindow" ); | 71 | KPrefs::setCurrentGroup( "MainWindow" ); |
72 | bool m_visible = false; | 72 | bool m_visible = false; |
73 | #ifdef DESKTOP_VERSION | 73 | #ifdef DESKTOP_VERSION |
74 | m_visible = true; | 74 | m_visible = true; |
75 | #endif | 75 | #endif |
76 | addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible ); | 76 | addItemBool( "FullMenuBarVisible", &mFullMenuBarVisible, m_visible ); |
77 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); | 77 | addItemBool( "JumpButtonBarVisible", &mJumpButtonBarVisible, false ); |
78 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); | 78 | addItemBool( "DetailsPageVisible", &mDetailsPageVisible, true ); |
79 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); | 79 | addItemIntList( "ExtensionsSplitter", &mExtensionsSplitter ); |
80 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); | 80 | addItemIntList( "DetailsSplitter", &mDetailsSplitter ); |
81 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); | 81 | addItemBool( "MultipleViewsAtOnce", &mMultipleViewsAtOnce, true ); |
82 | 82 | ||
83 | 83 | ||
84 | KPrefs::setCurrentGroup( "Extensions_General" ); | 84 | KPrefs::setCurrentGroup( "Extensions_General" ); |
85 | QStringList defaultExtensions; | 85 | QStringList defaultExtensions; |
86 | defaultExtensions << "merge"; | 86 | defaultExtensions << "merge"; |
87 | defaultExtensions << "distribution_list_editor"; | 87 | defaultExtensions << "distribution_list_editor"; |
88 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); | 88 | addItemInt( "CurrentExtension", &mCurrentExtension, 0 ); |
89 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); | 89 | addItemStringList( "ActiveExtensions", &mActiveExtensions, defaultExtensions ); |
90 | 90 | ||
91 | KPrefs::setCurrentGroup( "Views" ); | 91 | KPrefs::setCurrentGroup( "Views" ); |
92 | QString defaultView = i18n( "Default Table View" ); | 92 | QString defaultView = i18n( "Default Table View" ); |
93 | addItemString( "CurrentView", &mCurrentView, defaultView ); | 93 | addItemString( "CurrentView", &mCurrentView, defaultView ); |
94 | addItemStringList( "ViewNames", &mViewNames, defaultView ); | 94 | addItemStringList( "ViewNames", &mViewNames, QStringList(defaultView) ); |
95 | 95 | ||
96 | KPrefs::setCurrentGroup( "Filters" ); | 96 | KPrefs::setCurrentGroup( "Filters" ); |
97 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); | 97 | addItemInt( "CurrentFilter", &mCurrentFilter, 0 ); |
98 | 98 | ||
99 | } | 99 | } |
100 | 100 | ||
101 | KABPrefs::~KABPrefs() | 101 | KABPrefs::~KABPrefs() |
102 | { | 102 | { |
103 | //qDebug("KABPrefs::~KABPrefs() "); | 103 | //qDebug("KABPrefs::~KABPrefs() "); |
104 | if (sInstance == this) | 104 | if (sInstance == this) |
105 | sInstance = staticDeleterAB.setObject(0); | 105 | sInstance = staticDeleterAB.setObject(0); |
106 | } | 106 | } |
107 | 107 | ||
108 | KABPrefs *KABPrefs::instance() | 108 | KABPrefs *KABPrefs::instance() |
109 | { | 109 | { |
110 | if ( !sInstance ) { | 110 | if ( !sInstance ) { |
111 | #ifdef KAB_EMBEDDED | 111 | #ifdef KAB_EMBEDDED |
112 | sInstance = staticDeleterAB.setObject( new KABPrefs() ); | 112 | sInstance = staticDeleterAB.setObject( new KABPrefs() ); |
113 | #else //KAB_EMBEDDED | 113 | #else //KAB_EMBEDDED |
114 | //US the following line has changed ???. Why | 114 | //US the following line has changed ???. Why |
115 | staticDeleterAB.setObject( sInstance, new KABPrefs() ); | 115 | staticDeleterAB.setObject( sInstance, new KABPrefs() ); |
116 | #endif //KAB_EMBEDDED | 116 | #endif //KAB_EMBEDDED |
117 | sInstance->readConfig(); | 117 | sInstance->readConfig(); |
118 | } | 118 | } |
119 | 119 | ||
120 | return sInstance; | 120 | return sInstance; |
121 | } | 121 | } |
122 | 122 | ||
123 | void KABPrefs::setCategoryDefaults() | 123 | void KABPrefs::setCategoryDefaults() |
124 | { | 124 | { |
125 | mCustomCategories.clear(); | 125 | mCustomCategories.clear(); |
126 | 126 | ||
127 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) | 127 | mCustomCategories << i18n( "Business" ) << i18n( "Family" ) << i18n( "School" ) |
128 | << i18n( "Customer" ) << i18n( "Friend" ); | 128 | << i18n( "Customer" ) << i18n( "Friend" ); |
129 | } | 129 | } |
130 | 130 | ||
131 | // US introduce a nonconst way to return the config object. | 131 | // US introduce a nonconst way to return the config object. |
132 | KConfig* KABPrefs::getConfig() | 132 | KConfig* KABPrefs::getConfig() |
133 | { | 133 | { |
134 | return config(); | 134 | return config(); |
135 | } | 135 | } |
136 | void KABPrefs::usrReadConfig() | 136 | void KABPrefs::usrReadConfig() |
137 | { | 137 | { |
138 | KPimPrefs::usrReadConfig(); | 138 | KPimPrefs::usrReadConfig(); |
139 | } | 139 | } |
140 | 140 | ||
141 | 141 | ||
142 | /*US | 142 | /*US |
143 | void KABPrefs::usrSetDefaults() | 143 | void KABPrefs::usrSetDefaults() |
144 | { | 144 | { |
145 | KPimPrefs::usrSetDefaults(); | 145 | KPimPrefs::usrSetDefaults(); |
146 | } | 146 | } |
147 | 147 | ||
148 | void KABPrefs::usrReadConfig() | 148 | void KABPrefs::usrReadConfig() |
149 | { | 149 | { |
150 | KPimPrefs::usrReadConfig(); | 150 | KPimPrefs::usrReadConfig(); |
151 | } | 151 | } |
152 | 152 | ||
153 | void KABPrefs::usrWriteConfig() | 153 | void KABPrefs::usrWriteConfig() |
154 | { | 154 | { |
155 | KPimPrefs::usrWriteConfig(); | 155 | KPimPrefs::usrWriteConfig(); |
156 | } | 156 | } |
157 | */ | 157 | */ |