-rw-r--r-- | kaddressbook/kabcore.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 70ab6b7..7bf1a2f 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1,349 +1,355 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressbook. | 2 | This file is part of KAddressbook. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
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 | #include "kabcore.h" | 24 | #include "kabcore.h" |
25 | 25 | ||
26 | #include <stdaddressbook.h> | 26 | #include <stdaddressbook.h> |
27 | #include <klocale.h> | 27 | #include <klocale.h> |
28 | 28 | ||
29 | #ifndef KAB_EMBEDDED | 29 | #ifndef KAB_EMBEDDED |
30 | #include <qclipboard.h> | 30 | #include <qclipboard.h> |
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qapplicaton.h> | 33 | #include <qapplicaton.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qregexp.h> | 35 | #include <qregexp.h> |
36 | #include <qvbox.h> | 36 | #include <qvbox.h> |
37 | #include <kabc/addresseelist.h> | 37 | #include <kabc/addresseelist.h> |
38 | #include <kabc/errorhandler.h> | 38 | #include <kabc/errorhandler.h> |
39 | #include <kabc/resource.h> | 39 | #include <kabc/resource.h> |
40 | #include <kabc/vcardconverter.h> | 40 | #include <kabc/vcardconverter.h> |
41 | #include <kapplication.h> | 41 | #include <kapplication.h> |
42 | #include <kactionclasses.h> | 42 | #include <kactionclasses.h> |
43 | #include <kcmultidialog.h> | 43 | #include <kcmultidialog.h> |
44 | #include <kdebug.h> | 44 | #include <kdebug.h> |
45 | #include <kdeversion.h> | 45 | #include <kdeversion.h> |
46 | #include <kkeydialog.h> | 46 | #include <kkeydialog.h> |
47 | #include <kmessagebox.h> | 47 | #include <kmessagebox.h> |
48 | #include <kprinter.h> | 48 | #include <kprinter.h> |
49 | #include <kprotocolinfo.h> | 49 | #include <kprotocolinfo.h> |
50 | #include <kresources/selectdialog.h> | 50 | #include <kresources/selectdialog.h> |
51 | #include <kstandarddirs.h> | 51 | #include <kstandarddirs.h> |
52 | #include <ktempfile.h> | 52 | #include <ktempfile.h> |
53 | #include <kxmlguiclient.h> | 53 | #include <kxmlguiclient.h> |
54 | #include <kaboutdata.h> | 54 | #include <kaboutdata.h> |
55 | #include <libkdepim/categoryselectdialog.h> | 55 | #include <libkdepim/categoryselectdialog.h> |
56 | 56 | ||
57 | #include "addresseeutil.h" | 57 | #include "addresseeutil.h" |
58 | #include "addresseeeditordialog.h" | 58 | #include "addresseeeditordialog.h" |
59 | #include "extensionmanager.h" | 59 | #include "extensionmanager.h" |
60 | #include "kstdaction.h" | 60 | #include "kstdaction.h" |
61 | #include "kaddressbookservice.h" | 61 | #include "kaddressbookservice.h" |
62 | #include "ldapsearchdialog.h" | 62 | #include "ldapsearchdialog.h" |
63 | #include "printing/printingwizard.h" | 63 | #include "printing/printingwizard.h" |
64 | #else // KAB_EMBEDDED | 64 | #else // KAB_EMBEDDED |
65 | 65 | ||
66 | #include "KDGanttMinimizeSplitter.h" | 66 | #include "KDGanttMinimizeSplitter.h" |
67 | #include "kaddressbookmain.h" | 67 | #include "kaddressbookmain.h" |
68 | #include "kactioncollection.h" | 68 | #include "kactioncollection.h" |
69 | #include <qapp.h> | 69 | #include <qapp.h> |
70 | #include <qmenubar.h> | 70 | #include <qmenubar.h> |
71 | //#include <qtoolbar.h> | 71 | //#include <qtoolbar.h> |
72 | #include <qmessagebox.h> | 72 | #include <qmessagebox.h> |
73 | #include <kdebug.h> | 73 | #include <kdebug.h> |
74 | #include <kiconloader.h> // needed for SmallIcon | 74 | #include <kiconloader.h> // needed for SmallIcon |
75 | #include <kresources/kcmkresources.h> | 75 | #include <kresources/kcmkresources.h> |
76 | #include <ktoolbar.h> | 76 | #include <ktoolbar.h> |
77 | 77 | ||
78 | #include <kcmkabconfig.h> | 78 | #include <kcmkabconfig.h> |
79 | 79 | ||
80 | //US#include <qpe/resource.h> // needed for Resource::loadPixmap | 80 | //US#include <qpe/resource.h> // needed for Resource::loadPixmap |
81 | //#include <qlabel.h> | 81 | //#include <qlabel.h> |
82 | #endif // KAB_EMBEDDED | 82 | #endif // KAB_EMBEDDED |
83 | #include <kcmkabconfig.h> | 83 | #include <kcmkabconfig.h> |
84 | 84 | ||
85 | 85 | ||
86 | #include <kresources/selectdialog.h> | 86 | #include <kresources/selectdialog.h> |
87 | #include <kmessagebox.h> | 87 | #include <kmessagebox.h> |
88 | 88 | ||
89 | #include <picture.h> | 89 | #include <picture.h> |
90 | #include <resource.h> | 90 | #include <resource.h> |
91 | 91 | ||
92 | //US#include <qsplitter.h> | 92 | //US#include <qsplitter.h> |
93 | #include <qvbox.h> | 93 | #include <qvbox.h> |
94 | #include <qlayout.h> | 94 | #include <qlayout.h> |
95 | #include <qclipboard.h> | 95 | #include <qclipboard.h> |
96 | 96 | ||
97 | #include <libkdepim/categoryselectdialog.h> | 97 | #include <libkdepim/categoryselectdialog.h> |
98 | 98 | ||
99 | #include "addresseeutil.h" | 99 | #include "addresseeutil.h" |
100 | #include "undocmds.h" | 100 | #include "undocmds.h" |
101 | #include "addresseeeditordialog.h" | 101 | #include "addresseeeditordialog.h" |
102 | #include "viewmanager.h" | 102 | #include "viewmanager.h" |
103 | #include "details/detailsviewcontainer.h" | 103 | #include "details/detailsviewcontainer.h" |
104 | #include "kabprefs.h" | 104 | #include "kabprefs.h" |
105 | #include "xxportmanager.h" | 105 | #include "xxportmanager.h" |
106 | #include "incsearchwidget.h" | 106 | #include "incsearchwidget.h" |
107 | #include "jumpbuttonbar.h" | 107 | #include "jumpbuttonbar.h" |
108 | #include "extensionmanager.h" | 108 | #include "extensionmanager.h" |
109 | #include "addresseeconfig.h" | 109 | #include "addresseeconfig.h" |
110 | #include <kcmultidialog.h> | 110 | #include <kcmultidialog.h> |
111 | 111 | ||
112 | 112 | ||
113 | #ifdef KAB_EMBEDDED | 113 | #ifdef KAB_EMBEDDED |
114 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) | 114 | KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) |
115 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 115 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
116 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ | 116 | mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ |
117 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) | 117 | mReadWrite( readWrite ), mModified( false ), mMainWindow(client) |
118 | #else //KAB_EMBEDDED | 118 | #else //KAB_EMBEDDED |
119 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) | 119 | KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) |
120 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), | 120 | : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), |
121 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), | 121 | mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), |
122 | mReadWrite( readWrite ), mModified( false ) | 122 | mReadWrite( readWrite ), mModified( false ) |
123 | #endif //KAB_EMBEDDED | 123 | #endif //KAB_EMBEDDED |
124 | { | 124 | { |
125 | #ifdef KAB_EMBEDDED | 125 | #ifdef KAB_EMBEDDED |
126 | //US we define here our own global actioncollection. | 126 | //US we define here our own global actioncollection. |
127 | //mActionCollection = new KActionCollection(this); | 127 | //mActionCollection = new KActionCollection(this); |
128 | #endif //KAB_EMBEDDED | 128 | #endif //KAB_EMBEDDED |
129 | mExtensionBarSplitter = 0; | 129 | mExtensionBarSplitter = 0; |
130 | mIsPart = !parent->inherits( "KAddressBookMain" ); | 130 | mIsPart = !parent->inherits( "KAddressBookMain" ); |
131 | 131 | ||
132 | mAddressBook = KABC::StdAddressBook::self(); | 132 | mAddressBook = KABC::StdAddressBook::self(); |
133 | KABC::StdAddressBook::setAutomaticSave( true ); | 133 | KABC::StdAddressBook::setAutomaticSave( true ); |
134 | 134 | ||
135 | #ifndef KAB_EMBEDDED | 135 | #ifndef KAB_EMBEDDED |
136 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); | 136 | mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); |
137 | #endif //KAB_EMBEDDED | 137 | #endif //KAB_EMBEDDED |
138 | 138 | ||
139 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), | 139 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), |
140 | SLOT( addressBookChanged() ) ); | 140 | SLOT( addressBookChanged() ) ); |
141 | 141 | ||
142 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, | 142 | mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, |
143 | "X-Department", "KADDRESSBOOK" ); | 143 | "X-Department", "KADDRESSBOOK" ); |
144 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 144 | mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
145 | "X-Profession", "KADDRESSBOOK" ); | 145 | "X-Profession", "KADDRESSBOOK" ); |
146 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 146 | mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
147 | "X-AssistantsName", "KADDRESSBOOK" ); | 147 | "X-AssistantsName", "KADDRESSBOOK" ); |
148 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 148 | mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
149 | "X-ManagersName", "KADDRESSBOOK" ); | 149 | "X-ManagersName", "KADDRESSBOOK" ); |
150 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 150 | mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
151 | "X-SpousesName", "KADDRESSBOOK" ); | 151 | "X-SpousesName", "KADDRESSBOOK" ); |
152 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, | 152 | mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, |
153 | "X-Office", "KADDRESSBOOK" ); | 153 | "X-Office", "KADDRESSBOOK" ); |
154 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 154 | mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
155 | "X-IMAddress", "KADDRESSBOOK" ); | 155 | "X-IMAddress", "KADDRESSBOOK" ); |
156 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 156 | mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
157 | "X-Anniversary", "KADDRESSBOOK" ); | 157 | "X-Anniversary", "KADDRESSBOOK" ); |
158 | |||
159 | //US added this field to become compatible with Opie addressbook | ||
160 | mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, | ||
161 | "X-Gender", "KADDRESSBOOK" ); | ||
162 | mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, | ||
163 | "X-Children", "KADDRESSBOOK" ); | ||
158 | 164 | ||
159 | initGUI(); | 165 | initGUI(); |
160 | 166 | ||
161 | mIncSearchWidget->setFocus(); | 167 | mIncSearchWidget->setFocus(); |
162 | 168 | ||
163 | 169 | ||
164 | connect( mViewManager, SIGNAL( selected( const QString& ) ), | 170 | connect( mViewManager, SIGNAL( selected( const QString& ) ), |
165 | SLOT( setContactSelected( const QString& ) ) ); | 171 | SLOT( setContactSelected( const QString& ) ) ); |
166 | connect( mViewManager, SIGNAL( executed( const QString& ) ), | 172 | connect( mViewManager, SIGNAL( executed( const QString& ) ), |
167 | SLOT( editContact( const QString& ) ) ); | 173 | SLOT( editContact( const QString& ) ) ); |
168 | connect( mViewManager, SIGNAL( deleteRequest( ) ), | 174 | connect( mViewManager, SIGNAL( deleteRequest( ) ), |
169 | SLOT( deleteContacts( ) ) ); | 175 | SLOT( deleteContacts( ) ) ); |
170 | connect( mViewManager, SIGNAL( modified() ), | 176 | connect( mViewManager, SIGNAL( modified() ), |
171 | SLOT( setModified() ) ); | 177 | SLOT( setModified() ) ); |
172 | 178 | ||
173 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); | 179 | connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); |
174 | 180 | ||
175 | connect( mXXPortManager, SIGNAL( modified() ), | 181 | connect( mXXPortManager, SIGNAL( modified() ), |
176 | SLOT( setModified() ) ); | 182 | SLOT( setModified() ) ); |
177 | 183 | ||
178 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), | 184 | connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), |
179 | SLOT( incrementalSearch( const QString& ) ) ); | 185 | SLOT( incrementalSearch( const QString& ) ) ); |
180 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), | 186 | connect( mIncSearchWidget, SIGNAL( fieldChanged() ), |
181 | mJumpButtonBar, SLOT( recreateButtons() ) ); | 187 | mJumpButtonBar, SLOT( recreateButtons() ) ); |
182 | 188 | ||
183 | #ifndef KAB_EMBEDDED | 189 | #ifndef KAB_EMBEDDED |
184 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), | 190 | connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), |
185 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); | 191 | mXXPortManager, SLOT( importVCard( const KURL& ) ) ); |
186 | 192 | ||
187 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), | 193 | connect( mDetails, SIGNAL( sendEmail( const QString& ) ), |
188 | SLOT( sendMail( const QString& ) ) ); | 194 | SLOT( sendMail( const QString& ) ) ); |
189 | connect( mDetails, SIGNAL( browse( const QString& ) ), | 195 | connect( mDetails, SIGNAL( browse( const QString& ) ), |
190 | SLOT( browse( const QString& ) ) ); | 196 | SLOT( browse( const QString& ) ) ); |
191 | 197 | ||
192 | mAddressBookService = new KAddressBookService( this ); | 198 | mAddressBookService = new KAddressBookService( this ); |
193 | 199 | ||
194 | #endif //KAB_EMBEDDED | 200 | #endif //KAB_EMBEDDED |
195 | 201 | ||
196 | setModified( false ); | 202 | setModified( false ); |
197 | } | 203 | } |
198 | 204 | ||
199 | KABCore::~KABCore() | 205 | KABCore::~KABCore() |
200 | { | 206 | { |
201 | // save(); | 207 | // save(); |
202 | //saveSettings(); | 208 | //saveSettings(); |
203 | //KABPrefs::instance()->writeConfig(); | 209 | //KABPrefs::instance()->writeConfig(); |
204 | delete AddresseeConfig::instance(); | 210 | delete AddresseeConfig::instance(); |
205 | mAddressBook = 0; | 211 | mAddressBook = 0; |
206 | KABC::StdAddressBook::close(); | 212 | KABC::StdAddressBook::close(); |
207 | 213 | ||
208 | #ifdef KAB_EMBEDDED | 214 | #ifdef KAB_EMBEDDED |
209 | //US we define here our own global actioncollection. | 215 | //US we define here our own global actioncollection. |
210 | // delete mActionCollection; | 216 | // delete mActionCollection; |
211 | #endif //KAB_EMBEDDED | 217 | #endif //KAB_EMBEDDED |
212 | 218 | ||
213 | } | 219 | } |
214 | 220 | ||
215 | void KABCore::restoreSettings() | 221 | void KABCore::restoreSettings() |
216 | { | 222 | { |
217 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; | 223 | bool state = KABPrefs::instance()->mJumpButtonBarVisible; |
218 | 224 | ||
219 | mActionJumpBar->setChecked( state ); | 225 | mActionJumpBar->setChecked( state ); |
220 | setJumpButtonBarVisible( state ); | 226 | setJumpButtonBarVisible( state ); |
221 | 227 | ||
222 | state = KABPrefs::instance()->mDetailsPageVisible; | 228 | state = KABPrefs::instance()->mDetailsPageVisible; |
223 | 229 | ||
224 | mActionDetails->setChecked( state ); | 230 | mActionDetails->setChecked( state ); |
225 | setDetailsVisible( state ); | 231 | setDetailsVisible( state ); |
226 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; | 232 | QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; |
227 | if ( splitterSize.count() == 0 ) { | 233 | if ( splitterSize.count() == 0 ) { |
228 | splitterSize.append( width() / 2 ); | 234 | splitterSize.append( width() / 2 ); |
229 | splitterSize.append( width() / 2 ); | 235 | splitterSize.append( width() / 2 ); |
230 | } | 236 | } |
231 | mMiniSplitter->setSizes( splitterSize ); | 237 | mMiniSplitter->setSizes( splitterSize ); |
232 | if ( mExtensionBarSplitter ) { | 238 | if ( mExtensionBarSplitter ) { |
233 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 239 | splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
234 | if ( splitterSize.count() == 0 ) { | 240 | if ( splitterSize.count() == 0 ) { |
235 | splitterSize.append( width() / 2 ); | 241 | splitterSize.append( width() / 2 ); |
236 | splitterSize.append( width() / 2 ); | 242 | splitterSize.append( width() / 2 ); |
237 | } | 243 | } |
238 | mExtensionBarSplitter->setSizes( splitterSize ); | 244 | mExtensionBarSplitter->setSizes( splitterSize ); |
239 | 245 | ||
240 | } | 246 | } |
241 | #ifndef KAB_EMBEDDED | 247 | #ifndef KAB_EMBEDDED |
242 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; | 248 | QValueList<int> splitterSize = KABPrefs::instance()->mExtensionsSplitter; |
243 | if ( splitterSize.count() == 0 ) { | 249 | if ( splitterSize.count() == 0 ) { |
244 | splitterSize.append( width() / 2 ); | 250 | splitterSize.append( width() / 2 ); |
245 | splitterSize.append( width() / 2 ); | 251 | splitterSize.append( width() / 2 ); |
246 | } | 252 | } |
247 | mExtensionBarSplitter->setSizes( splitterSize ); | 253 | mExtensionBarSplitter->setSizes( splitterSize ); |
248 | 254 | ||
249 | splitterSize = KABPrefs::instance()->mDetailsSplitter; | 255 | splitterSize = KABPrefs::instance()->mDetailsSplitter; |
250 | if ( splitterSize.count() == 0 ) { | 256 | if ( splitterSize.count() == 0 ) { |
251 | splitterSize.append( height() / 2 ); | 257 | splitterSize.append( height() / 2 ); |
252 | splitterSize.append( height() / 2 ); | 258 | splitterSize.append( height() / 2 ); |
253 | } | 259 | } |
254 | mDetailsSplitter->setSizes( splitterSize ); | 260 | mDetailsSplitter->setSizes( splitterSize ); |
255 | 261 | ||
256 | mExtensionManager->restoreSettings(); | 262 | mExtensionManager->restoreSettings(); |
257 | 263 | ||
258 | #endif //KAB_EMBEDDED | 264 | #endif //KAB_EMBEDDED |
259 | 265 | ||
260 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); | 266 | mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); |
261 | 267 | ||
262 | mViewManager->restoreSettings(); | 268 | mViewManager->restoreSettings(); |
263 | mExtensionManager->restoreSettings(); | 269 | mExtensionManager->restoreSettings(); |
264 | } | 270 | } |
265 | 271 | ||
266 | void KABCore::saveSettings() | 272 | void KABCore::saveSettings() |
267 | { | 273 | { |
268 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 274 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
269 | if ( mExtensionBarSplitter ) | 275 | if ( mExtensionBarSplitter ) |
270 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 276 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
271 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 277 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
272 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 278 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
273 | #ifndef KAB_EMBEDDED | 279 | #ifndef KAB_EMBEDDED |
274 | 280 | ||
275 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 281 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
276 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 282 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
277 | #endif //KAB_EMBEDDED | 283 | #endif //KAB_EMBEDDED |
278 | mExtensionManager->saveSettings(); | 284 | mExtensionManager->saveSettings(); |
279 | mViewManager->saveSettings(); | 285 | mViewManager->saveSettings(); |
280 | 286 | ||
281 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 287 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
282 | 288 | ||
283 | } | 289 | } |
284 | 290 | ||
285 | KABC::AddressBook *KABCore::addressBook() const | 291 | KABC::AddressBook *KABCore::addressBook() const |
286 | { | 292 | { |
287 | return mAddressBook; | 293 | return mAddressBook; |
288 | } | 294 | } |
289 | 295 | ||
290 | KConfig *KABCore::config() | 296 | KConfig *KABCore::config() |
291 | { | 297 | { |
292 | #ifndef KAB_EMBEDDED | 298 | #ifndef KAB_EMBEDDED |
293 | return KABPrefs::instance()->config(); | 299 | return KABPrefs::instance()->config(); |
294 | #else //KAB_EMBEDDED | 300 | #else //KAB_EMBEDDED |
295 | return KABPrefs::instance()->getConfig(); | 301 | return KABPrefs::instance()->getConfig(); |
296 | #endif //KAB_EMBEDDED | 302 | #endif //KAB_EMBEDDED |
297 | } | 303 | } |
298 | 304 | ||
299 | KActionCollection *KABCore::actionCollection() const | 305 | KActionCollection *KABCore::actionCollection() const |
300 | { | 306 | { |
301 | return mGUIClient->actionCollection(); | 307 | return mGUIClient->actionCollection(); |
302 | } | 308 | } |
303 | 309 | ||
304 | KABC::Field *KABCore::currentSearchField() const | 310 | KABC::Field *KABCore::currentSearchField() const |
305 | { | 311 | { |
306 | if (mIncSearchWidget) | 312 | if (mIncSearchWidget) |
307 | return mIncSearchWidget->currentField(); | 313 | return mIncSearchWidget->currentField(); |
308 | else | 314 | else |
309 | return 0; | 315 | return 0; |
310 | } | 316 | } |
311 | 317 | ||
312 | QStringList KABCore::selectedUIDs() const | 318 | QStringList KABCore::selectedUIDs() const |
313 | { | 319 | { |
314 | return mViewManager->selectedUids(); | 320 | return mViewManager->selectedUids(); |
315 | } | 321 | } |
316 | 322 | ||
317 | KABC::Resource *KABCore::requestResource( QWidget *parent ) | 323 | KABC::Resource *KABCore::requestResource( QWidget *parent ) |
318 | { | 324 | { |
319 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); | 325 | QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); |
320 | 326 | ||
321 | QPtrList<KRES::Resource> kresResources; | 327 | QPtrList<KRES::Resource> kresResources; |
322 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); | 328 | QPtrListIterator<KABC::Resource> resIt( kabcResources ); |
323 | KABC::Resource *resource; | 329 | KABC::Resource *resource; |
324 | while ( ( resource = resIt.current() ) != 0 ) { | 330 | while ( ( resource = resIt.current() ) != 0 ) { |
325 | ++resIt; | 331 | ++resIt; |
326 | if ( !resource->readOnly() ) { | 332 | if ( !resource->readOnly() ) { |
327 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); | 333 | KRES::Resource *res = static_cast<KRES::Resource*>( resource ); |
328 | if ( res ) | 334 | if ( res ) |
329 | kresResources.append( res ); | 335 | kresResources.append( res ); |
330 | } | 336 | } |
331 | } | 337 | } |
332 | 338 | ||
333 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); | 339 | KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); |
334 | return static_cast<KABC::Resource*>( res ); | 340 | return static_cast<KABC::Resource*>( res ); |
335 | } | 341 | } |
336 | 342 | ||
337 | #ifndef KAB_EMBEDDED | 343 | #ifndef KAB_EMBEDDED |
338 | KAboutData *KABCore::createAboutData() | 344 | KAboutData *KABCore::createAboutData() |
339 | #else //KAB_EMBEDDED | 345 | #else //KAB_EMBEDDED |
340 | void KABCore::createAboutData() | 346 | void KABCore::createAboutData() |
341 | #endif //KAB_EMBEDDED | 347 | #endif //KAB_EMBEDDED |
342 | { | 348 | { |
343 | #ifndef KAB_EMBEDDED | 349 | #ifndef KAB_EMBEDDED |
344 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), | 350 | KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), |
345 | "3.1", I18N_NOOP( "The KDE Address Book" ), | 351 | "3.1", I18N_NOOP( "The KDE Address Book" ), |
346 | KAboutData::License_GPL_V2, | 352 | KAboutData::License_GPL_V2, |
347 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); | 353 | I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); |
348 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); | 354 | about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); |
349 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); | 355 | about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); |