summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp69
-rw-r--r--kaddressbook/kabcore.h1
2 files changed, 70 insertions, 0 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 9041e45..d9eb391 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -104,384 +104,385 @@ $Id$
104#ifndef DESKTOP_VERSION 104#ifndef DESKTOP_VERSION
105#include <qpe/ir.h> 105#include <qpe/ir.h>
106#include <qpe/qpemenubar.h> 106#include <qpe/qpemenubar.h>
107#include <qtopia/qcopenvelope_qws.h> 107#include <qtopia/qcopenvelope_qws.h>
108#else 108#else
109 109
110#include <qmenubar.h> 110#include <qmenubar.h>
111#endif 111#endif
112 112
113#endif // KAB_EMBEDDED 113#endif // KAB_EMBEDDED
114#include "kcmconfigs/kcmkabconfig.h" 114#include "kcmconfigs/kcmkabconfig.h"
115#include "kcmconfigs/kcmkdepimconfig.h" 115#include "kcmconfigs/kcmkdepimconfig.h"
116#include "kpimglobalprefs.h" 116#include "kpimglobalprefs.h"
117#include "externalapphandler.h" 117#include "externalapphandler.h"
118 118
119 119
120#include <kresources/selectdialog.h> 120#include <kresources/selectdialog.h>
121#include <kmessagebox.h> 121#include <kmessagebox.h>
122 122
123#include <picture.h> 123#include <picture.h>
124#include <resource.h> 124#include <resource.h>
125 125
126//US#include <qsplitter.h> 126//US#include <qsplitter.h>
127#include <qmap.h> 127#include <qmap.h>
128#include <qdir.h> 128#include <qdir.h>
129#include <qfile.h> 129#include <qfile.h>
130#include <qvbox.h> 130#include <qvbox.h>
131#include <qlayout.h> 131#include <qlayout.h>
132#include <qclipboard.h> 132#include <qclipboard.h>
133#include <qtextstream.h> 133#include <qtextstream.h>
134 134
135#include <libkdepim/categoryselectdialog.h> 135#include <libkdepim/categoryselectdialog.h>
136#include <kabc/vcardconverter.h> 136#include <kabc/vcardconverter.h>
137 137
138 138
139#include "addresseeutil.h" 139#include "addresseeutil.h"
140#include "undocmds.h" 140#include "undocmds.h"
141#include "addresseeeditordialog.h" 141#include "addresseeeditordialog.h"
142#include "viewmanager.h" 142#include "viewmanager.h"
143#include "details/detailsviewcontainer.h" 143#include "details/detailsviewcontainer.h"
144#include "kabprefs.h" 144#include "kabprefs.h"
145#include "xxportmanager.h" 145#include "xxportmanager.h"
146#include "incsearchwidget.h" 146#include "incsearchwidget.h"
147#include "jumpbuttonbar.h" 147#include "jumpbuttonbar.h"
148#include "extensionmanager.h" 148#include "extensionmanager.h"
149#include "addresseeconfig.h" 149#include "addresseeconfig.h"
150#include <kcmultidialog.h> 150#include <kcmultidialog.h>
151 151
152#ifdef _WIN32_ 152#ifdef _WIN32_
153 153
154#include "kaimportoldialog.h" 154#include "kaimportoldialog.h"
155#else 155#else
156#include <unistd.h> 156#include <unistd.h>
157#endif 157#endif
158// sync includes 158// sync includes
159#include <libkdepim/ksyncprofile.h> 159#include <libkdepim/ksyncprofile.h>
160#include <libkdepim/ksyncprefsdialog.h> 160#include <libkdepim/ksyncprefsdialog.h>
161 161
162class KAex2phonePrefs : public QDialog 162class KAex2phonePrefs : public QDialog
163{ 163{
164 public: 164 public:
165 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 165 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
166 QDialog( parent, name, true ) 166 QDialog( parent, name, true )
167 { 167 {
168 setCaption( i18n("Export to phone options") ); 168 setCaption( i18n("Export to phone options") );
169 QVBoxLayout* lay = new QVBoxLayout( this ); 169 QVBoxLayout* lay = new QVBoxLayout( this );
170 lay->setSpacing( 3 ); 170 lay->setSpacing( 3 );
171 lay->setMargin( 3 ); 171 lay->setMargin( 3 );
172 QLabel *lab; 172 QLabel *lab;
173 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 173 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
174 lab->setAlignment (AlignHCenter ); 174 lab->setAlignment (AlignHCenter );
175 QHBox* temphb; 175 QHBox* temphb;
176 temphb = new QHBox( this ); 176 temphb = new QHBox( this );
177 new QLabel( i18n("I/O device: "), temphb ); 177 new QLabel( i18n("I/O device: "), temphb );
178 mPhoneDevice = new QLineEdit( temphb); 178 mPhoneDevice = new QLineEdit( temphb);
179 lay->addWidget( temphb ); 179 lay->addWidget( temphb );
180 temphb = new QHBox( this ); 180 temphb = new QHBox( this );
181 new QLabel( i18n("Connection: "), temphb ); 181 new QLabel( i18n("Connection: "), temphb );
182 mPhoneConnection = new QLineEdit( temphb); 182 mPhoneConnection = new QLineEdit( temphb);
183 lay->addWidget( temphb ); 183 lay->addWidget( temphb );
184 temphb = new QHBox( this ); 184 temphb = new QHBox( this );
185 new QLabel( i18n("Model(opt.): "), temphb ); 185 new QLabel( i18n("Model(opt.): "), temphb );
186 mPhoneModel = new QLineEdit( temphb); 186 mPhoneModel = new QLineEdit( temphb);
187 lay->addWidget( temphb ); 187 lay->addWidget( temphb );
188 mWriteToSim= new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 188 mWriteToSim= new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
189 lay->addWidget( mWriteToSim ); 189 lay->addWidget( mWriteToSim );
190 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 190 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
191 lab->setAlignment (AlignHCenter ); 191 lab->setAlignment (AlignHCenter );
192 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 192 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
193 lay->addWidget( ok ); 193 lay->addWidget( ok );
194 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 194 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
195 lay->addWidget( cancel ); 195 lay->addWidget( cancel );
196 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 196 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
197 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 197 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
198 resize( 220, 240 ); 198 resize( 220, 240 );
199 199
200 } 200 }
201 201
202public: 202public:
203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 203 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
204 QCheckBox* mWriteToSim; 204 QCheckBox* mWriteToSim;
205}; 205};
206 206
207bool pasteWithNewUid = true; 207bool pasteWithNewUid = true;
208 208
209#ifdef KAB_EMBEDDED 209#ifdef KAB_EMBEDDED
210KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 210KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
211 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 211 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
212 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 212 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
213 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 213 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
214#else //KAB_EMBEDDED 214#else //KAB_EMBEDDED
215KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 215KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
216 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 216 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
217 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 217 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
218 mReadWrite( readWrite ), mModified( false ) 218 mReadWrite( readWrite ), mModified( false )
219#endif //KAB_EMBEDDED 219#endif //KAB_EMBEDDED
220{ 220{
221 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 221 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
222 // syncManager->setBlockSave(false); 222 // syncManager->setBlockSave(false);
223 mExtensionBarSplitter = 0; 223 mExtensionBarSplitter = 0;
224 mIsPart = !parent->inherits( "KAddressBookMain" ); 224 mIsPart = !parent->inherits( "KAddressBookMain" );
225 225
226 mAddressBook = KABC::StdAddressBook::self(); 226 mAddressBook = KABC::StdAddressBook::self();
227 KABC::StdAddressBook::setAutomaticSave( false ); 227 KABC::StdAddressBook::setAutomaticSave( false );
228 228
229#ifndef KAB_EMBEDDED 229#ifndef KAB_EMBEDDED
230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 230 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
231#endif //KAB_EMBEDDED 231#endif //KAB_EMBEDDED
232 232
233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 233 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
234 SLOT( addressBookChanged() ) ); 234 SLOT( addressBookChanged() ) );
235 235
236#if 0 236#if 0
237 // LP moved to addressbook init method 237 // LP moved to addressbook init method
238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 238 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
239 "X-Department", "KADDRESSBOOK" ); 239 "X-Department", "KADDRESSBOOK" );
240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 240 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
241 "X-Profession", "KADDRESSBOOK" ); 241 "X-Profession", "KADDRESSBOOK" );
242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 242 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
243 "X-AssistantsName", "KADDRESSBOOK" ); 243 "X-AssistantsName", "KADDRESSBOOK" );
244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 244 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
245 "X-ManagersName", "KADDRESSBOOK" ); 245 "X-ManagersName", "KADDRESSBOOK" );
246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 246 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
247 "X-SpousesName", "KADDRESSBOOK" ); 247 "X-SpousesName", "KADDRESSBOOK" );
248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 248 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
249 "X-Office", "KADDRESSBOOK" ); 249 "X-Office", "KADDRESSBOOK" );
250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 250 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
251 "X-IMAddress", "KADDRESSBOOK" ); 251 "X-IMAddress", "KADDRESSBOOK" );
252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 252 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
253 "X-Anniversary", "KADDRESSBOOK" ); 253 "X-Anniversary", "KADDRESSBOOK" );
254 254
255 //US added this field to become compatible with Opie/qtopia addressbook 255 //US added this field to become compatible with Opie/qtopia addressbook
256 // values can be "female" or "male" or "". An empty field represents undefined. 256 // values can be "female" or "male" or "". An empty field represents undefined.
257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 257 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
258 "X-Gender", "KADDRESSBOOK" ); 258 "X-Gender", "KADDRESSBOOK" );
259 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 259 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
260 "X-Children", "KADDRESSBOOK" ); 260 "X-Children", "KADDRESSBOOK" );
261 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 261 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
262 "X-FreeBusyUrl", "KADDRESSBOOK" ); 262 "X-FreeBusyUrl", "KADDRESSBOOK" );
263#endif 263#endif
264 initGUI(); 264 initGUI();
265 265
266 mIncSearchWidget->setFocus(); 266 mIncSearchWidget->setFocus();
267 267
268 268
269 connect( mViewManager, SIGNAL( selected( const QString& ) ), 269 connect( mViewManager, SIGNAL( selected( const QString& ) ),
270 SLOT( setContactSelected( const QString& ) ) ); 270 SLOT( setContactSelected( const QString& ) ) );
271 connect( mViewManager, SIGNAL( executed( const QString& ) ), 271 connect( mViewManager, SIGNAL( executed( const QString& ) ),
272 SLOT( executeContact( const QString& ) ) ); 272 SLOT( executeContact( const QString& ) ) );
273 273
274 connect( mViewManager, SIGNAL( deleteRequest( ) ), 274 connect( mViewManager, SIGNAL( deleteRequest( ) ),
275 SLOT( deleteContacts( ) ) ); 275 SLOT( deleteContacts( ) ) );
276 connect( mViewManager, SIGNAL( modified() ), 276 connect( mViewManager, SIGNAL( modified() ),
277 SLOT( setModified() ) ); 277 SLOT( setModified() ) );
278 278
279 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 279 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
281 281
282 connect( mXXPortManager, SIGNAL( modified() ), 282 connect( mXXPortManager, SIGNAL( modified() ),
283 SLOT( setModified() ) ); 283 SLOT( setModified() ) );
284 284
285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
286 SLOT( incrementalSearch( const QString& ) ) ); 286 SLOT( incrementalSearch( const QString& ) ) );
287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
288 mJumpButtonBar, SLOT( recreateButtons() ) ); 288 mJumpButtonBar, SLOT( recreateButtons() ) );
289 289
290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
291 SLOT( sendMail( const QString& ) ) ); 291 SLOT( sendMail( const QString& ) ) );
292 292
293 293
294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
295 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&))); 295 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&)));
296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
296 297
297 298
298#ifndef KAB_EMBEDDED 299#ifndef KAB_EMBEDDED
299 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 300 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
300 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 301 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
301 302
302 connect( mDetails, SIGNAL( browse( const QString& ) ), 303 connect( mDetails, SIGNAL( browse( const QString& ) ),
303 SLOT( browse( const QString& ) ) ); 304 SLOT( browse( const QString& ) ) );
304 305
305 306
306 mAddressBookService = new KAddressBookService( this ); 307 mAddressBookService = new KAddressBookService( this );
307 308
308#endif //KAB_EMBEDDED 309#endif //KAB_EMBEDDED
309 mEditorDialog = 0; 310 mEditorDialog = 0;
310 createAddresseeEditorDialog( this ); 311 createAddresseeEditorDialog( this );
311 setModified( false ); 312 setModified( false );
312} 313}
313 314
314KABCore::~KABCore() 315KABCore::~KABCore()
315{ 316{
316 // save(); 317 // save();
317 //saveSettings(); 318 //saveSettings();
318 //KABPrefs::instance()->writeConfig(); 319 //KABPrefs::instance()->writeConfig();
319 delete AddresseeConfig::instance(); 320 delete AddresseeConfig::instance();
320 mAddressBook = 0; 321 mAddressBook = 0;
321 KABC::StdAddressBook::close(); 322 KABC::StdAddressBook::close();
322 323
323 delete syncManager; 324 delete syncManager;
324} 325}
325 326
326void KABCore::restoreSettings() 327void KABCore::restoreSettings()
327{ 328{
328 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 329 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
329 330
330 bool state; 331 bool state;
331 332
332 if (mMultipleViewsAtOnce) 333 if (mMultipleViewsAtOnce)
333 state = KABPrefs::instance()->mDetailsPageVisible; 334 state = KABPrefs::instance()->mDetailsPageVisible;
334 else 335 else
335 state = false; 336 state = false;
336 337
337 mActionDetails->setChecked( state ); 338 mActionDetails->setChecked( state );
338 setDetailsVisible( state ); 339 setDetailsVisible( state );
339 340
340 state = KABPrefs::instance()->mJumpButtonBarVisible; 341 state = KABPrefs::instance()->mJumpButtonBarVisible;
341 342
342 mActionJumpBar->setChecked( state ); 343 mActionJumpBar->setChecked( state );
343 setJumpButtonBarVisible( state ); 344 setJumpButtonBarVisible( state );
344/*US 345/*US
345 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 346 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
346 if ( splitterSize.count() == 0 ) { 347 if ( splitterSize.count() == 0 ) {
347 splitterSize.append( width() / 2 ); 348 splitterSize.append( width() / 2 );
348 splitterSize.append( width() / 2 ); 349 splitterSize.append( width() / 2 );
349 } 350 }
350 mMiniSplitter->setSizes( splitterSize ); 351 mMiniSplitter->setSizes( splitterSize );
351 if ( mExtensionBarSplitter ) { 352 if ( mExtensionBarSplitter ) {
352 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 353 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
353 if ( splitterSize.count() == 0 ) { 354 if ( splitterSize.count() == 0 ) {
354 splitterSize.append( width() / 2 ); 355 splitterSize.append( width() / 2 );
355 splitterSize.append( width() / 2 ); 356 splitterSize.append( width() / 2 );
356 } 357 }
357 mExtensionBarSplitter->setSizes( splitterSize ); 358 mExtensionBarSplitter->setSizes( splitterSize );
358 359
359 } 360 }
360*/ 361*/
361 mViewManager->restoreSettings(); 362 mViewManager->restoreSettings();
362 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 363 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
363 mExtensionManager->restoreSettings(); 364 mExtensionManager->restoreSettings();
364#ifdef DESKTOP_VERSION 365#ifdef DESKTOP_VERSION
365 int wid = width(); 366 int wid = width();
366 if ( wid < 10 ) 367 if ( wid < 10 )
367 wid = 400; 368 wid = 400;
368#else 369#else
369 int wid = QApplication::desktop()->width(); 370 int wid = QApplication::desktop()->width();
370 if ( wid < 640 ) 371 if ( wid < 640 )
371 wid = QApplication::desktop()->height(); 372 wid = QApplication::desktop()->height();
372#endif 373#endif
373 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 374 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
374 if ( true /*splitterSize.count() == 0*/ ) { 375 if ( true /*splitterSize.count() == 0*/ ) {
375 splitterSize.append( wid / 2 ); 376 splitterSize.append( wid / 2 );
376 splitterSize.append( wid / 2 ); 377 splitterSize.append( wid / 2 );
377 } 378 }
378 mMiniSplitter->setSizes( splitterSize ); 379 mMiniSplitter->setSizes( splitterSize );
379 if ( mExtensionBarSplitter ) { 380 if ( mExtensionBarSplitter ) {
380 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 381 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
381 if ( true /*splitterSize.count() == 0*/ ) { 382 if ( true /*splitterSize.count() == 0*/ ) {
382 splitterSize.append( wid / 2 ); 383 splitterSize.append( wid / 2 );
383 splitterSize.append( wid / 2 ); 384 splitterSize.append( wid / 2 );
384 } 385 }
385 mExtensionBarSplitter->setSizes( splitterSize ); 386 mExtensionBarSplitter->setSizes( splitterSize );
386 387
387 } 388 }
388 389
389 390
390} 391}
391 392
392void KABCore::saveSettings() 393void KABCore::saveSettings()
393{ 394{
394 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 395 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
395 if ( mExtensionBarSplitter ) 396 if ( mExtensionBarSplitter )
396 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 397 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
397 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 398 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
398 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 399 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
399#ifndef KAB_EMBEDDED 400#ifndef KAB_EMBEDDED
400 401
401 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 402 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
402 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 403 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
403#endif //KAB_EMBEDDED 404#endif //KAB_EMBEDDED
404 mExtensionManager->saveSettings(); 405 mExtensionManager->saveSettings();
405 mViewManager->saveSettings(); 406 mViewManager->saveSettings();
406 407
407 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 408 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
408} 409}
409 410
410KABC::AddressBook *KABCore::addressBook() const 411KABC::AddressBook *KABCore::addressBook() const
411{ 412{
412 return mAddressBook; 413 return mAddressBook;
413} 414}
414 415
415KConfig *KABCore::config() 416KConfig *KABCore::config()
416{ 417{
417#ifndef KAB_EMBEDDED 418#ifndef KAB_EMBEDDED
418 return KABPrefs::instance()->config(); 419 return KABPrefs::instance()->config();
419#else //KAB_EMBEDDED 420#else //KAB_EMBEDDED
420 return KABPrefs::instance()->getConfig(); 421 return KABPrefs::instance()->getConfig();
421#endif //KAB_EMBEDDED 422#endif //KAB_EMBEDDED
422} 423}
423 424
424KActionCollection *KABCore::actionCollection() const 425KActionCollection *KABCore::actionCollection() const
425{ 426{
426 return mGUIClient->actionCollection(); 427 return mGUIClient->actionCollection();
427} 428}
428 429
429KABC::Field *KABCore::currentSearchField() const 430KABC::Field *KABCore::currentSearchField() const
430{ 431{
431 if (mIncSearchWidget) 432 if (mIncSearchWidget)
432 return mIncSearchWidget->currentField(); 433 return mIncSearchWidget->currentField();
433 else 434 else
434 return 0; 435 return 0;
435} 436}
436 437
437QStringList KABCore::selectedUIDs() const 438QStringList KABCore::selectedUIDs() const
438{ 439{
439 return mViewManager->selectedUids(); 440 return mViewManager->selectedUids();
440} 441}
441 442
442KABC::Resource *KABCore::requestResource( QWidget *parent ) 443KABC::Resource *KABCore::requestResource( QWidget *parent )
443{ 444{
444 QPtrList<KABC::Resource> kabcResources = addressBook()->resources(); 445 QPtrList<KABC::Resource> kabcResources = addressBook()->resources();
445 446
446 QPtrList<KRES::Resource> kresResources; 447 QPtrList<KRES::Resource> kresResources;
447 QPtrListIterator<KABC::Resource> resIt( kabcResources ); 448 QPtrListIterator<KABC::Resource> resIt( kabcResources );
448 KABC::Resource *resource; 449 KABC::Resource *resource;
449 while ( ( resource = resIt.current() ) != 0 ) { 450 while ( ( resource = resIt.current() ) != 0 ) {
450 ++resIt; 451 ++resIt;
451 if ( !resource->readOnly() ) { 452 if ( !resource->readOnly() ) {
452 KRES::Resource *res = static_cast<KRES::Resource*>( resource ); 453 KRES::Resource *res = static_cast<KRES::Resource*>( resource );
453 if ( res ) 454 if ( res )
454 kresResources.append( res ); 455 kresResources.append( res );
455 } 456 }
456 } 457 }
457 458
458 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent ); 459 KRES::Resource *res = KRES::SelectDialog::getResource( kresResources, parent );
459 return static_cast<KABC::Resource*>( res ); 460 return static_cast<KABC::Resource*>( res );
460} 461}
461 462
462#ifndef KAB_EMBEDDED 463#ifndef KAB_EMBEDDED
463KAboutData *KABCore::createAboutData() 464KAboutData *KABCore::createAboutData()
464#else //KAB_EMBEDDED 465#else //KAB_EMBEDDED
465void KABCore::createAboutData() 466void KABCore::createAboutData()
466#endif //KAB_EMBEDDED 467#endif //KAB_EMBEDDED
467{ 468{
468#ifndef KAB_EMBEDDED 469#ifndef KAB_EMBEDDED
469 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ), 470 KAboutData *about = new KAboutData( "kaddressbook", I18N_NOOP( "KAddressBook" ),
470 "3.1", I18N_NOOP( "The KDE Address Book" ), 471 "3.1", I18N_NOOP( "The KDE Address Book" ),
471 KAboutData::License_GPL_V2, 472 KAboutData::License_GPL_V2,
472 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) ); 473 I18N_NOOP( "(c) 1997-2003, The KDE PIM Team" ) );
473 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" ); 474 about->addAuthor( "Tobias Koenig", I18N_NOOP( "Current maintainer " ), "tokoe@kde.org" );
474 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) ); 475 about->addAuthor( "Don Sanders", I18N_NOOP( "Original author " ) );
475 about->addAuthor( "Cornelius Schumacher", 476 about->addAuthor( "Cornelius Schumacher",
476 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ), 477 I18N_NOOP( "Co-maintainer, libkabc port, CSV import/export " ),
477 "schumacher@kde.org" ); 478 "schumacher@kde.org" );
478 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ), 479 about->addAuthor( "Mike Pilone", I18N_NOOP( "GUI and framework redesign " ),
479 "mpilone@slac.com" ); 480 "mpilone@slac.com" );
480 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) ); 481 about->addAuthor( "Greg Stern", I18N_NOOP( "DCOP interface" ) );
481 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) ); 482 about->addAuthor( "Mark Westcott", I18N_NOOP( "Contact pinning" ) );
482 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ), 483 about->addAuthor( "Michel Boyer de la Giroday", I18N_NOOP( "LDAP Lookup\n" ),
483 "michel@klaralvdalens-datakonsult.se" ); 484 "michel@klaralvdalens-datakonsult.se" );
484 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ), 485 about->addAuthor( "Steffen Hansen", I18N_NOOP( "LDAP Lookup " ),
485 "hansen@kde.org" ); 486 "hansen@kde.org" );
486 487
487 return about; 488 return about;
@@ -1966,384 +1967,452 @@ void KABCore::addActionsManually()
1966 fileMenu->insertItem( "&Export", ExportMenu ); 1967 fileMenu->insertItem( "&Export", ExportMenu );
1967 fileMenu->insertSeparator(); 1968 fileMenu->insertSeparator();
1968 mActionMailVCard->plug( fileMenu ); 1969 mActionMailVCard->plug( fileMenu );
1969#ifndef DESKTOP_VERSION 1970#ifndef DESKTOP_VERSION
1970 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu ); 1971 if ( Ir::supported() ) mActionBeamVCard->plug( fileMenu );
1971 if ( Ir::supported() ) mActionBeam->plug(fileMenu ); 1972 if ( Ir::supported() ) mActionBeam->plug(fileMenu );
1972#endif 1973#endif
1973 fileMenu->insertSeparator(); 1974 fileMenu->insertSeparator();
1974 mActionQuit->plug( fileMenu ); 1975 mActionQuit->plug( fileMenu );
1975#ifdef _WIN32_ 1976#ifdef _WIN32_
1976 mActionImportOL->plug( ImportMenu ); 1977 mActionImportOL->plug( ImportMenu );
1977#endif 1978#endif
1978 // edit menu 1979 // edit menu
1979 mActionUndo->plug( editMenu ); 1980 mActionUndo->plug( editMenu );
1980 mActionRedo->plug( editMenu ); 1981 mActionRedo->plug( editMenu );
1981 editMenu->insertSeparator(); 1982 editMenu->insertSeparator();
1982 mActionCut->plug( editMenu ); 1983 mActionCut->plug( editMenu );
1983 mActionCopy->plug( editMenu ); 1984 mActionCopy->plug( editMenu );
1984 mActionPaste->plug( editMenu ); 1985 mActionPaste->plug( editMenu );
1985 mActionDelete->plug( editMenu ); 1986 mActionDelete->plug( editMenu );
1986 editMenu->insertSeparator(); 1987 editMenu->insertSeparator();
1987 mActionSelectAll->plug( editMenu ); 1988 mActionSelectAll->plug( editMenu );
1988 1989
1989 mActionRemoveVoice->plug( changeMenu ); 1990 mActionRemoveVoice->plug( changeMenu );
1990 // settings menu 1991 // settings menu
1991//US special menuentry to configure the addressbook resources. On KDE 1992//US special menuentry to configure the addressbook resources. On KDE
1992// you do that through the control center !!! 1993// you do that through the control center !!!
1993 mActionConfigResources->plug( settingsMenu ); 1994 mActionConfigResources->plug( settingsMenu );
1994 settingsMenu->insertSeparator(); 1995 settingsMenu->insertSeparator();
1995 1996
1996 mActionConfigKAddressbook->plug( settingsMenu ); 1997 mActionConfigKAddressbook->plug( settingsMenu );
1997 1998
1998 if ( mIsPart ) { 1999 if ( mIsPart ) {
1999 mActionConfigShortcuts->plug( settingsMenu ); 2000 mActionConfigShortcuts->plug( settingsMenu );
2000 mActionConfigureToolbars->plug( settingsMenu ); 2001 mActionConfigureToolbars->plug( settingsMenu );
2001 2002
2002 } else { 2003 } else {
2003 mActionKeyBindings->plug( settingsMenu ); 2004 mActionKeyBindings->plug( settingsMenu );
2004 } 2005 }
2005 2006
2006 settingsMenu->insertSeparator(); 2007 settingsMenu->insertSeparator();
2007 2008
2008 mActionJumpBar->plug( settingsMenu ); 2009 mActionJumpBar->plug( settingsMenu );
2009 mActionDetails->plug( settingsMenu ); 2010 mActionDetails->plug( settingsMenu );
2010 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2011 if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2011 mActionDetails->plug( tb ); 2012 mActionDetails->plug( tb );
2012 settingsMenu->insertSeparator(); 2013 settingsMenu->insertSeparator();
2013 2014
2014 mActionWhoAmI->plug( settingsMenu ); 2015 mActionWhoAmI->plug( settingsMenu );
2015 mActionCategories->plug( settingsMenu ); 2016 mActionCategories->plug( settingsMenu );
2016 2017
2017 mActionLicence->plug( helpMenu ); 2018 mActionLicence->plug( helpMenu );
2018 mActionFaq->plug( helpMenu ); 2019 mActionFaq->plug( helpMenu );
2019 mActionAboutKAddressbook->plug( helpMenu ); 2020 mActionAboutKAddressbook->plug( helpMenu );
2020 2021
2021 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2022 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2022 2023
2023 mActionSave->plug( tb ); 2024 mActionSave->plug( tb );
2024 mViewManager->getFilterAction()->plug ( tb); 2025 mViewManager->getFilterAction()->plug ( tb);
2025 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 2026 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
2026 mActionUndo->plug( tb ); 2027 mActionUndo->plug( tb );
2027 mActionDelete->plug( tb ); 2028 mActionDelete->plug( tb );
2028 mActionRedo->plug( tb ); 2029 mActionRedo->plug( tb );
2029 } 2030 }
2030 } 2031 }
2031 //mActionQuit->plug ( tb ); 2032 //mActionQuit->plug ( tb );
2032 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2033 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2033 2034
2034 //US link the searchwidget first to this. 2035 //US link the searchwidget first to this.
2035 // The real linkage to the toolbar happens later. 2036 // The real linkage to the toolbar happens later.
2036//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2037//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2037//US tb->insertItem( mIncSearchWidget ); 2038//US tb->insertItem( mIncSearchWidget );
2038/*US 2039/*US
2039 mIncSearchWidget = new IncSearchWidget( tb ); 2040 mIncSearchWidget = new IncSearchWidget( tb );
2040 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2041 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2041 SLOT( incrementalSearch( const QString& ) ) ); 2042 SLOT( incrementalSearch( const QString& ) ) );
2042 2043
2043 mJumpButtonBar = new JumpButtonBar( this, this ); 2044 mJumpButtonBar = new JumpButtonBar( this, this );
2044 2045
2045//US topLayout->addWidget( mJumpButtonBar ); 2046//US topLayout->addWidget( mJumpButtonBar );
2046 this->layout()->add( mJumpButtonBar ); 2047 this->layout()->add( mJumpButtonBar );
2047*/ 2048*/
2048 2049
2049#endif //KAB_EMBEDDED 2050#endif //KAB_EMBEDDED
2050 2051
2051 mActionExport2phone->plug( ExportMenu ); 2052 mActionExport2phone->plug( ExportMenu );
2052 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2053 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2053 syncManager->fillSyncMenu(); 2054 syncManager->fillSyncMenu();
2054 2055
2055} 2056}
2056void KABCore::showLicence() 2057void KABCore::showLicence()
2057{ 2058{
2058 KApplication::showLicence(); 2059 KApplication::showLicence();
2059} 2060}
2060void KABCore::removeVoice() 2061void KABCore::removeVoice()
2061{ 2062{
2062 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2063 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
2063 return; 2064 return;
2064 KABC::Addressee::List list = mViewManager->selectedAddressees(); 2065 KABC::Addressee::List list = mViewManager->selectedAddressees();
2065 KABC::Addressee::List::Iterator it; 2066 KABC::Addressee::List::Iterator it;
2066 for ( it = list.begin(); it != list.end(); ++it ) { 2067 for ( it = list.begin(); it != list.end(); ++it ) {
2067 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 2068 PhoneNumber::List phoneNumbers = (*it).phoneNumbers();
2068 PhoneNumber::List::Iterator phoneIt; 2069 PhoneNumber::List::Iterator phoneIt;
2069 bool found = false; 2070 bool found = false;
2070 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { 2071 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
2071 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found 2072 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
2072 if ((*phoneIt).type() - PhoneNumber::Voice ) { 2073 if ((*phoneIt).type() - PhoneNumber::Voice ) {
2073 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); 2074 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
2074 (*it).insertPhoneNumber( (*phoneIt) ); 2075 (*it).insertPhoneNumber( (*phoneIt) );
2075 found = true; 2076 found = true;
2076 } 2077 }
2077 } 2078 }
2078 2079
2079 } 2080 }
2080 if ( found ) 2081 if ( found )
2081 contactModified((*it) ); 2082 contactModified((*it) );
2082 } 2083 }
2083} 2084}
2084 2085
2085 2086
2086 2087
2087void KABCore::clipboardDataChanged() 2088void KABCore::clipboardDataChanged()
2088{ 2089{
2089 2090
2090 if ( mReadWrite ) 2091 if ( mReadWrite )
2091 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2092 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2092 2093
2093} 2094}
2094 2095
2095void KABCore::updateActionMenu() 2096void KABCore::updateActionMenu()
2096{ 2097{
2097 UndoStack *undo = UndoStack::instance(); 2098 UndoStack *undo = UndoStack::instance();
2098 RedoStack *redo = RedoStack::instance(); 2099 RedoStack *redo = RedoStack::instance();
2099 2100
2100 if ( undo->isEmpty() ) 2101 if ( undo->isEmpty() )
2101 mActionUndo->setText( i18n( "Undo" ) ); 2102 mActionUndo->setText( i18n( "Undo" ) );
2102 else 2103 else
2103 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2104 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2104 2105
2105 mActionUndo->setEnabled( !undo->isEmpty() ); 2106 mActionUndo->setEnabled( !undo->isEmpty() );
2106 2107
2107 if ( !redo->top() ) 2108 if ( !redo->top() )
2108 mActionRedo->setText( i18n( "Redo" ) ); 2109 mActionRedo->setText( i18n( "Redo" ) );
2109 else 2110 else
2110 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2111 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2111 2112
2112 mActionRedo->setEnabled( !redo->isEmpty() ); 2113 mActionRedo->setEnabled( !redo->isEmpty() );
2113} 2114}
2114 2115
2115void KABCore::configureKeyBindings() 2116void KABCore::configureKeyBindings()
2116{ 2117{
2117#ifndef KAB_EMBEDDED 2118#ifndef KAB_EMBEDDED
2118 KKeyDialog::configure( actionCollection(), true ); 2119 KKeyDialog::configure( actionCollection(), true );
2119#else //KAB_EMBEDDED 2120#else //KAB_EMBEDDED
2120 qDebug("KABCore::configureKeyBindings() not implemented"); 2121 qDebug("KABCore::configureKeyBindings() not implemented");
2121#endif //KAB_EMBEDDED 2122#endif //KAB_EMBEDDED
2122} 2123}
2123 2124
2124#ifdef KAB_EMBEDDED 2125#ifdef KAB_EMBEDDED
2125void KABCore::configureResources() 2126void KABCore::configureResources()
2126{ 2127{
2127 KRES::KCMKResources dlg( this, "" , 0 ); 2128 KRES::KCMKResources dlg( this, "" , 0 );
2128 2129
2129 if ( !dlg.exec() ) 2130 if ( !dlg.exec() )
2130 return; 2131 return;
2131 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2132 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2132} 2133}
2133#endif //KAB_EMBEDDED 2134#endif //KAB_EMBEDDED
2134 2135
2135 2136
2136/* this method will be called through the QCop interface from Ko/Pi to select addresses 2137/* this method will be called through the QCop interface from Ko/Pi to select addresses
2137 * for the attendees list of an event. 2138 * for the attendees list of an event.
2138 */ 2139 */
2139void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2140void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2140{ 2141{
2141 QStringList nameList; 2142 QStringList nameList;
2142 QStringList emailList; 2143 QStringList emailList;
2143 QStringList uidList; 2144 QStringList uidList;
2144 2145
2145 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2146 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2146 uint i=0; 2147 uint i=0;
2147 for (i=0; i < list.count(); i++) 2148 for (i=0; i < list.count(); i++)
2148 { 2149 {
2149 nameList.append(list[i].realName()); 2150 nameList.append(list[i].realName());
2150 emailList.append(list[i].preferredEmail()); 2151 emailList.append(list[i].preferredEmail());
2151 uidList.append(list[i].uid()); 2152 uidList.append(list[i].uid());
2152 } 2153 }
2153 2154
2154 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2155 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList);
2155 2156
2156} 2157}
2157 2158
2159/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2160 * to put them into the calendar.
2161 */
2162void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2163{
2164 // qDebug("KABCore::requestForBirthdayList");
2165 QStringList birthdayList;
2166 QStringList anniversaryList;
2167 QStringList realNameList;
2168 QStringList preferredEmailList;
2169 QStringList assembledNameList;
2170 QStringList uidList;
2171
2172 KABC::AddressBook::Iterator it;
2173
2174 int count = 0;
2175 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2176 ++count;
2177 }
2178 QProgressBar bar(count,0 );
2179 int w = 300;
2180 if ( QApplication::desktop()->width() < 320 )
2181 w = 220;
2182 int h = bar.sizeHint().height() ;
2183 int dw = QApplication::desktop()->width();
2184 int dh = QApplication::desktop()->height();
2185 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2186 bar.show();
2187 bar.setCaption (i18n("collecting birthdays - close to abort!") );
2188 qApp->processEvents();
2189
2190 QDate bday;
2191 QString anni;
2192 QString formattedbday;
2193
2194 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2195 {
2196 if ( ! bar.isVisible() )
2197 return;
2198 bar.setProgress( count++ );
2199 qApp->processEvents();
2200 bday = (*it).birthday().date();
2201 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2202
2203 if ( bday.isValid() || !anni.isEmpty())
2204 {
2205 if (bday.isValid())
2206 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2207 else
2208 formattedbday = "NOTVALID";
2209 if (anni.isEmpty())
2210 anni = "INVALID";
2211
2212 birthdayList.append(formattedbday);
2213 anniversaryList.append(anni); //should be ISODate
2214 realNameList.append((*it).realName());
2215 preferredEmailList.append((*it).preferredEmail());
2216 assembledNameList.append((*it).assembledName());
2217 uidList.append((*it).uid());
2218
2219 qDebug("found birthday in KA/Pi: %s,%s,%s,%s: %s, %s", (*it).realName().latin1(), (*it).preferredEmail().latin1(), (*it).assembledName().latin1(), (*it).uid().latin1(), formattedbday.latin1(), anni.latin1() );
2220 }
2221 }
2222
2223 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2224
2225}
2226
2158/* this method will be called through the QCop interface from other apps to show details of a contact. 2227/* this method will be called through the QCop interface from other apps to show details of a contact.
2159 */ 2228 */
2160void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2229void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2161{ 2230{
2162 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2231 qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2163 2232
2164 QString foundUid = QString::null; 2233 QString foundUid = QString::null;
2165 if ( ! uid.isEmpty() ) { 2234 if ( ! uid.isEmpty() ) {
2166 Addressee adrr = mAddressBook->findByUid( uid ); 2235 Addressee adrr = mAddressBook->findByUid( uid );
2167 if ( !adrr.isEmpty() ) { 2236 if ( !adrr.isEmpty() ) {
2168 foundUid = uid; 2237 foundUid = uid;
2169 } 2238 }
2170 if ( email == "sendbacklist" ) { 2239 if ( email == "sendbacklist" ) {
2171 //qDebug("ssssssssssssssssssssssend "); 2240 //qDebug("ssssssssssssssssssssssend ");
2172 QStringList nameList; 2241 QStringList nameList;
2173 QStringList emailList; 2242 QStringList emailList;
2174 QStringList uidList; 2243 QStringList uidList;
2175 nameList.append(adrr.realName()); 2244 nameList.append(adrr.realName());
2176 emailList = adrr.emails(); 2245 emailList = adrr.emails();
2177 uidList.append( adrr.preferredEmail()); 2246 uidList.append( adrr.preferredEmail());
2178 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2247 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2179 return; 2248 return;
2180 } 2249 }
2181 2250
2182 } 2251 }
2183 2252
2184 if ( email == "sendbacklist" ) 2253 if ( email == "sendbacklist" )
2185 return; 2254 return;
2186 if (foundUid.isEmpty()) 2255 if (foundUid.isEmpty())
2187 { 2256 {
2188 //find the uid of the person first 2257 //find the uid of the person first
2189 Addressee::List namelist; 2258 Addressee::List namelist;
2190 Addressee::List emaillist; 2259 Addressee::List emaillist;
2191 2260
2192 if (!name.isEmpty()) 2261 if (!name.isEmpty())
2193 namelist = mAddressBook->findByName( name ); 2262 namelist = mAddressBook->findByName( name );
2194 2263
2195 if (!email.isEmpty()) 2264 if (!email.isEmpty())
2196 emaillist = mAddressBook->findByEmail( email ); 2265 emaillist = mAddressBook->findByEmail( email );
2197 qDebug("count %d %d ", namelist.count(),emaillist.count() ); 2266 qDebug("count %d %d ", namelist.count(),emaillist.count() );
2198 //check if we have a match in Namelist and Emaillist 2267 //check if we have a match in Namelist and Emaillist
2199 if ((namelist.count() == 0) && (emaillist.count() > 0)) { 2268 if ((namelist.count() == 0) && (emaillist.count() > 0)) {
2200 foundUid = emaillist[0].uid(); 2269 foundUid = emaillist[0].uid();
2201 } 2270 }
2202 else if ((namelist.count() > 0) && (emaillist.count() == 0)) 2271 else if ((namelist.count() > 0) && (emaillist.count() == 0))
2203 foundUid = namelist[0].uid(); 2272 foundUid = namelist[0].uid();
2204 else 2273 else
2205 { 2274 {
2206 for (int i = 0; i < namelist.count(); i++) 2275 for (int i = 0; i < namelist.count(); i++)
2207 { 2276 {
2208 for (int j = 0; j < emaillist.count(); j++) 2277 for (int j = 0; j < emaillist.count(); j++)
2209 { 2278 {
2210 if (namelist[i] == emaillist[j]) 2279 if (namelist[i] == emaillist[j])
2211 { 2280 {
2212 foundUid = namelist[i].uid(); 2281 foundUid = namelist[i].uid();
2213 } 2282 }
2214 } 2283 }
2215 } 2284 }
2216 } 2285 }
2217 } 2286 }
2218 else 2287 else
2219 { 2288 {
2220 foundUid = uid; 2289 foundUid = uid;
2221 } 2290 }
2222 2291
2223 if (!foundUid.isEmpty()) 2292 if (!foundUid.isEmpty())
2224 { 2293 {
2225 2294
2226 // raise Ka/Pi if it is in the background 2295 // raise Ka/Pi if it is in the background
2227#ifndef DESKTOP_VERSION 2296#ifndef DESKTOP_VERSION
2228#ifndef KORG_NODCOP 2297#ifndef KORG_NODCOP
2229 //QCopEnvelope e("QPE/Application/kapi", "raise()"); 2298 //QCopEnvelope e("QPE/Application/kapi", "raise()");
2230#endif 2299#endif
2231#endif 2300#endif
2232 2301
2233 mMainWindow->showMaximized(); 2302 mMainWindow->showMaximized();
2234 mMainWindow-> raise(); 2303 mMainWindow-> raise();
2235 2304
2236 mViewManager->setSelected( "", false); 2305 mViewManager->setSelected( "", false);
2237 mViewManager->refreshView( "" ); 2306 mViewManager->refreshView( "" );
2238 mViewManager->setSelected( foundUid, true ); 2307 mViewManager->setSelected( foundUid, true );
2239 mViewManager->refreshView( foundUid ); 2308 mViewManager->refreshView( foundUid );
2240 2309
2241 if ( !mMultipleViewsAtOnce ) 2310 if ( !mMultipleViewsAtOnce )
2242 { 2311 {
2243 setDetailsVisible( true ); 2312 setDetailsVisible( true );
2244 mActionDetails->setChecked(true); 2313 mActionDetails->setChecked(true);
2245 } 2314 }
2246 } 2315 }
2247} 2316}
2248 2317
2249 2318
2250void KABCore::faq() 2319void KABCore::faq()
2251{ 2320{
2252 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" ); 2321 KApplication::showFile( "KA/Pi FAQ", "kdepim/kaddressbook/kapiFAQ.txt" );
2253} 2322}
2254 2323
2255#include <libkcal/syncdefines.h> 2324#include <libkcal/syncdefines.h>
2256 2325
2257KABC::Addressee KABCore::getLastSyncAddressee() 2326KABC::Addressee KABCore::getLastSyncAddressee()
2258{ 2327{
2259 Addressee lse; 2328 Addressee lse;
2260 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2329 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2261 2330
2262 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() ); 2331 //qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
2263 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2332 lse = mAddressBook->findByUid( "last-syncAddressee-"+mCurrentSyncDevice );
2264 if (lse.isEmpty()) { 2333 if (lse.isEmpty()) {
2265 qDebug("Creating new last-syncAddressee "); 2334 qDebug("Creating new last-syncAddressee ");
2266 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice ); 2335 lse.setUid( "last-syncAddressee-"+mCurrentSyncDevice );
2267 QString sum = ""; 2336 QString sum = "";
2268 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) 2337 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL )
2269 sum = "E: "; 2338 sum = "E: ";
2270 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event")); 2339 lse.setFamilyName("!"+sum+mCurrentSyncDevice + i18n(" - sync event"));
2271 lse.setRevision( mLastAddressbookSync ); 2340 lse.setRevision( mLastAddressbookSync );
2272 lse.setCategories( i18n("SyncEvent") ); 2341 lse.setCategories( i18n("SyncEvent") );
2273 mAddressBook->insertAddressee( lse ); 2342 mAddressBook->insertAddressee( lse );
2274 } 2343 }
2275 return lse; 2344 return lse;
2276} 2345}
2277int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ) 2346int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full )
2278{ 2347{
2279 2348
2280 //void setZaurusId(int id); 2349 //void setZaurusId(int id);
2281 // int zaurusId() const; 2350 // int zaurusId() const;
2282 // void setZaurusUid(int id); 2351 // void setZaurusUid(int id);
2283 // int zaurusUid() const; 2352 // int zaurusUid() const;
2284 // void setZaurusStat(int id); 2353 // void setZaurusStat(int id);
2285 // int zaurusStat() const; 2354 // int zaurusStat() const;
2286 // 0 equal 2355 // 0 equal
2287 // 1 take local 2356 // 1 take local
2288 // 2 take remote 2357 // 2 take remote
2289 // 3 cancel 2358 // 3 cancel
2290 QDateTime lastSync = mLastAddressbookSync; 2359 QDateTime lastSync = mLastAddressbookSync;
2291 QDateTime localMod = local->revision(); 2360 QDateTime localMod = local->revision();
2292 QDateTime remoteMod = remote->revision(); 2361 QDateTime remoteMod = remote->revision();
2293 2362
2294 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2363 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2295 2364
2296 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2365 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2297 bool remCh, locCh; 2366 bool remCh, locCh;
2298 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) ); 2367 remCh = ( remote->getCsum(mCurrentSyncDevice) != local->getCsum(mCurrentSyncDevice) );
2299 2368
2300 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() ); 2369 //qDebug("loc %s rem %s", local->getCsum(mCurrentSyncDevice).latin1(), remote->getCsum(mCurrentSyncDevice).latin1() );
2301 locCh = ( localMod > mLastAddressbookSync ); 2370 locCh = ( localMod > mLastAddressbookSync );
2302 if ( !remCh && ! locCh ) { 2371 if ( !remCh && ! locCh ) {
2303 //qDebug("both not changed "); 2372 //qDebug("both not changed ");
2304 lastSync = localMod.addDays(1); 2373 lastSync = localMod.addDays(1);
2305 if ( mode <= SYNC_PREF_ASK ) 2374 if ( mode <= SYNC_PREF_ASK )
2306 return 0; 2375 return 0;
2307 } else { 2376 } else {
2308 if ( locCh ) { 2377 if ( locCh ) {
2309 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1()); 2378 //qDebug("loc changed %s %s", localMod.toString().latin1(), mLastAddressbookSync.toString().latin1());
2310 lastSync = localMod.addDays( -1 ); 2379 lastSync = localMod.addDays( -1 );
2311 if ( !remCh ) 2380 if ( !remCh )
2312 remoteMod =( lastSync.addDays( -1 ) ); 2381 remoteMod =( lastSync.addDays( -1 ) );
2313 } else { 2382 } else {
2314 //qDebug(" not loc changed "); 2383 //qDebug(" not loc changed ");
2315 lastSync = localMod.addDays( 1 ); 2384 lastSync = localMod.addDays( 1 );
2316 if ( remCh ) 2385 if ( remCh )
2317 remoteMod =( lastSync.addDays( 1 ) ); 2386 remoteMod =( lastSync.addDays( 1 ) );
2318 2387
2319 } 2388 }
2320 } 2389 }
2321 full = true; 2390 full = true;
2322 if ( mode < SYNC_PREF_ASK ) 2391 if ( mode < SYNC_PREF_ASK )
2323 mode = SYNC_PREF_ASK; 2392 mode = SYNC_PREF_ASK;
2324 } else { 2393 } else {
2325 if ( localMod == remoteMod ) 2394 if ( localMod == remoteMod )
2326 return 0; 2395 return 0;
2327 2396
2328 } 2397 }
2329 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() ); 2398 // qDebug(" %d %d conflict on %s %s ", mode, full, local->summary().latin1(), remote->summary().latin1() );
2330 2399
2331 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod); 2400 //qDebug("%s %d %s %d", local->lastModified().toString().latin1() , localMod, remote->lastModified().toString().latin1(), remoteMod);
2332 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() ); 2401 //qDebug("%d %d %d %d ", local->lastModified().time().second(), local->lastModified().time().msec(), remote->lastModified().time().second(), remote->lastModified().time().msec() );
2333 //full = true; //debug only 2402 //full = true; //debug only
2334 if ( full ) { 2403 if ( full ) {
2335 bool equ = ( (*local) == (*remote) ); 2404 bool equ = ( (*local) == (*remote) );
2336 if ( equ ) { 2405 if ( equ ) {
2337 //qDebug("equal "); 2406 //qDebug("equal ");
2338 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { 2407 if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) {
2339 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) ); 2408 local->setCsum( mCurrentSyncDevice, remote->getCsum(mCurrentSyncDevice) );
2340 } 2409 }
2341 if ( mode < SYNC_PREF_FORCE_LOCAL ) 2410 if ( mode < SYNC_PREF_FORCE_LOCAL )
2342 return 0; 2411 return 0;
2343 2412
2344 }//else //debug only 2413 }//else //debug only
2345 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1()); 2414 //qDebug("not equal %s %s ", local->summary().latin1(), remote->summary().latin1());
2346 } 2415 }
2347 int result; 2416 int result;
2348 bool localIsNew; 2417 bool localIsNew;
2349 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() ); 2418 //qDebug("%s -- %s mLastCalendarSync %s lastsync %s --- local %s remote %s ",local->summary().latin1(), remote->summary().latin1(),mLastCalendarSync.toString().latin1() ,lastSync.toString().latin1() , local->lastModified().toString().latin1() , remote->lastModified().toString().latin1() );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index e6f286b..c9c0d38 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -146,338 +146,339 @@ class KABCore : public QWidget, public KSyncInterface
146 void statusMessage(QString, int time = 0 ); 146 void statusMessage(QString, int time = 0 );
147 void showLicence(); 147 void showLicence();
148 void faq(); 148 void faq();
149 149
150 /** 150 /**
151 Is called whenever a contact is selected in the view. 151 Is called whenever a contact is selected in the view.
152 */ 152 */
153 void setContactSelected( const QString &uid ); 153 void setContactSelected( const QString &uid );
154 154
155 /** 155 /**
156 Opens the preferred mail composer with all selected contacts as 156 Opens the preferred mail composer with all selected contacts as
157 arguments. 157 arguments.
158 */ 158 */
159 void sendMail(); 159 void sendMail();
160 160
161 /** 161 /**
162 Opens the preferred mail composer with the given contacts as 162 Opens the preferred mail composer with the given contacts as
163 arguments. 163 arguments.
164 */ 164 */
165 void sendMail( const QString& email ); 165 void sendMail( const QString& email );
166 166
167 167
168 void mailVCard(); 168 void mailVCard();
169 void mailVCard(const QStringList& uids); 169 void mailVCard(const QStringList& uids);
170 170
171 /** 171 /**
172 Beams the "WhoAmI contact. 172 Beams the "WhoAmI contact.
173 */ 173 */
174 void beamMySelf(); 174 void beamMySelf();
175 175
176 void beamVCard(); 176 void beamVCard();
177 void export2phone(); 177 void export2phone();
178 void beamVCard(const QStringList& uids); 178 void beamVCard(const QStringList& uids);
179 void beamDone( Ir *ir ); 179 void beamDone( Ir *ir );
180 180
181 181
182 /** 182 /**
183 Starts the preferred web browser with the given URL as argument. 183 Starts the preferred web browser with the given URL as argument.
184 */ 184 */
185 void browse( const QString& url ); 185 void browse( const QString& url );
186 186
187 /** 187 /**
188 Select all contacts in the view. 188 Select all contacts in the view.
189 */ 189 */
190 void selectAllContacts(); 190 void selectAllContacts();
191 191
192 /** 192 /**
193 Deletes all selected contacts from the address book. 193 Deletes all selected contacts from the address book.
194 */ 194 */
195 void deleteContacts(); 195 void deleteContacts();
196 196
197 /** 197 /**
198 Deletes given contacts from the address book. 198 Deletes given contacts from the address book.
199 199
200 @param uids The uids of the contacts, which shall be deleted. 200 @param uids The uids of the contacts, which shall be deleted.
201 */ 201 */
202 void deleteContacts( const QStringList &uids ); 202 void deleteContacts( const QStringList &uids );
203 203
204 /** 204 /**
205 Copys the selected contacts into clipboard for later pasting. 205 Copys the selected contacts into clipboard for later pasting.
206 */ 206 */
207 void copyContacts(); 207 void copyContacts();
208 208
209 /** 209 /**
210 Cuts the selected contacts and stores them for later pasting. 210 Cuts the selected contacts and stores them for later pasting.
211 */ 211 */
212 void cutContacts(); 212 void cutContacts();
213 213
214 /** 214 /**
215 Paste contacts from clipboard into the address book. 215 Paste contacts from clipboard into the address book.
216 */ 216 */
217 void pasteContacts(); 217 void pasteContacts();
218 218
219 /** 219 /**
220 Paste given contacts into the address book. 220 Paste given contacts into the address book.
221 221
222 @param list The list of addressee, which shall be pasted. 222 @param list The list of addressee, which shall be pasted.
223 */ 223 */
224 void pasteContacts( KABC::Addressee::List &list ); 224 void pasteContacts( KABC::Addressee::List &list );
225 225
226 /** 226 /**
227 Sets the whoAmI contact, that is used by many other programs to 227 Sets the whoAmI contact, that is used by many other programs to
228 get personal information about the current user. 228 get personal information about the current user.
229 */ 229 */
230 void setWhoAmI(); 230 void setWhoAmI();
231 231
232 /** 232 /**
233 Displays the category dialog and applies the result to all 233 Displays the category dialog and applies the result to all
234 selected contacts. 234 selected contacts.
235 */ 235 */
236 void setCategories(); 236 void setCategories();
237 237
238 /** 238 /**
239 Sets the field list of the Incremental Search Widget. 239 Sets the field list of the Incremental Search Widget.
240 */ 240 */
241 void setSearchFields( const KABC::Field::List &fields ); 241 void setSearchFields( const KABC::Field::List &fields );
242 242
243 /** 243 /**
244 Search with the current search field for a contact, that matches 244 Search with the current search field for a contact, that matches
245 the given text, and selects it in the view. 245 the given text, and selects it in the view.
246 */ 246 */
247 void incrementalSearch( const QString& text ); 247 void incrementalSearch( const QString& text );
248 248
249 /** 249 /**
250 Marks the address book as modified. 250 Marks the address book as modified.
251 */ 251 */
252 void setModified(); 252 void setModified();
253 /** 253 /**
254 Marks the address book as modified without refreshing the view. 254 Marks the address book as modified without refreshing the view.
255 */ 255 */
256 void setModifiedWOrefresh(); 256 void setModifiedWOrefresh();
257 257
258 /** 258 /**
259 Marks the address book as modified concerning the argument. 259 Marks the address book as modified concerning the argument.
260 */ 260 */
261 void setModified( bool modified ); 261 void setModified( bool modified );
262 262
263 /** 263 /**
264 Returns whether the address book is modified. 264 Returns whether the address book is modified.
265 */ 265 */
266 bool modified() const; 266 bool modified() const;
267 267
268 /** 268 /**
269 Called whenever an contact is modified in the contact editor 269 Called whenever an contact is modified in the contact editor
270 dialog or the quick edit. 270 dialog or the quick edit.
271 */ 271 */
272 void contactModified( const KABC::Addressee &addr ); 272 void contactModified( const KABC::Addressee &addr );
273 273
274 /** 274 /**
275 DCOP METHODS. 275 DCOP METHODS.
276 */ 276 */
277 void addEmail( QString addr ); 277 void addEmail( QString addr );
278 void importVCard( const KURL& url, bool showPreview ); 278 void importVCard( const KURL& url, bool showPreview );
279 void importVCard( const QString& vCard, bool showPreview ); 279 void importVCard( const QString& vCard, bool showPreview );
280 void newContact(); 280 void newContact();
281 QString getNameByPhone( const QString& phone ); 281 QString getNameByPhone( const QString& phone );
282 /** 282 /**
283 END DCOP METHODS 283 END DCOP METHODS
284 */ 284 */
285 285
286 /** 286 /**
287 Saves the contents of the AddressBook back to disk. 287 Saves the contents of the AddressBook back to disk.
288 */ 288 */
289 void save(); 289 void save();
290 290
291 /** 291 /**
292 Undos the last command using the undo stack. 292 Undos the last command using the undo stack.
293 */ 293 */
294 void undo(); 294 void undo();
295 295
296 /** 296 /**
297 Redos the last command that was undone, using the redo stack. 297 Redos the last command that was undone, using the redo stack.
298 */ 298 */
299 void redo(); 299 void redo();
300 300
301 /** 301 /**
302 Shows the edit dialog for the given uid. If the uid is QString::null, 302 Shows the edit dialog for the given uid. If the uid is QString::null,
303 the method will try to find a selected addressee in the view. 303 the method will try to find a selected addressee in the view.
304 */ 304 */
305 void editContact( const QString &uid /*US = QString::null*/ ); 305 void editContact( const QString &uid /*US = QString::null*/ );
306//US added a second method without defaultparameter 306//US added a second method without defaultparameter
307 void editContact2(); 307 void editContact2();
308 308
309 /** 309 /**
310 Shows or edits the detail view for the given uid. If the uid is QString::null, 310 Shows or edits the detail view for the given uid. If the uid is QString::null,
311 the method will try to find a selected addressee in the view. 311 the method will try to find a selected addressee in the view.
312 */ 312 */
313 void executeContact( const QString &uid /*US = QString::null*/ ); 313 void executeContact( const QString &uid /*US = QString::null*/ );
314 314
315 /** 315 /**
316 Launches the configuration dialog. 316 Launches the configuration dialog.
317 */ 317 */
318 void openConfigDialog(); 318 void openConfigDialog();
319 319
320 /** 320 /**
321 Launches the ldap search dialog. 321 Launches the ldap search dialog.
322 */ 322 */
323 void openLDAPDialog(); 323 void openLDAPDialog();
324 324
325 /** 325 /**
326 Creates a KAddressBookPrinter, which will display the print 326 Creates a KAddressBookPrinter, which will display the print
327 dialog and do the printing. 327 dialog and do the printing.
328 */ 328 */
329 void print(); 329 void print();
330 330
331 /** 331 /**
332 Registers a new GUI client, so plugins can register its actions. 332 Registers a new GUI client, so plugins can register its actions.
333 */ 333 */
334 void addGUIClient( KXMLGUIClient *client ); 334 void addGUIClient( KXMLGUIClient *client );
335 335
336 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 336 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
338 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
338 339
339 340
340 signals: 341 signals:
341 void contactSelected( const QString &name ); 342 void contactSelected( const QString &name );
342 void contactSelected( const QPixmap &pixmap ); 343 void contactSelected( const QPixmap &pixmap );
343 public slots: 344 public slots:
344 void setDetailsVisible( bool visible ); 345 void setDetailsVisible( bool visible );
345 void setDetailsToState(); 346 void setDetailsToState();
346 // void slotSyncMenu( int ); 347 // void slotSyncMenu( int );
347 private slots: 348 private slots:
348 void setJumpButtonBarVisible( bool visible ); 349 void setJumpButtonBarVisible( bool visible );
349 void importFromOL(); 350 void importFromOL();
350 void extensionModified( const KABC::Addressee::List &list ); 351 void extensionModified( const KABC::Addressee::List &list );
351 void extensionChanged( int id ); 352 void extensionChanged( int id );
352 void clipboardDataChanged(); 353 void clipboardDataChanged();
353 void updateActionMenu(); 354 void updateActionMenu();
354 void configureKeyBindings(); 355 void configureKeyBindings();
355 void removeVoice(); 356 void removeVoice();
356#ifdef KAB_EMBEDDED 357#ifdef KAB_EMBEDDED
357 void configureResources(); 358 void configureResources();
358#endif //KAB_EMBEDDED 359#endif //KAB_EMBEDDED
359 360
360 void slotEditorDestroyed( const QString &uid ); 361 void slotEditorDestroyed( const QString &uid );
361 void configurationChanged(); 362 void configurationChanged();
362 void addressBookChanged(); 363 void addressBookChanged();
363 364
364 private: 365 private:
365 void initGUI(); 366 void initGUI();
366 void initActions(); 367 void initActions();
367 368
368 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 369 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
369 const char *name = 0 ); 370 const char *name = 0 );
370 371
371 KXMLGUIClient *mGUIClient; 372 KXMLGUIClient *mGUIClient;
372 373
373 KABC::AddressBook *mAddressBook; 374 KABC::AddressBook *mAddressBook;
374 375
375 ViewManager *mViewManager; 376 ViewManager *mViewManager;
376 // QSplitter *mDetailsSplitter; 377 // QSplitter *mDetailsSplitter;
377 KDGanttMinimizeSplitter *mExtensionBarSplitter; 378 KDGanttMinimizeSplitter *mExtensionBarSplitter;
378 ViewContainer *mDetails; 379 ViewContainer *mDetails;
379 KDGanttMinimizeSplitter* mMiniSplitter; 380 KDGanttMinimizeSplitter* mMiniSplitter;
380 XXPortManager *mXXPortManager; 381 XXPortManager *mXXPortManager;
381 JumpButtonBar *mJumpButtonBar; 382 JumpButtonBar *mJumpButtonBar;
382 IncSearchWidget *mIncSearchWidget; 383 IncSearchWidget *mIncSearchWidget;
383 ExtensionManager *mExtensionManager; 384 ExtensionManager *mExtensionManager;
384 385
385 KCMultiDialog *mConfigureDialog; 386 KCMultiDialog *mConfigureDialog;
386 387
387#ifndef KAB_EMBEDDED 388#ifndef KAB_EMBEDDED
388 LDAPSearchDialog *mLdapSearchDialog; 389 LDAPSearchDialog *mLdapSearchDialog;
389#endif //KAB_EMBEDDED 390#endif //KAB_EMBEDDED
390 // QDict<AddresseeEditorDialog> mEditorDict; 391 // QDict<AddresseeEditorDialog> mEditorDict;
391 AddresseeEditorDialog *mEditorDialog; 392 AddresseeEditorDialog *mEditorDialog;
392 bool mReadWrite; 393 bool mReadWrite;
393 bool mModified; 394 bool mModified;
394 bool mIsPart; 395 bool mIsPart;
395 bool mMultipleViewsAtOnce; 396 bool mMultipleViewsAtOnce;
396 397
397 398
398 //US file menu 399 //US file menu
399 KAction *mActionMail; 400 KAction *mActionMail;
400 KAction *mActionBeam; 401 KAction *mActionBeam;
401 KAction *mActionExport2phone; 402 KAction *mActionExport2phone;
402 KAction* mActionPrint; 403 KAction* mActionPrint;
403 KAction* mActionNewContact; 404 KAction* mActionNewContact;
404 KAction *mActionSave; 405 KAction *mActionSave;
405 KAction *mActionEditAddressee; 406 KAction *mActionEditAddressee;
406 KAction *mActionMailVCard; 407 KAction *mActionMailVCard;
407 KAction *mActionBeamVCard; 408 KAction *mActionBeamVCard;
408 409
409 KAction *mActionQuit; 410 KAction *mActionQuit;
410 411
411 //US edit menu 412 //US edit menu
412 KAction *mActionCopy; 413 KAction *mActionCopy;
413 KAction *mActionCut; 414 KAction *mActionCut;
414 KAction *mActionPaste; 415 KAction *mActionPaste;
415 KAction *mActionSelectAll; 416 KAction *mActionSelectAll;
416 KAction *mActionUndo; 417 KAction *mActionUndo;
417 KAction *mActionRedo; 418 KAction *mActionRedo;
418 KAction *mActionDelete; 419 KAction *mActionDelete;
419 420
420 //US settings menu 421 //US settings menu
421 KAction *mActionConfigResources; 422 KAction *mActionConfigResources;
422 KAction *mActionConfigKAddressbook; 423 KAction *mActionConfigKAddressbook;
423 KAction *mActionConfigShortcuts; 424 KAction *mActionConfigShortcuts;
424 KAction *mActionConfigureToolbars; 425 KAction *mActionConfigureToolbars;
425 KAction *mActionKeyBindings; 426 KAction *mActionKeyBindings;
426 KToggleAction *mActionJumpBar; 427 KToggleAction *mActionJumpBar;
427 KToggleAction *mActionDetails; 428 KToggleAction *mActionDetails;
428 KAction *mActionWhoAmI; 429 KAction *mActionWhoAmI;
429 KAction *mActionCategories; 430 KAction *mActionCategories;
430 KAction *mActionAboutKAddressbook; 431 KAction *mActionAboutKAddressbook;
431 KAction *mActionLicence; 432 KAction *mActionLicence;
432 KAction *mActionFaq; 433 KAction *mActionFaq;
433 434
434 KAction *mActionDeleteView; 435 KAction *mActionDeleteView;
435 436
436 QPopupMenu *viewMenu; 437 QPopupMenu *viewMenu;
437 QPopupMenu *filterMenu; 438 QPopupMenu *filterMenu;
438 QPopupMenu *settingsMenu; 439 QPopupMenu *settingsMenu;
439 QPopupMenu *changeMenu; 440 QPopupMenu *changeMenu;
440//US QAction *mActionSave; 441//US QAction *mActionSave;
441 QPopupMenu *ImportMenu; 442 QPopupMenu *ImportMenu;
442 QPopupMenu *ExportMenu; 443 QPopupMenu *ExportMenu;
443 //LR additional methods 444 //LR additional methods
444 KAction *mActionRemoveVoice; 445 KAction *mActionRemoveVoice;
445 KAction * mActionImportOL; 446 KAction * mActionImportOL;
446 447
447#ifndef KAB_EMBEDDED 448#ifndef KAB_EMBEDDED
448 KAddressBookService *mAddressBookService; 449 KAddressBookService *mAddressBookService;
449#endif //KAB_EMBEDDED 450#endif //KAB_EMBEDDED
450 451
451 class KABCorePrivate; 452 class KABCorePrivate;
452 KABCorePrivate *d; 453 KABCorePrivate *d;
453 //US bool mBlockSaveFlag; 454 //US bool mBlockSaveFlag;
454 455
455#ifdef KAB_EMBEDDED 456#ifdef KAB_EMBEDDED
456 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 457 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
457#endif //KAB_EMBEDDED 458#endif //KAB_EMBEDDED
458 459
459 //this are the overwritten callbackmethods from the syncinterface 460 //this are the overwritten callbackmethods from the syncinterface
460 virtual bool sync(KSyncManager* manager, QString filename, int mode); 461 virtual bool sync(KSyncManager* manager, QString filename, int mode);
461 virtual bool syncExternal(KSyncManager* manager, QString resource); 462 virtual bool syncExternal(KSyncManager* manager, QString resource);
462 463
463 //called by the syncmanager to indicate that the work has to marked as dirty. 464 //called by the syncmanager to indicate that the work has to marked as dirty.
464 virtual void sync_setModified(); 465 virtual void sync_setModified();
465 //called by the syncmanager to ask if the dirty flag is set. 466 //called by the syncmanager to ask if the dirty flag is set.
466 virtual bool sync_isModified(); 467 virtual bool sync_isModified();
467 //called by the syncmanager to indicate that the work has to be saved. 468 //called by the syncmanager to indicate that the work has to be saved.
468 virtual void sync_save(); 469 virtual void sync_save();
469 470
470 // LR ******************************* 471 // LR *******************************
471 // sync stuff! 472 // sync stuff!
472 QPopupMenu *syncMenu; 473 QPopupMenu *syncMenu;
473 KSyncManager* syncManager; 474 KSyncManager* syncManager;
474 int mGlobalSyncMode; 475 int mGlobalSyncMode;
475 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 476 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
476 KABC::Addressee getLastSyncAddressee(); 477 KABC::Addressee getLastSyncAddressee();
477 QDateTime mLastAddressbookSync; 478 QDateTime mLastAddressbookSync;
478 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 479 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
479 // ********************* 480 // *********************
480 481
481}; 482};
482 483
483#endif 484#endif