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