summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-09-22 04:45:07 (UTC)
committer zautrix <zautrix>2004-09-22 04:45:07 (UTC)
commitbbeffa56ee51d30b84bcadaf22234b8227958f31 (patch) (unidiff)
tree040ce64f3e618ef4b76ddfa80d34a245d59ef1b5 /kaddressbook
parenta56783aace3496c8b40008d0dec4c42437165e54 (diff)
downloadkdepimpi-bbeffa56ee51d30b84bcadaf22234b8227958f31.zip
kdepimpi-bbeffa56ee51d30b84bcadaf22234b8227958f31.tar.gz
kdepimpi-bbeffa56ee51d30b84bcadaf22234b8227958f31.tar.bz2
desktop compile fixes
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 1b40d71..df634d0 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -1,552 +1,553 @@
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/* 24/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (c) 2004 Ulf Schenk
27 27
28$Id$ 28$Id$
29*/ 29*/
30 30
31#include "kabcore.h" 31#include "kabcore.h"
32 32
33#include <stdaddressbook.h> 33#include <stdaddressbook.h>
34#include <klocale.h> 34#include <klocale.h>
35#include <kfiledialog.h> 35#include <kfiledialog.h>
36#include <qtimer.h>
36#include <qprogressbar.h> 37#include <qprogressbar.h>
37 38
38#ifndef KAB_EMBEDDED 39#ifndef KAB_EMBEDDED
39#include <qclipboard.h> 40#include <qclipboard.h>
40#include <qdir.h> 41#include <qdir.h>
41#include <qfile.h> 42#include <qfile.h>
42#include <qapplicaton.h> 43#include <qapplicaton.h>
43#include <qprogressbar.h> 44#include <qprogressbar.h>
44#include <qlayout.h> 45#include <qlayout.h>
45#include <qregexp.h> 46#include <qregexp.h>
46#include <qvbox.h> 47#include <qvbox.h>
47#include <kabc/addresseelist.h> 48#include <kabc/addresseelist.h>
48#include <kabc/errorhandler.h> 49#include <kabc/errorhandler.h>
49#include <kabc/resource.h> 50#include <kabc/resource.h>
50#include <kabc/vcardconverter.h> 51#include <kabc/vcardconverter.h>
51#include <kapplication.h> 52#include <kapplication.h>
52#include <kactionclasses.h> 53#include <kactionclasses.h>
53#include <kcmultidialog.h> 54#include <kcmultidialog.h>
54#include <kdebug.h> 55#include <kdebug.h>
55#include <kdeversion.h> 56#include <kdeversion.h>
56#include <kkeydialog.h> 57#include <kkeydialog.h>
57#include <kmessagebox.h> 58#include <kmessagebox.h>
58#include <kprinter.h> 59#include <kprinter.h>
59#include <kprotocolinfo.h> 60#include <kprotocolinfo.h>
60#include <kresources/selectdialog.h> 61#include <kresources/selectdialog.h>
61#include <kstandarddirs.h> 62#include <kstandarddirs.h>
62#include <ktempfile.h> 63#include <ktempfile.h>
63#include <kxmlguiclient.h> 64#include <kxmlguiclient.h>
64#include <kaboutdata.h> 65#include <kaboutdata.h>
65#include <libkdepim/categoryselectdialog.h> 66#include <libkdepim/categoryselectdialog.h>
66 67
67#include "addresseeutil.h" 68#include "addresseeutil.h"
68#include "addresseeeditordialog.h" 69#include "addresseeeditordialog.h"
69#include "extensionmanager.h" 70#include "extensionmanager.h"
70#include "kstdaction.h" 71#include "kstdaction.h"
71#include "kaddressbookservice.h" 72#include "kaddressbookservice.h"
72#include "ldapsearchdialog.h" 73#include "ldapsearchdialog.h"
73#include "printing/printingwizard.h" 74#include "printing/printingwizard.h"
74#else // KAB_EMBEDDED 75#else // KAB_EMBEDDED
75 76
76#include <kapplication.h> 77#include <kapplication.h>
77#include "KDGanttMinimizeSplitter.h" 78#include "KDGanttMinimizeSplitter.h"
78#include "kaddressbookmain.h" 79#include "kaddressbookmain.h"
79#include "kactioncollection.h" 80#include "kactioncollection.h"
80#include "addresseedialog.h" 81#include "addresseedialog.h"
81//US 82//US
82#include <addresseeview.h> 83#include <addresseeview.h>
83 84
84#include <qapp.h> 85#include <qapp.h>
85#include <qmenubar.h> 86#include <qmenubar.h>
86//#include <qtoolbar.h> 87//#include <qtoolbar.h>
87#include <qmessagebox.h> 88#include <qmessagebox.h>
88#include <kdebug.h> 89#include <kdebug.h>
89#include <kiconloader.h> // needed for SmallIcon 90#include <kiconloader.h> // needed for SmallIcon
90#include <kresources/kcmkresources.h> 91#include <kresources/kcmkresources.h>
91#include <ktoolbar.h> 92#include <ktoolbar.h>
92 93
93 94
94//#include <qlabel.h> 95//#include <qlabel.h>
95 96
96 97
97#ifndef DESKTOP_VERSION 98#ifndef DESKTOP_VERSION
98#include <qpe/ir.h> 99#include <qpe/ir.h>
99#include <qpe/qpemenubar.h> 100#include <qpe/qpemenubar.h>
100#include <qtopia/qcopenvelope_qws.h> 101#include <qtopia/qcopenvelope_qws.h>
101#else 102#else
102 103
103#include <qmenubar.h> 104#include <qmenubar.h>
104#endif 105#endif
105 106
106#endif // KAB_EMBEDDED 107#endif // KAB_EMBEDDED
107#include "kcmconfigs/kcmkabconfig.h" 108#include "kcmconfigs/kcmkabconfig.h"
108#include "kcmconfigs/kcmkdepimconfig.h" 109#include "kcmconfigs/kcmkdepimconfig.h"
109#include "kpimglobalprefs.h" 110#include "kpimglobalprefs.h"
110#include "externalapphandler.h" 111#include "externalapphandler.h"
111 112
112 113
113#include <kresources/selectdialog.h> 114#include <kresources/selectdialog.h>
114#include <kmessagebox.h> 115#include <kmessagebox.h>
115 116
116#include <picture.h> 117#include <picture.h>
117#include <resource.h> 118#include <resource.h>
118 119
119//US#include <qsplitter.h> 120//US#include <qsplitter.h>
120#include <qmap.h> 121#include <qmap.h>
121#include <qdir.h> 122#include <qdir.h>
122#include <qfile.h> 123#include <qfile.h>
123#include <qvbox.h> 124#include <qvbox.h>
124#include <qlayout.h> 125#include <qlayout.h>
125#include <qclipboard.h> 126#include <qclipboard.h>
126#include <qtextstream.h> 127#include <qtextstream.h>
127 128
128#include <libkdepim/categoryselectdialog.h> 129#include <libkdepim/categoryselectdialog.h>
129#include <kabc/vcardconverter.h> 130#include <kabc/vcardconverter.h>
130 131
131 132
132#include "addresseeutil.h" 133#include "addresseeutil.h"
133#include "undocmds.h" 134#include "undocmds.h"
134#include "addresseeeditordialog.h" 135#include "addresseeeditordialog.h"
135#include "viewmanager.h" 136#include "viewmanager.h"
136#include "details/detailsviewcontainer.h" 137#include "details/detailsviewcontainer.h"
137#include "kabprefs.h" 138#include "kabprefs.h"
138#include "xxportmanager.h" 139#include "xxportmanager.h"
139#include "incsearchwidget.h" 140#include "incsearchwidget.h"
140#include "jumpbuttonbar.h" 141#include "jumpbuttonbar.h"
141#include "extensionmanager.h" 142#include "extensionmanager.h"
142#include "addresseeconfig.h" 143#include "addresseeconfig.h"
143#include <kcmultidialog.h> 144#include <kcmultidialog.h>
144 145
145#ifdef _WIN32_ 146#ifdef _WIN32_
146 147
147#include "kaimportoldialog.h" 148#include "kaimportoldialog.h"
148#else 149#else
149#include <unistd.h> 150#include <unistd.h>
150#endif 151#endif
151// sync includes 152// sync includes
152#include <libkdepim/ksyncprofile.h> 153#include <libkdepim/ksyncprofile.h>
153#include <libkdepim/ksyncprefsdialog.h> 154#include <libkdepim/ksyncprefsdialog.h>
154 155
155 156
156bool pasteWithNewUid = true; 157bool pasteWithNewUid = true;
157 158
158#ifdef KAB_EMBEDDED 159#ifdef KAB_EMBEDDED
159KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 160KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
160 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 161 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
161 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 162 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
162 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 163 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
163#else //KAB_EMBEDDED 164#else //KAB_EMBEDDED
164KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 165KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
165 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ), 166 : QWidget( parent, name ), mGUIClient( client ), mViewManager( 0 ),
166 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 167 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
167 mReadWrite( readWrite ), mModified( false ) 168 mReadWrite( readWrite ), mModified( false )
168#endif //KAB_EMBEDDED 169#endif //KAB_EMBEDDED
169{ 170{
170 171
171 mBlockSaveFlag = false; 172 mBlockSaveFlag = false;
172 mExtensionBarSplitter = 0; 173 mExtensionBarSplitter = 0;
173 mIsPart = !parent->inherits( "KAddressBookMain" ); 174 mIsPart = !parent->inherits( "KAddressBookMain" );
174 175
175 mAddressBook = KABC::StdAddressBook::self(); 176 mAddressBook = KABC::StdAddressBook::self();
176 KABC::StdAddressBook::setAutomaticSave( false ); 177 KABC::StdAddressBook::setAutomaticSave( false );
177 178
178#ifndef KAB_EMBEDDED 179#ifndef KAB_EMBEDDED
179 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 180 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
180#endif //KAB_EMBEDDED 181#endif //KAB_EMBEDDED
181 182
182 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 183 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
183 SLOT( addressBookChanged() ) ); 184 SLOT( addressBookChanged() ) );
184 185
185#if 0 186#if 0
186 // LP moved to addressbook init method 187 // LP moved to addressbook init method
187 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 188 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
188 "X-Department", "KADDRESSBOOK" ); 189 "X-Department", "KADDRESSBOOK" );
189 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 190 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
190 "X-Profession", "KADDRESSBOOK" ); 191 "X-Profession", "KADDRESSBOOK" );
191 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 192 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
192 "X-AssistantsName", "KADDRESSBOOK" ); 193 "X-AssistantsName", "KADDRESSBOOK" );
193 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 194 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
194 "X-ManagersName", "KADDRESSBOOK" ); 195 "X-ManagersName", "KADDRESSBOOK" );
195 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 196 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
196 "X-SpousesName", "KADDRESSBOOK" ); 197 "X-SpousesName", "KADDRESSBOOK" );
197 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 198 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
198 "X-Office", "KADDRESSBOOK" ); 199 "X-Office", "KADDRESSBOOK" );
199 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 200 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
200 "X-IMAddress", "KADDRESSBOOK" ); 201 "X-IMAddress", "KADDRESSBOOK" );
201 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 202 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
202 "X-Anniversary", "KADDRESSBOOK" ); 203 "X-Anniversary", "KADDRESSBOOK" );
203 204
204 //US added this field to become compatible with Opie/qtopia addressbook 205 //US added this field to become compatible with Opie/qtopia addressbook
205 // values can be "female" or "male" or "". An empty field represents undefined. 206 // values can be "female" or "male" or "". An empty field represents undefined.
206 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 207 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
207 "X-Gender", "KADDRESSBOOK" ); 208 "X-Gender", "KADDRESSBOOK" );
208 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 209 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
209 "X-Children", "KADDRESSBOOK" ); 210 "X-Children", "KADDRESSBOOK" );
210 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 211 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
211 "X-FreeBusyUrl", "KADDRESSBOOK" ); 212 "X-FreeBusyUrl", "KADDRESSBOOK" );
212#endif 213#endif
213 initGUI(); 214 initGUI();
214 215
215 mIncSearchWidget->setFocus(); 216 mIncSearchWidget->setFocus();
216 217
217 218
218 connect( mViewManager, SIGNAL( selected( const QString& ) ), 219 connect( mViewManager, SIGNAL( selected( const QString& ) ),
219 SLOT( setContactSelected( const QString& ) ) ); 220 SLOT( setContactSelected( const QString& ) ) );
220 connect( mViewManager, SIGNAL( executed( const QString& ) ), 221 connect( mViewManager, SIGNAL( executed( const QString& ) ),
221 SLOT( executeContact( const QString& ) ) ); 222 SLOT( executeContact( const QString& ) ) );
222 223
223 connect( mViewManager, SIGNAL( deleteRequest( ) ), 224 connect( mViewManager, SIGNAL( deleteRequest( ) ),
224 SLOT( deleteContacts( ) ) ); 225 SLOT( deleteContacts( ) ) );
225 connect( mViewManager, SIGNAL( modified() ), 226 connect( mViewManager, SIGNAL( modified() ),
226 SLOT( setModified() ) ); 227 SLOT( setModified() ) );
227 228
228 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 229 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
229 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 230 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
230 231
231 connect( mXXPortManager, SIGNAL( modified() ), 232 connect( mXXPortManager, SIGNAL( modified() ),
232 SLOT( setModified() ) ); 233 SLOT( setModified() ) );
233 234
234 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 235 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
235 SLOT( incrementalSearch( const QString& ) ) ); 236 SLOT( incrementalSearch( const QString& ) ) );
236 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 237 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
237 mJumpButtonBar, SLOT( recreateButtons() ) ); 238 mJumpButtonBar, SLOT( recreateButtons() ) );
238 239
239 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 240 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
240 SLOT( sendMail( const QString& ) ) ); 241 SLOT( sendMail( const QString& ) ) );
241 242
242 243
243 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 244 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
244 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 245 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
245 246
246 247
247#ifndef KAB_EMBEDDED 248#ifndef KAB_EMBEDDED
248 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 249 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
249 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 250 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
250 251
251 connect( mDetails, SIGNAL( browse( const QString& ) ), 252 connect( mDetails, SIGNAL( browse( const QString& ) ),
252 SLOT( browse( const QString& ) ) ); 253 SLOT( browse( const QString& ) ) );
253 254
254 255
255 mAddressBookService = new KAddressBookService( this ); 256 mAddressBookService = new KAddressBookService( this );
256 257
257#endif //KAB_EMBEDDED 258#endif //KAB_EMBEDDED
258 mEditorDialog = 0; 259 mEditorDialog = 0;
259 createAddresseeEditorDialog( this ); 260 createAddresseeEditorDialog( this );
260 setModified( false ); 261 setModified( false );
261} 262}
262 263
263KABCore::~KABCore() 264KABCore::~KABCore()
264{ 265{
265 // save(); 266 // save();
266 //saveSettings(); 267 //saveSettings();
267 //KABPrefs::instance()->writeConfig(); 268 //KABPrefs::instance()->writeConfig();
268 delete AddresseeConfig::instance(); 269 delete AddresseeConfig::instance();
269 mAddressBook = 0; 270 mAddressBook = 0;
270 KABC::StdAddressBook::close(); 271 KABC::StdAddressBook::close();
271} 272}
272 273
273void KABCore::restoreSettings() 274void KABCore::restoreSettings()
274{ 275{
275 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 276 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
276 277
277 bool state; 278 bool state;
278 279
279 if (mMultipleViewsAtOnce) 280 if (mMultipleViewsAtOnce)
280 state = KABPrefs::instance()->mDetailsPageVisible; 281 state = KABPrefs::instance()->mDetailsPageVisible;
281 else 282 else
282 state = false; 283 state = false;
283 284
284 mActionDetails->setChecked( state ); 285 mActionDetails->setChecked( state );
285 setDetailsVisible( state ); 286 setDetailsVisible( state );
286 287
287 state = KABPrefs::instance()->mJumpButtonBarVisible; 288 state = KABPrefs::instance()->mJumpButtonBarVisible;
288 289
289 mActionJumpBar->setChecked( state ); 290 mActionJumpBar->setChecked( state );
290 setJumpButtonBarVisible( state ); 291 setJumpButtonBarVisible( state );
291/*US 292/*US
292 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 293 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
293 if ( splitterSize.count() == 0 ) { 294 if ( splitterSize.count() == 0 ) {
294 splitterSize.append( width() / 2 ); 295 splitterSize.append( width() / 2 );
295 splitterSize.append( width() / 2 ); 296 splitterSize.append( width() / 2 );
296 } 297 }
297 mMiniSplitter->setSizes( splitterSize ); 298 mMiniSplitter->setSizes( splitterSize );
298 if ( mExtensionBarSplitter ) { 299 if ( mExtensionBarSplitter ) {
299 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 300 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
300 if ( splitterSize.count() == 0 ) { 301 if ( splitterSize.count() == 0 ) {
301 splitterSize.append( width() / 2 ); 302 splitterSize.append( width() / 2 );
302 splitterSize.append( width() / 2 ); 303 splitterSize.append( width() / 2 );
303 } 304 }
304 mExtensionBarSplitter->setSizes( splitterSize ); 305 mExtensionBarSplitter->setSizes( splitterSize );
305 306
306 } 307 }
307*/ 308*/
308 mViewManager->restoreSettings(); 309 mViewManager->restoreSettings();
309 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 310 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
310 mExtensionManager->restoreSettings(); 311 mExtensionManager->restoreSettings();
311#ifdef DESKTOP_VERSION 312#ifdef DESKTOP_VERSION
312 int wid = width(); 313 int wid = width();
313 if ( wid < 10 ) 314 if ( wid < 10 )
314 wid = 400; 315 wid = 400;
315#else 316#else
316 int wid = QApplication::desktop()->width(); 317 int wid = QApplication::desktop()->width();
317 if ( wid < 640 ) 318 if ( wid < 640 )
318 wid = QApplication::desktop()->height(); 319 wid = QApplication::desktop()->height();
319#endif 320#endif
320 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 321 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
321 if ( true /*splitterSize.count() == 0*/ ) { 322 if ( true /*splitterSize.count() == 0*/ ) {
322 splitterSize.append( wid / 2 ); 323 splitterSize.append( wid / 2 );
323 splitterSize.append( wid / 2 ); 324 splitterSize.append( wid / 2 );
324 } 325 }
325 mMiniSplitter->setSizes( splitterSize ); 326 mMiniSplitter->setSizes( splitterSize );
326 if ( mExtensionBarSplitter ) { 327 if ( mExtensionBarSplitter ) {
327 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 328 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
328 if ( true /*splitterSize.count() == 0*/ ) { 329 if ( true /*splitterSize.count() == 0*/ ) {
329 splitterSize.append( wid / 2 ); 330 splitterSize.append( wid / 2 );
330 splitterSize.append( wid / 2 ); 331 splitterSize.append( wid / 2 );
331 } 332 }
332 mExtensionBarSplitter->setSizes( splitterSize ); 333 mExtensionBarSplitter->setSizes( splitterSize );
333 334
334 } 335 }
335 336
336 337
337} 338}
338 339
339void KABCore::saveSettings() 340void KABCore::saveSettings()
340{ 341{
341 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 342 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
342 if ( mExtensionBarSplitter ) 343 if ( mExtensionBarSplitter )
343 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 344 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
344 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 345 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
345 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 346 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
346#ifndef KAB_EMBEDDED 347#ifndef KAB_EMBEDDED
347 348
348 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 349 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
349 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 350 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
350#endif //KAB_EMBEDDED 351#endif //KAB_EMBEDDED
351 mExtensionManager->saveSettings(); 352 mExtensionManager->saveSettings();
352 mViewManager->saveSettings(); 353 mViewManager->saveSettings();
353 354
354 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 355 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
355} 356}
356 357
357KABC::AddressBook *KABCore::addressBook() const 358KABC::AddressBook *KABCore::addressBook() const
358{ 359{
359 return mAddressBook; 360 return mAddressBook;
360} 361}
361 362
362KConfig *KABCore::config() 363KConfig *KABCore::config()
363{ 364{
364#ifndef KAB_EMBEDDED 365#ifndef KAB_EMBEDDED
365 return KABPrefs::instance()->config(); 366 return KABPrefs::instance()->config();
366#else //KAB_EMBEDDED 367#else //KAB_EMBEDDED
367 return KABPrefs::instance()->getConfig(); 368 return KABPrefs::instance()->getConfig();
368#endif //KAB_EMBEDDED 369#endif //KAB_EMBEDDED
369} 370}
370 371
371KActionCollection *KABCore::actionCollection() const 372KActionCollection *KABCore::actionCollection() const
372{ 373{
373 return mGUIClient->actionCollection(); 374 return mGUIClient->actionCollection();
374} 375}
375 376
376KABC::Field *KABCore::currentSearchField() const 377KABC::Field *KABCore::currentSearchField() const
377{ 378{
378 if (mIncSearchWidget) 379 if (mIncSearchWidget)
379 return mIncSearchWidget->currentField(); 380 return mIncSearchWidget->currentField();
380 else 381 else
381 return 0; 382 return 0;
382} 383}
383 384
384QStringList KABCore::selectedUIDs() const 385QStringList KABCore::selectedUIDs() const
385{ 386{
386 return mViewManager->selectedUids(); 387 return mViewManager->selectedUids();
387} 388}
388 389
389KABC::Resource *KABCore::requestResource( QWidget *parent ) 390KABC::Resource *KABCore::requestResource( QWidget *parent )
390{ 391{
391 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 392 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
392 393
393 QPtrList<KRES::Resource> kresResources; 394 QPtrList<KRES::Resource> kresResources;
394 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 395 QPtrListIterator<KABC::Resource> resIt( kabcResources );
395 KABC::Resource *resource; 396 KABC::Resource *resource;
396 while ( ( resource = resIt.current() ) != 0 ) { 397 while ( ( resource = resIt.current() ) != 0 ) {
397 ++resIt; 398 ++resIt;
398 if ( !resource->readOnly() ) { 399 if ( !resource->readOnly() ) {
399 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 400 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
400 if ( res ) 401 if ( res )
401 kresResources.append( res ); 402 kresResources.append( res );
402 } 403 }
403 } 404 }
404 405
405 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 406 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
406 return static_cast<KABC::Resource*>( res ); 407 return static_cast<KABC::Resource*>( res );
407} 408}
408 409
409#ifndef KAB_EMBEDDED 410#ifndef KAB_EMBEDDED
410KAboutData *KABCore::createAboutData() 411KAboutData *KABCore::createAboutData()
411#else //KAB_EMBEDDED 412#else //KAB_EMBEDDED
412void KABCore::createAboutData() 413void KABCore::createAboutData()
413#endif //KAB_EMBEDDED 414#endif //KAB_EMBEDDED
414{ 415{
415#ifndef KAB_EMBEDDED 416#ifndef KAB_EMBEDDED
416 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 417 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
417 "3.1", I18N_NOOP( "The KDE Address Book" ), 418 "3.1", I18N_NOOP( "The KDE Address Book" ),
418 KAboutData::License_GPL_V2, 419 KAboutData::License_GPL_V2,
419 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 420 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
420 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 421 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
421 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 422 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
422 about->addAuthor( "Cornelius Schumacher", 423 about->addAuthor( "Cornelius Schumacher",
423 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 424 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
424 "schumacher@kde.org" ); 425 "schumacher@kde.org" );
425 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 426 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
426 "mpilone@slac.com" ); 427 "mpilone@slac.com" );
427 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 428 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
428 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 429 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
429 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 430 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
430 "michel@klaralvdalens-datakonsult.se" ); 431 "michel@klaralvdalens-datakonsult.se" );
431 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 432 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
432 "hansen@kde.org" ); 433 "hansen@kde.org" );
433 434
434 return about; 435 return about;
435#endif //KAB_EMBEDDED 436#endif //KAB_EMBEDDED
436 437
437 QString version; 438 QString version;
438#include <../version> 439#include <../version>
439 QMessageBox::about( this, "About KAddressbook/Pi", 440 QMessageBox::about( this, "About KAddressbook/Pi",
440 "KAddressbook/Platform-independent\n" 441 "KAddressbook/Platform-independent\n"
441 "(KA/Pi) " +version + " - " + 442 "(KA/Pi) " +version + " - " +
442#ifdef DESKTOP_VERSION 443#ifdef DESKTOP_VERSION
443 "Desktop Edition\n" 444 "Desktop Edition\n"
444#else 445#else
445 "PDA-Edition\n" 446 "PDA-Edition\n"
446 "for: Zaurus 5500 / 7x0 / 8x0\n" 447 "for: Zaurus 5500 / 7x0 / 8x0\n"
447#endif 448#endif
448 449
449 "(c) 2004 Ulf Schenk\n" 450 "(c) 2004 Ulf Schenk\n"
450 "(c) 2004 Lutz Rogowski\n" 451 "(c) 2004 Lutz Rogowski\n"
451 "(c) 1997-2003, The KDE PIM Team\n" 452 "(c) 1997-2003, The KDE PIM Team\n"
452 "Tobias Koenig Current maintainer\ntokoe@kde.org\n" 453 "Tobias Koenig Current maintainer\ntokoe@kde.org\n"
453 "Don Sanders Original author\n" 454 "Don Sanders Original author\n"
454 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n" 455 "Cornelius Schumacher Co-maintainer\nschumacher@kde.org\n"
455 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n" 456 "Mike Pilone GUI and framework redesign\nmpilone@slac.com\n"
456 "Greg Stern DCOP interface\n" 457 "Greg Stern DCOP interface\n"
457 "Mark Westcot Contact pinning\n" 458 "Mark Westcot Contact pinning\n"
458 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n" 459 "Michel Boyer de la Giroday LDAP Lookup\n" "michel@klaralvdalens-datakonsult.se\n"
459 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n" 460 "Steffen Hansen LDAP Lookup\nhansen@kde.org\n"
460#ifdef _WIN32_ 461#ifdef _WIN32_
461 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n" 462 "(c) 2004 Lutz Rogowski Import from OL\nrogowski@kde.org\n"
462#endif 463#endif
463 ); 464 );
464} 465}
465 466
466void KABCore::setContactSelected( const QString &uid ) 467void KABCore::setContactSelected( const QString &uid )
467{ 468{
468 KABC::Addressee addr = mAddressBook->findByUid( uid ); 469 KABC::Addressee addr = mAddressBook->findByUid( uid );
469 if ( !mDetails->isHidden() ) 470 if ( !mDetails->isHidden() )
470 mDetails->setAddressee( addr ); 471 mDetails->setAddressee( addr );
471 472
472 if ( !addr.isEmpty() ) { 473 if ( !addr.isEmpty() ) {
473 emit contactSelected( addr.formattedName() ); 474 emit contactSelected( addr.formattedName() );
474 KABC::Picture pic = addr.photo(); 475 KABC::Picture pic = addr.photo();
475 if ( pic.isIntern() ) { 476 if ( pic.isIntern() ) {
476//US emit contactSelected( pic.data() ); 477//US emit contactSelected( pic.data() );
477//US instead use: 478//US instead use:
478 QPixmap px; 479 QPixmap px;
479 if (pic.data().isNull() != true) 480 if (pic.data().isNull() != true)
480 { 481 {
481 px.convertFromImage(pic.data()); 482 px.convertFromImage(pic.data());
482 } 483 }
483 484
484 emit contactSelected( px ); 485 emit contactSelected( px );
485 } 486 }
486 } 487 }
487 488
488 489
489 mExtensionManager->setSelectionChanged(); 490 mExtensionManager->setSelectionChanged();
490 491
491 // update the actions 492 // update the actions
492 bool selected = !uid.isEmpty(); 493 bool selected = !uid.isEmpty();
493 494
494 if ( mReadWrite ) { 495 if ( mReadWrite ) {
495 mActionCut->setEnabled( selected ); 496 mActionCut->setEnabled( selected );
496 mActionPaste->setEnabled( selected ); 497 mActionPaste->setEnabled( selected );
497 } 498 }
498 499
499 mActionCopy->setEnabled( selected ); 500 mActionCopy->setEnabled( selected );
500 mActionDelete->setEnabled( selected ); 501 mActionDelete->setEnabled( selected );
501 mActionEditAddressee->setEnabled( selected ); 502 mActionEditAddressee->setEnabled( selected );
502 mActionMail->setEnabled( selected ); 503 mActionMail->setEnabled( selected );
503 mActionMailVCard->setEnabled( selected ); 504 mActionMailVCard->setEnabled( selected );
504 //if (mActionBeam) 505 //if (mActionBeam)
505 //mActionBeam->setEnabled( selected ); 506 //mActionBeam->setEnabled( selected );
506 507
507 if (mActionBeamVCard) 508 if (mActionBeamVCard)
508 mActionBeamVCard->setEnabled( selected ); 509 mActionBeamVCard->setEnabled( selected );
509 510
510 mActionWhoAmI->setEnabled( selected ); 511 mActionWhoAmI->setEnabled( selected );
511 mActionCategories->setEnabled( selected ); 512 mActionCategories->setEnabled( selected );
512} 513}
513 514
514void KABCore::sendMail() 515void KABCore::sendMail()
515{ 516{
516 sendMail( mViewManager->selectedEmails().join( ", " ) ); 517 sendMail( mViewManager->selectedEmails().join( ", " ) );
517} 518}
518 519
519void KABCore::sendMail( const QString& emaillist ) 520void KABCore::sendMail( const QString& emaillist )
520{ 521{
521 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " 522 // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... "
522 if (emaillist.contains(",") > 0) 523 if (emaillist.contains(",") > 0)
523 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); 524 ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null );
524 else 525 else
525 ExternalAppHandler::instance()->mailToOneContact( emaillist ); 526 ExternalAppHandler::instance()->mailToOneContact( emaillist );
526} 527}
527 528
528 529
529 530
530void KABCore::mailVCard() 531void KABCore::mailVCard()
531{ 532{
532 QStringList uids = mViewManager->selectedUids(); 533 QStringList uids = mViewManager->selectedUids();
533 if ( !uids.isEmpty() ) 534 if ( !uids.isEmpty() )
534 mailVCard( uids ); 535 mailVCard( uids );
535} 536}
536 537
537void KABCore::mailVCard( const QStringList& uids ) 538void KABCore::mailVCard( const QStringList& uids )
538{ 539{
539 QStringList urls; 540 QStringList urls;
540 541
541// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 542// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
542 543
543 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 544 QString dirName = "/tmp/" + KApplication::randomString( 8 );
544 545
545 546
546 547
547 QDir().mkdir( dirName, true ); 548 QDir().mkdir( dirName, true );
548 549
549 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 550 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
550 KABC::Addressee a = mAddressBook->findByUid( *it ); 551 KABC::Addressee a = mAddressBook->findByUid( *it );
551 552
552 if ( a.isEmpty() ) 553 if ( a.isEmpty() )