summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-08-23 13:59:59 (UTC)
committer zautrix <zautrix>2005-08-23 13:59:59 (UTC)
commit02fa432f183ad2b18380de0e41399efe3b867dba (patch) (unidiff)
treed13d3941ef4d6abc90790d5b6039a92787ea7987 /kaddressbook
parent72d600e2c3b3405e5f37615a56560811c0cf9a78 (diff)
downloadkdepimpi-02fa432f183ad2b18380de0e41399efe3b867dba.zip
kdepimpi-02fa432f183ad2b18380de0e41399efe3b867dba.tar.gz
kdepimpi-02fa432f183ad2b18380de0e41399efe3b867dba.tar.bz2
fixx
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp28
-rw-r--r--kaddressbook/kabcore.h4
-rw-r--r--kaddressbook/kaddressbookmain.cpp4
-rw-r--r--kaddressbook/mainembedded.cpp5
4 files changed, 33 insertions, 8 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index b9830b1..c670b1f 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -214,387 +214,410 @@ class KABFormatPrefs : public QDialog
214 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this ); 214 QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Set formatted name to:"), this );
215 lay->addWidget( format ); 215 lay->addWidget( format );
216 format->setExclusive ( true ) ; 216 format->setExclusive ( true ) ;
217 simple = new QRadioButton(i18n("Simple: James Bond"), format ); 217 simple = new QRadioButton(i18n("Simple: James Bond"), format );
218 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format ); 218 full = new QRadioButton(i18n("Full: Mr. James 007 Bond I"), format );
219 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format ); 219 reverse = new QRadioButton(i18n("Reverse: Bond, James"), format );
220 company = new QRadioButton(i18n("Organization: MI6"), format ); 220 company = new QRadioButton(i18n("Organization: MI6"), format );
221 simple->setChecked( true ); 221 simple->setChecked( true );
222 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this); 222 setCompany = new QCheckBox(i18n("Set formatted name to\norganization, if name empty"), this);
223 lay->addWidget( setCompany ); 223 lay->addWidget( setCompany );
224 QPushButton * ok = new QPushButton( i18n("Select contact list"), this ); 224 QPushButton * ok = new QPushButton( i18n("Select contact list"), this );
225 lay->addWidget( ok ); 225 lay->addWidget( ok );
226 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 226 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
227 lay->addWidget( cancel ); 227 lay->addWidget( cancel );
228 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 228 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
229 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 229 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
230 //resize( 200, 200 ); 230 //resize( 200, 200 );
231 231
232 } 232 }
233public: 233public:
234 QRadioButton* simple, *full, *reverse, *company; 234 QRadioButton* simple, *full, *reverse, *company;
235 QCheckBox* setCompany; 235 QCheckBox* setCompany;
236}; 236};
237 237
238 238
239 239
240class KAex2phonePrefs : public QDialog 240class KAex2phonePrefs : public QDialog
241{ 241{
242 public: 242 public:
243 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 243 KAex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
244 QDialog( parent, name, true ) 244 QDialog( parent, name, true )
245 { 245 {
246 setCaption( i18n("Export to phone options") ); 246 setCaption( i18n("Export to phone options") );
247 QVBoxLayout* lay = new QVBoxLayout( this ); 247 QVBoxLayout* lay = new QVBoxLayout( this );
248 lay->setSpacing( 3 ); 248 lay->setSpacing( 3 );
249 lay->setMargin( 3 ); 249 lay->setMargin( 3 );
250 QLabel *lab; 250 QLabel *lab;
251 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 251 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
252 lab->setAlignment (AlignHCenter ); 252 lab->setAlignment (AlignHCenter );
253 QHBox* temphb; 253 QHBox* temphb;
254 temphb = new QHBox( this ); 254 temphb = new QHBox( this );
255 new QLabel( i18n("I/O device: "), temphb ); 255 new QLabel( i18n("I/O device: "), temphb );
256 mPhoneDevice = new QLineEdit( temphb); 256 mPhoneDevice = new QLineEdit( temphb);
257 lay->addWidget( temphb ); 257 lay->addWidget( temphb );
258 temphb = new QHBox( this ); 258 temphb = new QHBox( this );
259 new QLabel( i18n("Connection: "), temphb ); 259 new QLabel( i18n("Connection: "), temphb );
260 mPhoneConnection = new QLineEdit( temphb); 260 mPhoneConnection = new QLineEdit( temphb);
261 lay->addWidget( temphb ); 261 lay->addWidget( temphb );
262 temphb = new QHBox( this ); 262 temphb = new QHBox( this );
263 new QLabel( i18n("Model(opt.): "), temphb ); 263 new QLabel( i18n("Model(opt.): "), temphb );
264 mPhoneModel = new QLineEdit( temphb); 264 mPhoneModel = new QLineEdit( temphb);
265 lay->addWidget( temphb ); 265 lay->addWidget( temphb );
266 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this ); 266 // mWriteToSim = new QCheckBox( i18n("Write Contacts to SIM card\n(if not, write to phone memory)"), this );
267 // lay->addWidget( mWriteToSim ); 267 // lay->addWidget( mWriteToSim );
268 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) ); 268 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ncontact data on phone!"), this ) );
269 lab->setAlignment (AlignHCenter); 269 lab->setAlignment (AlignHCenter);
270 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 270 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
271 lay->addWidget( ok ); 271 lay->addWidget( ok );
272 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 272 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
273 lay->addWidget( cancel ); 273 lay->addWidget( cancel );
274 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 274 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
275 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 275 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
276 resize( 220, 240 ); 276 resize( 220, 240 );
277 277
278 } 278 }
279 279
280public: 280public:
281 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 281 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
282 QCheckBox* mWriteToSim; 282 QCheckBox* mWriteToSim;
283}; 283};
284 284
285 285
286bool pasteWithNewUid = true; 286bool pasteWithNewUid = true;
287 287
288#ifdef KAB_EMBEDDED 288#ifdef KAB_EMBEDDED
289KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 289KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
290 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 290 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
291 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 291 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
292 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 292 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
293#else //KAB_EMBEDDED 293#else //KAB_EMBEDDED
294KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 294KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
295 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 295 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
296 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 296 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
297 mReadWrite( readWrite ), mModified( false ) 297 mReadWrite( readWrite ), mModified( false )
298#endif //KAB_EMBEDDED 298#endif //KAB_EMBEDDED
299{ 299{
300 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 300 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
301 // syncManager->setBlockSave(false); 301 // syncManager->setBlockSave(false);
302 mIncSearchWidget = 0; 302 mIncSearchWidget = 0;
303 mMiniSplitter = 0; 303 mMiniSplitter = 0;
304 mExtensionBarSplitter = 0; 304 mExtensionBarSplitter = 0;
305 mIsPart = !parent->inherits( "KAddressBookMain" ); 305 mIsPart = !parent->inherits( "KAddressBookMain" );
306 mAddressBook = KABC::StdAddressBook::self(); 306 mAddressBook = KABC::StdAddressBook::self();
307 KABC::StdAddressBook::setAutomaticSave( false ); 307 KABC::StdAddressBook::setAutomaticSave( false );
308 308
309#ifndef KAB_EMBEDDED 309#ifndef KAB_EMBEDDED
310 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 310 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
311#endif //KAB_EMBEDDED 311#endif //KAB_EMBEDDED
312 312
313 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 313 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
314 SLOT( addressBookChanged() ) ); 314 SLOT( addressBookChanged() ) );
315 315
316#if 0 316#if 0
317 // LR moved to addressbook init method 317 // LR moved to addressbook init method
318 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 318 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
319 "X-Department", "KADDRESSBOOK" ); 319 "X-Department", "KADDRESSBOOK" );
320 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 320 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
321 "X-Profession", "KADDRESSBOOK" ); 321 "X-Profession", "KADDRESSBOOK" );
322 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 322 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
323 "X-AssistantsName", "KADDRESSBOOK" ); 323 "X-AssistantsName", "KADDRESSBOOK" );
324 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 324 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
325 "X-ManagersName", "KADDRESSBOOK" ); 325 "X-ManagersName", "KADDRESSBOOK" );
326 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 326 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
327 "X-SpousesName", "KADDRESSBOOK" ); 327 "X-SpousesName", "KADDRESSBOOK" );
328 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 328 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
329 "X-Office", "KADDRESSBOOK" ); 329 "X-Office", "KADDRESSBOOK" );
330 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 330 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
331 "X-IMAddress", "KADDRESSBOOK" ); 331 "X-IMAddress", "KADDRESSBOOK" );
332 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 332 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
333 "X-Anniversary", "KADDRESSBOOK" ); 333 "X-Anniversary", "KADDRESSBOOK" );
334 334
335 //US added this field to become compatible with Opie/qtopia addressbook 335 //US added this field to become compatible with Opie/qtopia addressbook
336 // values can be "female" or "male" or "". An empty field represents undefined. 336 // values can be "female" or "male" or "". An empty field represents undefined.
337 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 337 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
338 "X-Gender", "KADDRESSBOOK" ); 338 "X-Gender", "KADDRESSBOOK" );
339 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 339 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
340 "X-Children", "KADDRESSBOOK" ); 340 "X-Children", "KADDRESSBOOK" );
341 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 341 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
342 "X-FreeBusyUrl", "KADDRESSBOOK" ); 342 "X-FreeBusyUrl", "KADDRESSBOOK" );
343#endif 343#endif
344 initGUI(); 344 initGUI();
345 345
346 mIncSearchWidget->setFocus(); 346 mIncSearchWidget->setFocus();
347 347
348 348
349 connect( mViewManager, SIGNAL( selected( const QString& ) ), 349 connect( mViewManager, SIGNAL( selected( const QString& ) ),
350 SLOT( setContactSelected( const QString& ) ) ); 350 SLOT( setContactSelected( const QString& ) ) );
351 connect( mViewManager, SIGNAL( executed( const QString& ) ), 351 connect( mViewManager, SIGNAL( executed( const QString& ) ),
352 SLOT( executeContact( const QString& ) ) ); 352 SLOT( executeContact( const QString& ) ) );
353 353
354 connect( mViewManager, SIGNAL( deleteRequest( ) ), 354 connect( mViewManager, SIGNAL( deleteRequest( ) ),
355 SLOT( deleteContacts( ) ) ); 355 SLOT( deleteContacts( ) ) );
356 connect( mViewManager, SIGNAL( modified() ), 356 connect( mViewManager, SIGNAL( modified() ),
357 SLOT( setModified() ) ); 357 SLOT( setModified() ) );
358 358
359 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 359 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
360 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 360 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
361 361
362 connect( mXXPortManager, SIGNAL( modified() ), 362 connect( mXXPortManager, SIGNAL( modified() ),
363 SLOT( setModified() ) ); 363 SLOT( setModified() ) );
364 364
365 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 365 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
366 SLOT( incrementalSearchJump( const QString& ) ) ); 366 SLOT( incrementalSearchJump( const QString& ) ) );
367 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 367 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
368 mJumpButtonBar, SLOT( recreateButtons() ) ); 368 mJumpButtonBar, SLOT( recreateButtons() ) );
369 369
370 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 370 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
371 SLOT( sendMail( const QString& ) ) ); 371 SLOT( sendMail( const QString& ) ) );
372 372
373 373
374 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 374 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
375 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&))); 375 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&)));
376 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 376 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
377 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 377 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
378 connect( ExternalAppHandler::instance(), SIGNAL (doRingSync()),this, SLOT( doRingSync())); 378 connect( ExternalAppHandler::instance(), SIGNAL (doRingSync()),this, SLOT( doRingSync()));
379 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog())); 379 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog()));
380 380
381 381
382#ifndef KAB_EMBEDDED 382#ifndef KAB_EMBEDDED
383 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 383 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
384 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 384 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
385 385
386 connect( mDetails, SIGNAL( browse( const QString& ) ), 386 connect( mDetails, SIGNAL( browse( const QString& ) ),
387 SLOT( browse( const QString& ) ) ); 387 SLOT( browse( const QString& ) ) );
388 388
389 389
390 mAddressBookService = new KAddressBookService( this ); 390 mAddressBookService = new KAddressBookService( this );
391 391
392#endif //KAB_EMBEDDED 392#endif //KAB_EMBEDDED
393 393
394 mMessageTimer = new QTimer( this ); 394 mMessageTimer = new QTimer( this );
395 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 395 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
396 mEditorDialog = 0; 396 mEditorDialog = 0;
397 createAddresseeEditorDialog( this ); 397 createAddresseeEditorDialog( this );
398 setModified( false ); 398 setModified( false );
399 mBRdisabled = false; 399 mBRdisabled = false;
400#ifndef DESKTOP_VERSION 400#ifndef DESKTOP_VERSION
401 infrared = 0; 401 infrared = 0;
402#endif 402#endif
403 //toggleBeamReceive( ); 403 //toggleBeamReceive( );
404 mMainWindow->toolBar()->show(); 404 mMainWindow->toolBar()->show();
405 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 405 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
406 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 406 //QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
407 QTimer::singleShot( 100, this, SLOT ( loadDataAfterStart() ));
408}
409void KABCore::receiveStart( const QCString& cmsg, const QByteArray& data )
410{
411 qDebug("KO: QCOP start message received: %s ", cmsg.data() );
412 mCStringMess = cmsg;
413 mByteData = data;
407} 414}
408 415
416void KABCore::loadDataAfterStart()
417{
418 qDebug("KABCore::loadDataAfterStart() ");
419 ((StdAddressBook*)mAddressBook)->init( true );
420 mViewManager->refreshView();
421
422#ifndef DESKTOP_VERSION
423 disconnect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), this, SLOT (receiveStart ( const QCString &, const QByteArray & )));
424
425 QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
426 if ( !mCStringMess.isEmpty() )
427 ExternalAppHandler::instance()->appMessage( mCStringMess, mByteData );
428#endif
429 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
430 setCaptionBack();
431}
409void KABCore::updateToolBar() 432void KABCore::updateToolBar()
410{ 433{
411 static int iii = 0; 434 static int iii = 0;
412 ++iii; 435 ++iii;
413 mMainWindow->toolBar()->repaintMe(); 436 mMainWindow->toolBar()->repaintMe();
414 if ( iii < 4 ) 437 if ( iii < 4 )
415 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); 438 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar()));
416} 439}
417KABCore::~KABCore() 440KABCore::~KABCore()
418{ 441{
419 // save(); 442 // save();
420 //saveSettings(); 443 //saveSettings();
421 //KABPrefs::instance()->writeConfig(); 444 //KABPrefs::instance()->writeConfig();
422 delete AddresseeConfig::instance(); 445 delete AddresseeConfig::instance();
423 mAddressBook = 0; 446 mAddressBook = 0;
424 KABC::StdAddressBook::close(); 447 KABC::StdAddressBook::close();
425 448
426 delete syncManager; 449 delete syncManager;
427#ifndef DESKTOP_VERSION 450#ifndef DESKTOP_VERSION
428 if ( infrared ) 451 if ( infrared )
429 delete infrared; 452 delete infrared;
430#endif 453#endif
431} 454}
432void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 455void KABCore::receive( const QCString& cmsg, const QByteArray& data )
433{ 456{
434 //qDebug("KA: QCOP message received: %s ", cmsg.data() ); 457 //qDebug("KA: QCOP message received: %s ", cmsg.data() );
435 if ( cmsg == "setDocument(QString)" ) { 458 if ( cmsg == "setDocument(QString)" ) {
436 QDataStream stream( data, IO_ReadOnly ); 459 QDataStream stream( data, IO_ReadOnly );
437 QString fileName; 460 QString fileName;
438 stream >> fileName; 461 stream >> fileName;
439 recieve( fileName ); 462 recieve( fileName );
440 return; 463 return;
441 } 464 }
442} 465}
443void KABCore::toggleBeamReceive( ) 466void KABCore::toggleBeamReceive( )
444{ 467{
445 if ( mBRdisabled ) 468 if ( mBRdisabled )
446 return; 469 return;
447#ifndef DESKTOP_VERSION 470#ifndef DESKTOP_VERSION
448 if ( infrared ) { 471 if ( infrared ) {
449 qDebug("KA: AB disable BeamReceive "); 472 qDebug("KA: AB disable BeamReceive ");
450 delete infrared; 473 delete infrared;
451 infrared = 0; 474 infrared = 0;
452 mActionBR->setChecked(false); 475 mActionBR->setChecked(false);
453 return; 476 return;
454 } 477 }
455 qDebug("KA: AB enable BeamReceive "); 478 qDebug("KA: AB enable BeamReceive ");
456 mActionBR->setChecked(true); 479 mActionBR->setChecked(true);
457 480
458 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 481 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
459 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 482 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
460#endif 483#endif
461} 484}
462 485
463 486
464void KABCore::disableBR(bool b) 487void KABCore::disableBR(bool b)
465{ 488{
466#ifndef DESKTOP_VERSION 489#ifndef DESKTOP_VERSION
467 if ( b ) { 490 if ( b ) {
468 if ( infrared ) { 491 if ( infrared ) {
469 toggleBeamReceive( ); 492 toggleBeamReceive( );
470 } 493 }
471 mBRdisabled = true; 494 mBRdisabled = true;
472 } else { 495 } else {
473 if ( mBRdisabled ) { 496 if ( mBRdisabled ) {
474 mBRdisabled = false; 497 mBRdisabled = false;
475 //toggleBeamReceive( ); 498 //toggleBeamReceive( );
476 } 499 }
477 } 500 }
478#endif 501#endif
479 502
480} 503}
481void KABCore::recieve( QString fn ) 504void KABCore::recieve( QString fn )
482{ 505{
483 //qDebug("KABCore::recieve "); 506 //qDebug("KABCore::recieve ");
484 int count = mAddressBook->importFromFile( fn, true ); 507 int count = mAddressBook->importFromFile( fn, true );
485 if ( count ) 508 if ( count )
486 setModified( true ); 509 setModified( true );
487 mViewManager->refreshView(); 510 mViewManager->refreshView();
488 message(i18n("%1 contact(s) received!").arg( count )); 511 message(i18n("%1 contact(s) received!").arg( count ));
489 topLevelWidget()->showMaximized(); 512 topLevelWidget()->showMaximized();
490 topLevelWidget()->raise(); 513 topLevelWidget()->raise();
491} 514}
492void KABCore::restoreSettings() 515void KABCore::restoreSettings()
493{ 516{
494 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 517 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
495 518
496 bool state; 519 bool state;
497 520
498 if (mMultipleViewsAtOnce) 521 if (mMultipleViewsAtOnce)
499 state = KABPrefs::instance()->mDetailsPageVisible; 522 state = KABPrefs::instance()->mDetailsPageVisible;
500 else 523 else
501 state = false; 524 state = false;
502 525
503 mActionDetails->setChecked( state ); 526 mActionDetails->setChecked( state );
504 setDetailsVisible( state ); 527 setDetailsVisible( state );
505 528
506 state = KABPrefs::instance()->mJumpButtonBarVisible; 529 state = KABPrefs::instance()->mJumpButtonBarVisible;
507 530
508 mActionJumpBar->setChecked( state ); 531 mActionJumpBar->setChecked( state );
509 setJumpButtonBarVisible( state ); 532 setJumpButtonBarVisible( state );
510/*US 533/*US
511 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 534 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
512 if ( splitterSize.count() == 0 ) { 535 if ( splitterSize.count() == 0 ) {
513 splitterSize.append( width() / 2 ); 536 splitterSize.append( width() / 2 );
514 splitterSize.append( width() / 2 ); 537 splitterSize.append( width() / 2 );
515 } 538 }
516 mMiniSplitter->setSizes( splitterSize ); 539 mMiniSplitter->setSizes( splitterSize );
517 if ( mExtensionBarSplitter ) { 540 if ( mExtensionBarSplitter ) {
518 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 541 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
519 if ( splitterSize.count() == 0 ) { 542 if ( splitterSize.count() == 0 ) {
520 splitterSize.append( width() / 2 ); 543 splitterSize.append( width() / 2 );
521 splitterSize.append( width() / 2 ); 544 splitterSize.append( width() / 2 );
522 } 545 }
523 mExtensionBarSplitter->setSizes( splitterSize ); 546 mExtensionBarSplitter->setSizes( splitterSize );
524 547
525 } 548 }
526*/ 549*/
527 mViewManager->restoreSettings(); 550 mViewManager->restoreSettings();
528 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 551 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
529 mExtensionManager->restoreSettings(); 552 mExtensionManager->restoreSettings();
530#ifdef DESKTOP_VERSION 553#ifdef DESKTOP_VERSION
531 int wid = width(); 554 int wid = width();
532 if ( wid < 10 ) 555 if ( wid < 10 )
533 wid = 400; 556 wid = 400;
534#else 557#else
535 int wid = QApplication::desktop()->width(); 558 int wid = QApplication::desktop()->width();
536 if ( wid < 640 ) 559 if ( wid < 640 )
537 wid = QApplication::desktop()->height(); 560 wid = QApplication::desktop()->height();
538#endif 561#endif
539 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 562 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
540 if ( true /*splitterSize.count() == 0*/ ) { 563 if ( true /*splitterSize.count() == 0*/ ) {
541 splitterSize.append( wid / 2 ); 564 splitterSize.append( wid / 2 );
542 splitterSize.append( wid / 2 ); 565 splitterSize.append( wid / 2 );
543 } 566 }
544 mMiniSplitter->setSizes( splitterSize ); 567 mMiniSplitter->setSizes( splitterSize );
545 if ( mExtensionBarSplitter ) { 568 if ( mExtensionBarSplitter ) {
546 //splitterSize = KABPrefs::instance()->mExtensionsSplitter; 569 //splitterSize = KABPrefs::instance()->mExtensionsSplitter;
547 if ( true /*splitterSize.count() == 0*/ ) { 570 if ( true /*splitterSize.count() == 0*/ ) {
548 splitterSize.append( wid / 2 ); 571 splitterSize.append( wid / 2 );
549 splitterSize.append( wid / 2 ); 572 splitterSize.append( wid / 2 );
550 } 573 }
551 mExtensionBarSplitter->setSizes( splitterSize ); 574 mExtensionBarSplitter->setSizes( splitterSize );
552 575
553 } 576 }
554#ifdef DESKTOP_VERSION 577#ifdef DESKTOP_VERSION
555 KConfig *config = KABPrefs::instance()->getConfig(); 578 KConfig *config = KABPrefs::instance()->getConfig();
556 config->setGroup("WidgetLayout"); 579 config->setGroup("WidgetLayout");
557 QStringList list; 580 QStringList list;
558 list = config->readListEntry("MainLayout"); 581 list = config->readListEntry("MainLayout");
559 int x,y,w,h; 582 int x,y,w,h;
560 if ( ! list.isEmpty() ) { 583 if ( ! list.isEmpty() ) {
561 x = list[0].toInt(); 584 x = list[0].toInt();
562 y = list[1].toInt(); 585 y = list[1].toInt();
563 w = list[2].toInt(); 586 w = list[2].toInt();
564 h = list[3].toInt(); 587 h = list[3].toInt();
565 KApplication::testCoords( &x,&y,&w,&h ); 588 KApplication::testCoords( &x,&y,&w,&h );
566 topLevelWidget()->setGeometry(x,y,w,h); 589 topLevelWidget()->setGeometry(x,y,w,h);
567 590
568 } else { 591 } else {
569 topLevelWidget()->setGeometry( 40 ,40 , 640, 440); 592 topLevelWidget()->setGeometry( 40 ,40 , 640, 440);
570 } 593 }
571#endif 594#endif
572} 595}
573 596
574void KABCore::saveSettings() 597void KABCore::saveSettings()
575{ 598{
576 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); 599 KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked();
577 if ( mExtensionBarSplitter ) 600 if ( mExtensionBarSplitter )
578 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 601 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
579 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); 602 KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked();
580 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); 603 KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes();
581#ifndef KAB_EMBEDDED 604#ifndef KAB_EMBEDDED
582 605
583 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); 606 KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes();
584 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); 607 KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes();
585#endif //KAB_EMBEDDED 608#endif //KAB_EMBEDDED
586 mExtensionManager->saveSettings(); 609 mExtensionManager->saveSettings();
587 mViewManager->saveSettings(); 610 mViewManager->saveSettings();
588 611
589 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); 612 KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem();
590 613
591 KABPrefs::instance()->writeConfig(); 614 KABPrefs::instance()->writeConfig();
592 qDebug("KA: KABCore::saveSettings() "); 615 qDebug("KA: KABCore::saveSettings() ");
593} 616}
594 617
595KABC::AddressBook *KABCore::addressBook() const 618KABC::AddressBook *KABCore::addressBook() const
596{ 619{
597 return mAddressBook; 620 return mAddressBook;
598} 621}
599 622
600KConfig *KABCore::config() 623KConfig *KABCore::config()
@@ -2256,437 +2279,434 @@ void KABCore::addActionsManually()
2256 mActionImportOL->plug( ImportMenu ); 2279 mActionImportOL->plug( ImportMenu );
2257#endif 2280#endif
2258 // edit menu 2281 // edit menu
2259 mActionUndo->plug( editMenu ); 2282 mActionUndo->plug( editMenu );
2260 mActionRedo->plug( editMenu ); 2283 mActionRedo->plug( editMenu );
2261 editMenu->insertSeparator(); 2284 editMenu->insertSeparator();
2262 mActionCut->plug( editMenu ); 2285 mActionCut->plug( editMenu );
2263 mActionCopy->plug( editMenu ); 2286 mActionCopy->plug( editMenu );
2264 mActionPaste->plug( editMenu ); 2287 mActionPaste->plug( editMenu );
2265 mActionDelete->plug( editMenu ); 2288 mActionDelete->plug( editMenu );
2266 editMenu->insertSeparator(); 2289 editMenu->insertSeparator();
2267 mActionSelectAll->plug( editMenu ); 2290 mActionSelectAll->plug( editMenu );
2268 2291
2269 mActionSetFormattedName->plug( changeMenu ); 2292 mActionSetFormattedName->plug( changeMenu );
2270 mActionRemoveVoice->plug( changeMenu ); 2293 mActionRemoveVoice->plug( changeMenu );
2271 // settingsmings menu 2294 // settingsmings menu
2272//US special menuentry to configure the addressbook resources. On KDE 2295//US special menuentry to configure the addressbook resources. On KDE
2273// you do that through the control center !!! 2296// you do that through the control center !!!
2274 // settingsMenu->insertSeparator(); 2297 // settingsMenu->insertSeparator();
2275 2298
2276 mActionConfigKAddressbook->plug( settingsMenu, 0 ); 2299 mActionConfigKAddressbook->plug( settingsMenu, 0 );
2277 mActionConfigGlobal->plug( settingsMenu, 1 ); 2300 mActionConfigGlobal->plug( settingsMenu, 1 );
2278 mActionConfigResources->plug( settingsMenu,2 ); 2301 mActionConfigResources->plug( settingsMenu,2 );
2279 settingsMenu->insertSeparator(3); 2302 settingsMenu->insertSeparator(3);
2280 2303
2281 if ( mIsPart ) { 2304 if ( mIsPart ) {
2282 //US not implemented yet 2305 //US not implemented yet
2283 //mActionConfigShortcuts->plug( settingsMenu ); 2306 //mActionConfigShortcuts->plug( settingsMenu );
2284 //mActionConfigureToolbars->plug( settingsMenu ); 2307 //mActionConfigureToolbars->plug( settingsMenu );
2285 2308
2286 } else { 2309 } else {
2287 //US not implemented yet 2310 //US not implemented yet
2288 //mActionKeyBindings->plug( settingsMenu ); 2311 //mActionKeyBindings->plug( settingsMenu );
2289 } 2312 }
2290 2313
2291 mActionEditCategories->plug( settingsMenu ); 2314 mActionEditCategories->plug( settingsMenu );
2292 mActionManageCategories->plug( settingsMenu ); 2315 mActionManageCategories->plug( settingsMenu );
2293 mActionJumpBar->plug( viewMenu,0 ); 2316 mActionJumpBar->plug( viewMenu,0 );
2294 mActionDetails->plug( viewMenu,0 ); 2317 mActionDetails->plug( viewMenu,0 );
2295 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) 2318 //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop )
2296 mActionDetails->plug( tb ); 2319 mActionDetails->plug( tb );
2297 settingsMenu->insertSeparator(); 2320 settingsMenu->insertSeparator();
2298#ifndef DESKTOP_VERSION 2321#ifndef DESKTOP_VERSION
2299 if ( Ir::supported() ) mActionBR->plug(settingsMenu ); 2322 if ( Ir::supported() ) mActionBR->plug(settingsMenu );
2300 settingsMenu->insertSeparator(); 2323 settingsMenu->insertSeparator();
2301#endif 2324#endif
2302 2325
2303 mActionWhoAmI->plug( settingsMenu ); 2326 mActionWhoAmI->plug( settingsMenu );
2304 //mActionEditCategories->plug( changeMenu ); 2327 //mActionEditCategories->plug( changeMenu );
2305 mActionCategories->plug( changeMenu ); 2328 mActionCategories->plug( changeMenu );
2306 //mActionManageCategories->plug( changeMenu ); 2329 //mActionManageCategories->plug( changeMenu );
2307 2330
2308 //mActionCategories->plug( settingsMenu ); 2331 //mActionCategories->plug( settingsMenu );
2309 2332
2310 2333
2311 mActionWN->plug( helpMenu ); 2334 mActionWN->plug( helpMenu );
2312 mActionStorageHowto->plug( helpMenu ); 2335 mActionStorageHowto->plug( helpMenu );
2313 mActionSyncHowto->plug( helpMenu ); 2336 mActionSyncHowto->plug( helpMenu );
2314 mActionKdeSyncHowto->plug( helpMenu ); 2337 mActionKdeSyncHowto->plug( helpMenu );
2315 mActionMultiSyncHowto->plug( helpMenu ); 2338 mActionMultiSyncHowto->plug( helpMenu );
2316 mActionFaq->plug( helpMenu ); 2339 mActionFaq->plug( helpMenu );
2317 mActionLicence->plug( helpMenu ); 2340 mActionLicence->plug( helpMenu );
2318 mActionAboutKAddressbook->plug( helpMenu ); 2341 mActionAboutKAddressbook->plug( helpMenu );
2319 2342
2320 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2343 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2321 2344
2322 mActionSave->plug( tb ); 2345 mActionSave->plug( tb );
2323 mViewManager->getFilterAction()->plug ( tb); 2346 mViewManager->getFilterAction()->plug ( tb);
2324 //LR hide filteraction on started in 480x640 2347 //LR hide filteraction on started in 480x640
2325 if (QApplication::desktop()->width() == 480 ) { 2348 if (QApplication::desktop()->width() == 480 ) {
2326 mViewManager->getFilterAction()->setComboWidth( 0 ); 2349 mViewManager->getFilterAction()->setComboWidth( 0 );
2327 } 2350 }
2328 mActionUndo->plug( tb ); 2351 mActionUndo->plug( tb );
2329 mActionDelete->plug( tb ); 2352 mActionDelete->plug( tb );
2330 mActionRedo->plug( tb ); 2353 mActionRedo->plug( tb );
2331 } else { 2354 } else {
2332 mActionSave->plug( tb ); 2355 mActionSave->plug( tb );
2333 tb->enableMoving(false); 2356 tb->enableMoving(false);
2334 } 2357 }
2335 //mActionQuit->plug ( tb ); 2358 //mActionQuit->plug ( tb );
2336 //tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2359 //tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2337 2360
2338 //US link the searchwidget first to this. 2361 //US link the searchwidget first to this.
2339 // The real linkage to the toolbar happens later. 2362 // The real linkage to the toolbar happens later.
2340//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2363//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2341//US tb->insertItem( mIncSearchWidget ); 2364//US tb->insertItem( mIncSearchWidget );
2342/*US 2365/*US
2343 mIncSearchWidget = new IncSearchWidget( tb ); 2366 mIncSearchWidget = new IncSearchWidget( tb );
2344 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2367 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2345 SLOT( incrementalSearch( const QString& ) ) ); 2368 SLOT( incrementalSearch( const QString& ) ) );
2346 2369
2347 mJumpButtonBar = new JumpButtonBar( this, this ); 2370 mJumpButtonBar = new JumpButtonBar( this, this );
2348 2371
2349//US topLayout->addWidget( mJumpButtonBar ); 2372//US topLayout->addWidget( mJumpButtonBar );
2350 this->layout()->add( mJumpButtonBar ); 2373 this->layout()->add( mJumpButtonBar );
2351*/ 2374*/
2352 2375
2353#endif //KAB_EMBEDDED 2376#endif //KAB_EMBEDDED
2354 2377
2355 mActionExport2phone->plug( ExportMenu ); 2378 mActionExport2phone->plug( ExportMenu );
2356 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2379 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2357 syncManager->fillSyncMenu(); 2380 syncManager->fillSyncMenu();
2358 2381
2359} 2382}
2360void KABCore::showLicence() 2383void KABCore::showLicence()
2361{ 2384{
2362 KApplication::showLicence(); 2385 KApplication::showLicence();
2363} 2386}
2364 2387
2365void KABCore::manageCategories( ) 2388void KABCore::manageCategories( )
2366{ 2389{
2367 KABCatPrefs* cp = new KABCatPrefs(); 2390 KABCatPrefs* cp = new KABCatPrefs();
2368 cp->show(); 2391 cp->show();
2369 int w =cp->sizeHint().width() ; 2392 int w =cp->sizeHint().width() ;
2370 int h = cp->sizeHint().height() ; 2393 int h = cp->sizeHint().height() ;
2371 int dw = QApplication::desktop()->width(); 2394 int dw = QApplication::desktop()->width();
2372 int dh = QApplication::desktop()->height(); 2395 int dh = QApplication::desktop()->height();
2373 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2396 cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2374 if ( !cp->exec() ) { 2397 if ( !cp->exec() ) {
2375 delete cp; 2398 delete cp;
2376 return; 2399 return;
2377 } 2400 }
2378 int count = 0; 2401 int count = 0;
2379 int cc = 0; 2402 int cc = 0;
2380 message( i18n("Please wait, processing categories...")); 2403 message( i18n("Please wait, processing categories..."));
2381 if ( cp->addCat() ) { 2404 if ( cp->addCat() ) {
2382 KABC::AddressBook::Iterator it; 2405 KABC::AddressBook::Iterator it;
2383 QStringList catList = KABPrefs::instance()->mCustomCategories; 2406 QStringList catList = KABPrefs::instance()->mCustomCategories;
2384 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2407 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2385 ++cc; 2408 ++cc;
2386 if ( cc %10 == 0) 2409 if ( cc %10 == 0)
2387 message(i18n("Processing contact #%1").arg(cc)); 2410 message(i18n("Processing contact #%1").arg(cc));
2388 QStringList catIncList = (*it).categories(); 2411 QStringList catIncList = (*it).categories();
2389 int i; 2412 int i;
2390 for( i = 0; i< catIncList.count(); ++i ) { 2413 for( i = 0; i< catIncList.count(); ++i ) {
2391 if ( !catList.contains (catIncList[i])) { 2414 if ( !catList.contains (catIncList[i])) {
2392 catList.append( catIncList[i] ); 2415 catList.append( catIncList[i] );
2393 //qDebug("add cat %s ", catIncList[i].latin1()); 2416 //qDebug("add cat %s ", catIncList[i].latin1());
2394 ++count; 2417 ++count;
2395 } 2418 }
2396 } 2419 }
2397 } 2420 }
2398 catList.sort(); 2421 catList.sort();
2399 KABPrefs::instance()->mCustomCategories = catList; 2422 KABPrefs::instance()->mCustomCategories = catList;
2400 KABPrefs::instance()->writeConfig(); 2423 KABPrefs::instance()->writeConfig();
2401 message(QString::number( count )+ i18n(" categories added to list! ")); 2424 message(QString::number( count )+ i18n(" categories added to list! "));
2402 } else { 2425 } else {
2403 QStringList catList = KABPrefs::instance()->mCustomCategories; 2426 QStringList catList = KABPrefs::instance()->mCustomCategories;
2404 QStringList catIncList; 2427 QStringList catIncList;
2405 QStringList newCatList; 2428 QStringList newCatList;
2406 KABC::AddressBook::Iterator it; 2429 KABC::AddressBook::Iterator it;
2407 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2430 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2408 ++cc; 2431 ++cc;
2409 if ( cc %10 == 0) 2432 if ( cc %10 == 0)
2410 message(i18n("Processing contact #%1").arg(cc)); 2433 message(i18n("Processing contact #%1").arg(cc));
2411 QStringList catIncList = (*it).categories(); 2434 QStringList catIncList = (*it).categories();
2412 int i; 2435 int i;
2413 if ( catIncList.count() ) { 2436 if ( catIncList.count() ) {
2414 newCatList.clear(); 2437 newCatList.clear();
2415 for( i = 0; i< catIncList.count(); ++i ) { 2438 for( i = 0; i< catIncList.count(); ++i ) {
2416 if ( catList.contains (catIncList[i])) { 2439 if ( catList.contains (catIncList[i])) {
2417 newCatList.append( catIncList[i] ); 2440 newCatList.append( catIncList[i] );
2418 } 2441 }
2419 } 2442 }
2420 newCatList.sort(); 2443 newCatList.sort();
2421 (*it).setCategories( newCatList ); 2444 (*it).setCategories( newCatList );
2422 mAddressBook->insertAddressee( (*it) ); 2445 mAddressBook->insertAddressee( (*it) );
2423 } 2446 }
2424 } 2447 }
2425 setModified( true ); 2448 setModified( true );
2426 mViewManager->refreshView(); 2449 mViewManager->refreshView();
2427 message( i18n("Removing categories done!")); 2450 message( i18n("Removing categories done!"));
2428 } 2451 }
2429 delete cp; 2452 delete cp;
2430} 2453}
2431void KABCore::removeVoice() 2454void KABCore::removeVoice()
2432{ 2455{
2433 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 ) 2456 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 )
2434 return; 2457 return;
2435 XXPortSelectDialog dlg( this, false, this ); 2458 XXPortSelectDialog dlg( this, false, this );
2436 if ( !dlg.exec() ) 2459 if ( !dlg.exec() )
2437 return; 2460 return;
2438 mAddressBook->setUntagged(); 2461 mAddressBook->setUntagged();
2439 dlg.tagSelected(); 2462 dlg.tagSelected();
2440 message(i18n("Removing voice..."), false ); 2463 message(i18n("Removing voice..."), false );
2441 KABC::AddressBook::Iterator it; 2464 KABC::AddressBook::Iterator it;
2442 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2465 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2443 if ( (*it).tagged() ) { 2466 if ( (*it).tagged() ) {
2444 (*it).removeVoice(); 2467 (*it).removeVoice();
2445 } 2468 }
2446 } 2469 }
2447 message(i18n("Refreshing view...") ); 2470 message(i18n("Refreshing view...") );
2448 qApp->processEvents();
2449 mViewManager->refreshView( "" ); 2471 mViewManager->refreshView( "" );
2450 Addressee add; 2472 Addressee add;
2451 mDetails->setAddressee( add ); 2473 mDetails->setAddressee( add );
2452 message(i18n("Remove voice completed!") ); 2474 message(i18n("Remove voice completed!") );
2453 2475
2454 2476
2455 2477
2456} 2478}
2457 2479
2458void KABCore::setFormattedName() 2480void KABCore::setFormattedName()
2459{ 2481{
2460 KABFormatPrefs setpref; 2482 KABFormatPrefs setpref;
2461 if ( !setpref.exec() ) { 2483 if ( !setpref.exec() ) {
2462 return; 2484 return;
2463 } 2485 }
2464 XXPortSelectDialog dlg( this, false, this ); 2486 XXPortSelectDialog dlg( this, false, this );
2465 if ( !dlg.exec() ) 2487 if ( !dlg.exec() )
2466 return; 2488 return;
2467 mAddressBook->setUntagged(); 2489 mAddressBook->setUntagged();
2468 dlg.tagSelected(); 2490 dlg.tagSelected();
2469 int count = 0; 2491 int count = 0;
2470 KABC::AddressBook::Iterator it; 2492 KABC::AddressBook::Iterator it;
2471 bool modified = false; 2493 bool modified = false;
2472 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2494 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2473 if ( (*it).tagged() ) { 2495 if ( (*it).tagged() ) {
2474 if ( (*it).uid().left( 2 ) == "la" ) 2496 if ( (*it).uid().left( 2 ) == "la" )
2475 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) 2497 if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") )
2476 continue; 2498 continue;
2477 ++count; 2499 ++count;
2478 if ( count %10 == 0 ) 2500 if ( count %10 == 0 )
2479 message(i18n("Changing contact #%1").arg( count ) ); 2501 message(i18n("Changing contact #%1").arg( count ) );
2480 qApp->processEvents();
2481 QString fName; 2502 QString fName;
2482 if ( setpref.simple->isChecked() ) 2503 if ( setpref.simple->isChecked() )
2483 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); 2504 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
2484 else if ( setpref.full->isChecked() ) 2505 else if ( setpref.full->isChecked() )
2485 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); 2506 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
2486 else if ( setpref.reverse->isChecked() ) 2507 else if ( setpref.reverse->isChecked() )
2487 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); 2508 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
2488 else 2509 else
2489 fName = (*it).organization(); 2510 fName = (*it).organization();
2490 if ( setpref.setCompany->isChecked() ) 2511 if ( setpref.setCompany->isChecked() )
2491 if ( fName.isEmpty() || fName =="," ) 2512 if ( fName.isEmpty() || fName =="," )
2492 fName = (*it).organization(); 2513 fName = (*it).organization();
2493 (*it).setFormattedName( fName ); 2514 (*it).setFormattedName( fName );
2494 (*it).setChanged( true ); 2515 (*it).setChanged( true );
2495 modified = true; 2516 modified = true;
2496 (*it).setRevision( QDateTime::currentDateTime() ); 2517 (*it).setRevision( QDateTime::currentDateTime() );
2497 } 2518 }
2498 } 2519 }
2499 message(i18n("Refreshing view...") ); 2520 message(i18n("Refreshing view...") );
2500 qApp->processEvents();
2501 if ( modified ) 2521 if ( modified )
2502 setModified( true ); 2522 setModified( true );
2503 Addressee add; 2523 Addressee add;
2504 mDetails->setAddressee( add ); 2524 mDetails->setAddressee( add );
2505 if ( count == 0 ) 2525 if ( count == 0 )
2506 message(i18n("No contact changed!") ); 2526 message(i18n("No contact changed!") );
2507 else 2527 else
2508 message(i18n("%1 contacts changed!").arg( count ) ); 2528 message(i18n("%1 contacts changed!").arg( count ) );
2509} 2529}
2510 2530
2511void KABCore::clipboardDataChanged() 2531void KABCore::clipboardDataChanged()
2512{ 2532{
2513 2533
2514 if ( mReadWrite ) 2534 if ( mReadWrite )
2515 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2535 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2516 2536
2517} 2537}
2518 2538
2519void KABCore::updateActionMenu() 2539void KABCore::updateActionMenu()
2520{ 2540{
2521 UndoStack *undo = UndoStack::instance(); 2541 UndoStack *undo = UndoStack::instance();
2522 RedoStack *redo = RedoStack::instance(); 2542 RedoStack *redo = RedoStack::instance();
2523 2543
2524 if ( undo->isEmpty() ) 2544 if ( undo->isEmpty() )
2525 mActionUndo->setText( i18n( "Undo" ) ); 2545 mActionUndo->setText( i18n( "Undo" ) );
2526 else 2546 else
2527 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2547 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2528 2548
2529 mActionUndo->setEnabled( !undo->isEmpty() ); 2549 mActionUndo->setEnabled( !undo->isEmpty() );
2530 2550
2531 if ( !redo->top() ) 2551 if ( !redo->top() )
2532 mActionRedo->setText( i18n( "Redo" ) ); 2552 mActionRedo->setText( i18n( "Redo" ) );
2533 else 2553 else
2534 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2554 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2535 2555
2536 mActionRedo->setEnabled( !redo->isEmpty() ); 2556 mActionRedo->setEnabled( !redo->isEmpty() );
2537} 2557}
2538 2558
2539void KABCore::configureKeyBindings() 2559void KABCore::configureKeyBindings()
2540{ 2560{
2541#ifndef KAB_EMBEDDED 2561#ifndef KAB_EMBEDDED
2542 KKeyDialog::configure( actionCollection(), true ); 2562 KKeyDialog::configure( actionCollection(), true );
2543#else //KAB_EMBEDDED 2563#else //KAB_EMBEDDED
2544 qDebug("KABCore::configureKeyBindings() not implemented"); 2564 qDebug("KABCore::configureKeyBindings() not implemented");
2545#endif //KAB_EMBEDDED 2565#endif //KAB_EMBEDDED
2546} 2566}
2547 2567
2548#ifdef KAB_EMBEDDED 2568#ifdef KAB_EMBEDDED
2549void KABCore::configureResources() 2569void KABCore::configureResources()
2550{ 2570{
2551 KRES::KCMKResources dlg( this, "" , 0 ); 2571 KRES::KCMKResources dlg( this, "" , 0 );
2552 2572
2553 if ( !dlg.exec() ) 2573 if ( !dlg.exec() )
2554 return; 2574 return;
2555 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2575 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2556} 2576}
2557#endif //KAB_EMBEDDED 2577#endif //KAB_EMBEDDED
2558 2578
2559 2579
2560/* this method will be called through the QCop interface from Ko/Pi to select addresses 2580/* this method will be called through the QCop interface from Ko/Pi to select addresses
2561 * for the attendees list of an event. 2581 * for the attendees list of an event.
2562 */ 2582 */
2563void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2583void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2564{ 2584{
2565 qDebug("KABCore::requestForNameEmailUidList "); 2585 qDebug("KABCore::requestForNameEmailUidList ");
2566 bool ok = false; 2586 bool ok = false;
2567 mEmailSourceChannel = sourceChannel; 2587 mEmailSourceChannel = sourceChannel;
2568 mEmailSourceUID = uid; 2588 mEmailSourceUID = uid;
2569 QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); 2589 QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) );
2570 //callContactdialog(); 2590 //callContactdialog();
2571#if 0 2591#if 0
2572 int wid = uid.toInt( &ok ); 2592 int wid = uid.toInt( &ok );
2573 qDebug("UID %s ", uid.latin1()); 2593 qDebug("UID %s ", uid.latin1());
2574 if ( ok ) { 2594 if ( ok ) {
2575 if ( wid != QApplication::desktop()->width() ) { 2595 if ( wid != QApplication::desktop()->width() ) {
2576 qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); 2596 qDebug("KA/Pi: Request from different desktop geometry. Resizing ...");
2577 message( i18n("Resizing, please wait...") ); 2597 message( i18n("Resizing, please wait...") );
2578 mMainWindow->showMinimized(); 2598 mMainWindow->showMinimized();
2579 /* 2599 /*
2580 { 2600 {
2581 QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); 2601 QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
2582 } 2602 }
2583 */ 2603 */
2584 QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) ); 2604 QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) );
2585 return; 2605 return;
2586 } 2606 }
2587 2607
2588 } else { 2608 } else {
2589 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); 2609 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid ");
2590 } 2610 }
2591 callContactdialog(); 2611 callContactdialog();
2592 //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()"); 2612 //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
2593#endif 2613#endif
2594} 2614}
2595void KABCore::resizeAndCallContactdialog() 2615void KABCore::resizeAndCallContactdialog()
2596{ 2616{
2597 updateMainWindow(); 2617 updateMainWindow();
2598 QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) ); 2618 QTimer::singleShot( 10,this, SLOT ( callContactdialog() ) );
2599} 2619}
2600 2620
2601void KABCore::doRingSync() 2621void KABCore::doRingSync()
2602{ 2622{
2603 topLevelWidget()->raise(); 2623 topLevelWidget()->raise();
2604 syncManager->multiSync( false ); 2624 syncManager->multiSync( false );
2605} 2625}
2606void KABCore::callContactdialog() 2626void KABCore::callContactdialog()
2607{ 2627{
2608 static bool running = false; 2628 static bool running = false;
2609 if (running) return; 2629 if (running) return;
2610 running = true; 2630 running = true;
2611 QStringList nameList; 2631 QStringList nameList;
2612 QStringList emailList; 2632 QStringList emailList;
2613 QStringList uidList; 2633 QStringList uidList;
2614 qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() ); 2634 qDebug(" KABCore::callContactdialog:DESKTOP WIDTH %d ", QApplication::desktop()->width() );
2615 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2635 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2616 uint i=0; 2636 uint i=0;
2617 for (i=0; i < list.count(); i++) 2637 for (i=0; i < list.count(); i++)
2618 { 2638 {
2619 nameList.append(list[i].realName()); 2639 nameList.append(list[i].realName());
2620 emailList.append(list[i].preferredEmail()); 2640 emailList.append(list[i].preferredEmail());
2621 uidList.append(list[i].uid()); 2641 uidList.append(list[i].uid());
2622 } 2642 }
2623 QString uid = mEmailSourceUID; 2643 QString uid = mEmailSourceUID;
2624 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); 2644 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1());
2625 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList); 2645 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList);
2626 running = false; 2646 running = false;
2627} 2647}
2628/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2648/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2629 * to put them into the calendar. 2649 * to put them into the calendar.
2630 */ 2650 */
2631void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2651void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2632{ 2652{
2633 // qDebug("KABCore::requestForBirthdayList"); 2653 // qDebug("KABCore::requestForBirthdayList");
2634 QStringList birthdayList; 2654 QStringList birthdayList;
2635 QStringList anniversaryList; 2655 QStringList anniversaryList;
2636 QStringList realNameList; 2656 QStringList realNameList;
2637 QStringList preferredEmailList; 2657 QStringList preferredEmailList;
2638 QStringList assembledNameList; 2658 QStringList assembledNameList;
2639 QStringList uidList; 2659 QStringList uidList;
2640 2660
2641 KABC::AddressBook::Iterator it; 2661 KABC::AddressBook::Iterator it;
2642 2662
2643 int count = 0; 2663 int count = 0;
2644 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2664 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2645 ++count; 2665 ++count;
2646 } 2666 }
2647 QProgressBar bar(count,0 ); 2667 QProgressBar bar(count,0 );
2648 int w = 300; 2668 int w = 300;
2649 if ( QApplication::desktop()->width() < 320 ) 2669 if ( QApplication::desktop()->width() < 320 )
2650 w = 220; 2670 w = 220;
2651 int h = bar.sizeHint().height() ; 2671 int h = bar.sizeHint().height() ;
2652 int dw = QApplication::desktop()->width(); 2672 int dw = QApplication::desktop()->width();
2653 int dh = QApplication::desktop()->height(); 2673 int dh = QApplication::desktop()->height();
2654 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2674 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2655 bar.show(); 2675 bar.show();
2656 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2676 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2657 qApp->processEvents(); 2677 qApp->processEvents();
2658 2678
2659 QDate bday; 2679 QDate bday;
2660 QString anni; 2680 QString anni;
2661 QString formattedbday; 2681 QString formattedbday;
2662 2682
2663 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2683 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2664 { 2684 {
2665 if ( ! bar.isVisible() ) 2685 if ( ! bar.isVisible() )
2666 return; 2686 return;
2667 bar.setProgress( count++ ); 2687 bar.setProgress( count++ );
2668 qApp->processEvents(); 2688 qApp->processEvents();
2669 bday = (*it).birthday().date(); 2689 bday = (*it).birthday().date();
2670 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2690 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2671 2691
2672 if ( bday.isValid() || !anni.isEmpty()) 2692 if ( bday.isValid() || !anni.isEmpty())
2673 { 2693 {
2674 if (bday.isValid()) 2694 if (bday.isValid())
2675 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2695 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2676 else 2696 else
2677 formattedbday = "NOTVALID"; 2697 formattedbday = "NOTVALID";
2678 if (anni.isEmpty()) 2698 if (anni.isEmpty())
2679 anni = "INVALID"; 2699 anni = "INVALID";
2680 2700
2681 birthdayList.append(formattedbday); 2701 birthdayList.append(formattedbday);
2682 anniversaryList.append(anni); //should be ISODate 2702 anniversaryList.append(anni); //should be ISODate
2683 realNameList.append((*it).realName()); 2703 realNameList.append((*it).realName());
2684 preferredEmailList.append((*it).preferredEmail()); 2704 preferredEmailList.append((*it).preferredEmail());
2685 assembledNameList.append((*it).realName()); 2705 assembledNameList.append((*it).realName());
2686 uidList.append((*it).uid()); 2706 uidList.append((*it).uid());
2687 2707
2688 //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() ); 2708 //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() );
2689 } 2709 }
2690 } 2710 }
2691 2711
2692 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2712 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index ceeeda7..42b7709 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -165,367 +165,371 @@ class KABCore : public QWidget, public KSyncInterface
165 */ 165 */
166 void sendMail(); 166 void sendMail();
167 167
168 /** 168 /**
169 Opens the preferred mail composer with the given contacts as 169 Opens the preferred mail composer with the given contacts as
170 arguments. 170 arguments.
171 */ 171 */
172 void sendMail( const QString& email ); 172 void sendMail( const QString& email );
173 173
174 174
175 void mailVCard(); 175 void mailVCard();
176 void mailVCard(const QStringList& uids); 176 void mailVCard(const QStringList& uids);
177 177
178 /** 178 /**
179 Beams the "WhoAmI contact. 179 Beams the "WhoAmI contact.
180 */ 180 */
181 void beamMySelf(); 181 void beamMySelf();
182 182
183 void beamVCard(); 183 void beamVCard();
184 void export2phone(); 184 void export2phone();
185 void beamVCard(const QStringList& uids); 185 void beamVCard(const QStringList& uids);
186 void beamDone( Ir *ir ); 186 void beamDone( Ir *ir );
187 187
188 188
189 /** 189 /**
190 Starts the preferred web browser with the given URL as argument. 190 Starts the preferred web browser with the given URL as argument.
191 */ 191 */
192 void browse( const QString& url ); 192 void browse( const QString& url );
193 193
194 /** 194 /**
195 Select all contacts in the view. 195 Select all contacts in the view.
196 */ 196 */
197 void selectAllContacts(); 197 void selectAllContacts();
198 198
199 /** 199 /**
200 Deletes all selected contacts from the address book. 200 Deletes all selected contacts from the address book.
201 */ 201 */
202 void deleteContacts(); 202 void deleteContacts();
203 203
204 /** 204 /**
205 Deletes given contacts from the address book. 205 Deletes given contacts from the address book.
206 206
207 @param uids The uids of the contacts, which shall be deleted. 207 @param uids The uids of the contacts, which shall be deleted.
208 */ 208 */
209 void deleteContacts( const QStringList &uids ); 209 void deleteContacts( const QStringList &uids );
210 210
211 /** 211 /**
212 Copys the selected contacts into clipboard for later pasting. 212 Copys the selected contacts into clipboard for later pasting.
213 */ 213 */
214 void copyContacts(); 214 void copyContacts();
215 215
216 /** 216 /**
217 Cuts the selected contacts and stores them for later pasting. 217 Cuts the selected contacts and stores them for later pasting.
218 */ 218 */
219 void cutContacts(); 219 void cutContacts();
220 220
221 /** 221 /**
222 Paste contacts from clipboard into the address book. 222 Paste contacts from clipboard into the address book.
223 */ 223 */
224 void pasteContacts(); 224 void pasteContacts();
225 225
226 /** 226 /**
227 Paste given contacts into the address book. 227 Paste given contacts into the address book.
228 228
229 @param list The list of addressee, which shall be pasted. 229 @param list The list of addressee, which shall be pasted.
230 */ 230 */
231 void pasteContacts( KABC::Addressee::List &list ); 231 void pasteContacts( KABC::Addressee::List &list );
232 232
233 /** 233 /**
234 Sets the whoAmI contact, that is used by many other programs to 234 Sets the whoAmI contact, that is used by many other programs to
235 get personal information about the current user. 235 get personal information about the current user.
236 */ 236 */
237 void setWhoAmI(); 237 void setWhoAmI();
238 238
239 /** 239 /**
240 Displays the category dialog and applies the result to all 240 Displays the category dialog and applies the result to all
241 selected contacts. 241 selected contacts.
242 */ 242 */
243 void setCategories(); 243 void setCategories();
244 void manageCategories(); 244 void manageCategories();
245 void editCategories(); 245 void editCategories();
246 246
247 /** 247 /**
248 Sets the field list of the Incremental Search Widget. 248 Sets the field list of the Incremental Search Widget.
249 */ 249 */
250 void setSearchFields( const KABC::Field::List &fields ); 250 void setSearchFields( const KABC::Field::List &fields );
251 251
252 /** 252 /**
253 Search with the current search field for a contact, that matches 253 Search with the current search field for a contact, that matches
254 the given text, and selects it in the view. 254 the given text, and selects it in the view.
255 */ 255 */
256 void incrementalSearch( const QString& text ); 256 void incrementalSearch( const QString& text );
257 void incrementalSearchJump( const QString& text ); 257 void incrementalSearchJump( const QString& text );
258 258
259 /** 259 /**
260 Marks the address book as modified. 260 Marks the address book as modified.
261 */ 261 */
262 void setModified(); 262 void setModified();
263 /** 263 /**
264 Marks the address book as modified without refreshing the view. 264 Marks the address book as modified without refreshing the view.
265 */ 265 */
266 void setModifiedWOrefresh(); 266 void setModifiedWOrefresh();
267 267
268 /** 268 /**
269 Marks the address book as modified concerning the argument. 269 Marks the address book as modified concerning the argument.
270 */ 270 */
271 void setModified( bool modified ); 271 void setModified( bool modified );
272 272
273 /** 273 /**
274 Returns whether the address book is modified. 274 Returns whether the address book is modified.
275 */ 275 */
276 bool modified() const; 276 bool modified() const;
277 277
278 /** 278 /**
279 Called whenever an contact is modified in the contact editor 279 Called whenever an contact is modified in the contact editor
280 dialog or the quick edit. 280 dialog or the quick edit.
281 */ 281 */
282 void contactModified( const KABC::Addressee &addr ); 282 void contactModified( const KABC::Addressee &addr );
283 void addrModified( const KABC::Addressee &addr, bool updateDetails = true ); 283 void addrModified( const KABC::Addressee &addr, bool updateDetails = true );
284 284
285 /** 285 /**
286 DCOP METHODS. 286 DCOP METHODS.
287 */ 287 */
288 void addEmail( QString addr ); 288 void addEmail( QString addr );
289 void importVCard( const KURL& url, bool showPreview ); 289 void importVCard( const KURL& url, bool showPreview );
290 void importVCard( const QString& vCard, bool showPreview ); 290 void importVCard( const QString& vCard, bool showPreview );
291 void newContact(); 291 void newContact();
292 QString getNameByPhone( const QString& phone ); 292 QString getNameByPhone( const QString& phone );
293 /** 293 /**
294 END DCOP METHODS 294 END DCOP METHODS
295 */ 295 */
296 296
297 /** 297 /**
298 Saves the contents of the AddressBook back to disk. 298 Saves the contents of the AddressBook back to disk.
299 */ 299 */
300 void save(); 300 void save();
301 301
302 /** 302 /**
303 Undos the last command using the undo stack. 303 Undos the last command using the undo stack.
304 */ 304 */
305 void undo(); 305 void undo();
306 306
307 /** 307 /**
308 Redos the last command that was undone, using the redo stack. 308 Redos the last command that was undone, using the redo stack.
309 */ 309 */
310 void redo(); 310 void redo();
311 311
312 /** 312 /**
313 Shows the edit dialog for the given uid. If the uid is QString::null, 313 Shows the edit dialog for the given uid. If the uid is QString::null,
314 the method will try to find a selected addressee in the view. 314 the method will try to find a selected addressee in the view.
315 */ 315 */
316 void editContact( const QString &uid /*US = QString::null*/ ); 316 void editContact( const QString &uid /*US = QString::null*/ );
317//US added a second method without defaultparameter 317//US added a second method without defaultparameter
318 void editContact2(); 318 void editContact2();
319 319
320 /** 320 /**
321 Shows or edits the detail view for the given uid. If the uid is QString::null, 321 Shows or edits the detail view for the given uid. If the uid is QString::null,
322 the method will try to find a selected addressee in the view. 322 the method will try to find a selected addressee in the view.
323 */ 323 */
324 void executeContact( const QString &uid /*US = QString::null*/ ); 324 void executeContact( const QString &uid /*US = QString::null*/ );
325 325
326 /** 326 /**
327 Launches the configuration dialog. 327 Launches the configuration dialog.
328 */ 328 */
329 void openConfigDialog(); 329 void openConfigDialog();
330 void openConfigGlobalDialog(); 330 void openConfigGlobalDialog();
331 331
332 /** 332 /**
333 Launches the ldap search dialog. 333 Launches the ldap search dialog.
334 */ 334 */
335 void openLDAPDialog(); 335 void openLDAPDialog();
336 336
337 /** 337 /**
338 Creates a KAddressBookPrinter, which will display the print 338 Creates a KAddressBookPrinter, which will display the print
339 dialog and do the printing. 339 dialog and do the printing.
340 */ 340 */
341 void print(); 341 void print();
342 342
343 /** 343 /**
344 Registers a new GUI client, so plugins can register its actions. 344 Registers a new GUI client, so plugins can register its actions.
345 */ 345 */
346 void addGUIClient( KXMLGUIClient *client ); 346 void addGUIClient( KXMLGUIClient *client );
347 347
348 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 348 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
349 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 349 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
350 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 350 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
351 351
352 352
353 signals: 353 signals:
354 void contactSelected( const QString &name ); 354 void contactSelected( const QString &name );
355 void contactSelected( const QPixmap &pixmap ); 355 void contactSelected( const QPixmap &pixmap );
356 public slots: 356 public slots:
357 void loadDataAfterStart();
357 void recieve(QString cmsg ); 358 void recieve(QString cmsg );
358 void getFile( bool success ); 359 void getFile( bool success );
359 void syncFileRequest(); 360 void syncFileRequest();
360 void setDetailsVisible( bool visible ); 361 void setDetailsVisible( bool visible );
361 void setDetailsToState(); 362 void setDetailsToState();
362 363
363 void saveSettings(); 364 void saveSettings();
364 365
365 private slots: 366 private slots:
366 void updateToolBar(); 367 void updateToolBar();
367 void updateMainWindow(); 368 void updateMainWindow();
368 void receive( const QCString& cmsg, const QByteArray& data ); 369 void receive( const QCString& cmsg, const QByteArray& data );
370 void receiveStart( const QCString& cmsg, const QByteArray& data );
369 void toggleBeamReceive( ); 371 void toggleBeamReceive( );
370 void disableBR(bool); 372 void disableBR(bool);
371 void setJumpButtonBarVisible( bool visible ); 373 void setJumpButtonBarVisible( bool visible );
372 void setJumpButtonBar( bool visible ); 374 void setJumpButtonBar( bool visible );
373 void setCaptionBack(); 375 void setCaptionBack();
374 void resizeAndCallContactdialog(); 376 void resizeAndCallContactdialog();
375 void callContactdialog(); 377 void callContactdialog();
376 void doRingSync(); 378 void doRingSync();
377 379
378 void importFromOL(); 380 void importFromOL();
379 void extensionModified( const KABC::Addressee::List &list ); 381 void extensionModified( const KABC::Addressee::List &list );
380 void extensionChanged( int id ); 382 void extensionChanged( int id );
381 void clipboardDataChanged(); 383 void clipboardDataChanged();
382 void updateActionMenu(); 384 void updateActionMenu();
383 void configureKeyBindings(); 385 void configureKeyBindings();
384 void removeVoice(); 386 void removeVoice();
385 void setFormattedName(); 387 void setFormattedName();
386#ifdef KAB_EMBEDDED 388#ifdef KAB_EMBEDDED
387 void configureResources(); 389 void configureResources();
388#endif //KAB_EMBEDDED 390#endif //KAB_EMBEDDED
389 391
390 void slotEditorDestroyed( const QString &uid ); 392 void slotEditorDestroyed( const QString &uid );
391 void configurationChanged(); 393 void configurationChanged();
392 void addressBookChanged(); 394 void addressBookChanged();
393 395
394 private: 396 private:
397 QCString mCStringMess;
398 QByteArray mByteData;
395 QString mEmailSourceChannel; 399 QString mEmailSourceChannel;
396 QString mEmailSourceUID; 400 QString mEmailSourceUID;
397 void resizeEvent(QResizeEvent* e ); 401 void resizeEvent(QResizeEvent* e );
398 bool mBRdisabled; 402 bool mBRdisabled;
399#ifndef DESKTOP_VERSION 403#ifndef DESKTOP_VERSION
400 QCopChannel* infrared; 404 QCopChannel* infrared;
401#endif 405#endif
402 QTimer *mMessageTimer; 406 QTimer *mMessageTimer;
403 void initGUI(); 407 void initGUI();
404 void initActions(); 408 void initActions();
405 QString getPhoneFile(); 409 QString getPhoneFile();
406 410
407 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 411 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
408 const char *name = 0 ); 412 const char *name = 0 );
409 413
410 KXMLGUIClient *mGUIClient; 414 KXMLGUIClient *mGUIClient;
411 415
412 KABC::AddressBook *mAddressBook; 416 KABC::AddressBook *mAddressBook;
413 417
414 ViewManager *mViewManager; 418 ViewManager *mViewManager;
415 // QSplitter *mDetailsSplitter; 419 // QSplitter *mDetailsSplitter;
416 KDGanttMinimizeSplitter *mExtensionBarSplitter; 420 KDGanttMinimizeSplitter *mExtensionBarSplitter;
417 ViewContainer *mDetails; 421 ViewContainer *mDetails;
418 KDGanttMinimizeSplitter* mMiniSplitter; 422 KDGanttMinimizeSplitter* mMiniSplitter;
419 XXPortManager *mXXPortManager; 423 XXPortManager *mXXPortManager;
420 JumpButtonBar *mJumpButtonBar; 424 JumpButtonBar *mJumpButtonBar;
421 IncSearchWidget *mIncSearchWidget; 425 IncSearchWidget *mIncSearchWidget;
422 ExtensionManager *mExtensionManager; 426 ExtensionManager *mExtensionManager;
423 427
424 KCMultiDialog *mConfigureDialog; 428 KCMultiDialog *mConfigureDialog;
425 429
426#ifndef KAB_EMBEDDED 430#ifndef KAB_EMBEDDED
427 LDAPSearchDialog *mLdapSearchDialog; 431 LDAPSearchDialog *mLdapSearchDialog;
428#endif //KAB_EMBEDDED 432#endif //KAB_EMBEDDED
429 // QDict<AddresseeEditorDialog> mEditorDict; 433 // QDict<AddresseeEditorDialog> mEditorDict;
430 AddresseeEditorDialog *mEditorDialog; 434 AddresseeEditorDialog *mEditorDialog;
431 bool mReadWrite; 435 bool mReadWrite;
432 bool mModified; 436 bool mModified;
433 bool mIsPart; 437 bool mIsPart;
434 bool mMultipleViewsAtOnce; 438 bool mMultipleViewsAtOnce;
435 439
436 440
437 //US file menu 441 //US file menu
438 KAction *mActionMail; 442 KAction *mActionMail;
439 KAction *mActionBeam; 443 KAction *mActionBeam;
440 KToggleAction *mActionBR; 444 KToggleAction *mActionBR;
441 KAction *mActionExport2phone; 445 KAction *mActionExport2phone;
442 KAction* mActionPrint; 446 KAction* mActionPrint;
443 KAction* mActionPrintDetails; 447 KAction* mActionPrintDetails;
444 KAction* mActionNewContact; 448 KAction* mActionNewContact;
445 KAction *mActionSave; 449 KAction *mActionSave;
446 KAction *mActionEditAddressee; 450 KAction *mActionEditAddressee;
447 KAction *mActionMailVCard; 451 KAction *mActionMailVCard;
448 KAction *mActionBeamVCard; 452 KAction *mActionBeamVCard;
449 453
450 KAction *mActionQuit; 454 KAction *mActionQuit;
451 455
452 //US edit menu 456 //US edit menu
453 KAction *mActionCopy; 457 KAction *mActionCopy;
454 KAction *mActionCut; 458 KAction *mActionCut;
455 KAction *mActionPaste; 459 KAction *mActionPaste;
456 KAction *mActionSelectAll; 460 KAction *mActionSelectAll;
457 KAction *mActionUndo; 461 KAction *mActionUndo;
458 KAction *mActionRedo; 462 KAction *mActionRedo;
459 KAction *mActionDelete; 463 KAction *mActionDelete;
460 464
461 //US settings menu 465 //US settings menu
462 KAction *mActionConfigResources; 466 KAction *mActionConfigResources;
463 KAction *mActionConfigGlobal; 467 KAction *mActionConfigGlobal;
464 KAction *mActionConfigKAddressbook; 468 KAction *mActionConfigKAddressbook;
465 KAction *mActionConfigShortcuts; 469 KAction *mActionConfigShortcuts;
466 KAction *mActionConfigureToolbars; 470 KAction *mActionConfigureToolbars;
467 KAction *mActionKeyBindings; 471 KAction *mActionKeyBindings;
468 KToggleAction *mActionJumpBar; 472 KToggleAction *mActionJumpBar;
469 KToggleAction *mActionDetails; 473 KToggleAction *mActionDetails;
470 KAction *mActionWhoAmI; 474 KAction *mActionWhoAmI;
471 KAction *mActionCategories; 475 KAction *mActionCategories;
472 KAction *mActionEditCategories; 476 KAction *mActionEditCategories;
473 KAction *mActionManageCategories; 477 KAction *mActionManageCategories;
474 KAction *mActionAboutKAddressbook; 478 KAction *mActionAboutKAddressbook;
475 KAction *mActionLicence; 479 KAction *mActionLicence;
476 KAction *mActionFaq; 480 KAction *mActionFaq;
477 KAction *mActionWN; 481 KAction *mActionWN;
478 KAction *mActionSyncHowto; 482 KAction *mActionSyncHowto;
479 KAction *mActionStorageHowto; 483 KAction *mActionStorageHowto;
480 KAction *mActionKdeSyncHowto; 484 KAction *mActionKdeSyncHowto;
481 KAction *mActionMultiSyncHowto; 485 KAction *mActionMultiSyncHowto;
482 486
483 KAction *mActionDeleteView; 487 KAction *mActionDeleteView;
484 488
485 QPopupMenu *viewMenu; 489 QPopupMenu *viewMenu;
486 QPopupMenu *filterMenu; 490 QPopupMenu *filterMenu;
487 QPopupMenu *settingsMenu; 491 QPopupMenu *settingsMenu;
488 QPopupMenu *changeMenu; 492 QPopupMenu *changeMenu;
489 QPopupMenu *beamMenu; 493 QPopupMenu *beamMenu;
490//US QAction *mActionSave; 494//US QAction *mActionSave;
491 QPopupMenu *ImportMenu; 495 QPopupMenu *ImportMenu;
492 QPopupMenu *ExportMenu; 496 QPopupMenu *ExportMenu;
493 //LR additional methods 497 //LR additional methods
494 KAction *mActionRemoveVoice; 498 KAction *mActionRemoveVoice;
495 KAction *mActionSetFormattedName; 499 KAction *mActionSetFormattedName;
496 KAction * mActionImportOL; 500 KAction * mActionImportOL;
497 501
498#ifndef KAB_EMBEDDED 502#ifndef KAB_EMBEDDED
499 KAddressBookService *mAddressBookService; 503 KAddressBookService *mAddressBookService;
500#endif //KAB_EMBEDDED 504#endif //KAB_EMBEDDED
501 505
502 class KABCorePrivate; 506 class KABCorePrivate;
503 KABCorePrivate *d; 507 KABCorePrivate *d;
504 //US bool mBlockSaveFlag; 508 //US bool mBlockSaveFlag;
505 509
506#ifdef KAB_EMBEDDED 510#ifdef KAB_EMBEDDED
507 KAddressBookMain *mMainWindow; // should be the same like mGUIClient 511 KAddressBookMain *mMainWindow; // should be the same like mGUIClient
508#endif //KAB_EMBEDDED 512#endif //KAB_EMBEDDED
509 513
510 //this are the overwritten callbackmethods from the syncinterface 514 //this are the overwritten callbackmethods from the syncinterface
511 virtual bool sync(KSyncManager* manager, QString filename, int mode); 515 virtual bool sync(KSyncManager* manager, QString filename, int mode);
512 virtual bool syncExternal(KSyncManager* manager, QString resource); 516 virtual bool syncExternal(KSyncManager* manager, QString resource);
513 virtual void removeSyncInfo( QString syncProfile); 517 virtual void removeSyncInfo( QString syncProfile);
514 bool syncPhone(); 518 bool syncPhone();
515 void message( QString m , bool startTimer = true); 519 void message( QString m , bool startTimer = true);
516 520
517 // LR ******************************* 521 // LR *******************************
518 // sync stuff! 522 // sync stuff!
519 QString sentSyncFile(); 523 QString sentSyncFile();
520 QPopupMenu *syncMenu; 524 QPopupMenu *syncMenu;
521 KSyncManager* syncManager; 525 KSyncManager* syncManager;
522 int mGlobalSyncMode; 526 int mGlobalSyncMode;
523 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode); 527 bool synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode);
524 KABC::Addressee getLastSyncAddressee(); 528 KABC::Addressee getLastSyncAddressee();
525 QDateTime mLastAddressbookSync; 529 QDateTime mLastAddressbookSync;
526 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full ); 530 int takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, int mode , bool full );
527 // ********************* 531 // *********************
528 532
529}; 533};
530 534
531#endif 535#endif
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index 519dc92..8fe3ee0 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -1,239 +1,241 @@
1/* 1/*
2 This file is part of KAddressbook. 2 This file is part of KAddressbook.
3 Copyright (c) 1999 Don Sanders <dsanders@kde.org> 3 Copyright (c) 1999 Don Sanders <dsanders@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#ifdef KAB_EMBEDDED 24#ifdef KAB_EMBEDDED
25#include "kabprefs.h" 25#include "kabprefs.h"
26#include <kglobal.h> 26#include <kglobal.h>
27#include <qmessagebox.h> 27#include <qmessagebox.h>
28#include <qtoolbar.h> 28#include <qtoolbar.h>
29#include <qapplication.h> 29#include <qapplication.h>
30#else //KAB_EMBEDDED 30#else //KAB_EMBEDDED
31#include <kedittoolbar.h> 31#include <kedittoolbar.h>
32#include <kkeydialog.h> 32#include <kkeydialog.h>
33#include <kmessagebox.h> 33#include <kmessagebox.h>
34#include <kstatusbar.h> 34#include <kstatusbar.h>
35#endif //KAB_EMBEDDED 35#endif //KAB_EMBEDDED
36#include <klocale.h> 36#include <klocale.h>
37 37
38#include "kabcore.h" 38#include "kabcore.h"
39#include "kaddressbookmain.h" 39#include "kaddressbookmain.h"
40#include "kactioncollection.h" 40#include "kactioncollection.h"
41 41
42#ifdef KAB_EMBEDDED 42#ifdef KAB_EMBEDDED
43KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "adrressbook" ) 43KAddressBookMain::KAddressBookMain() : KMainWindow( 0, "adrressbook" )
44#else //KAB_EMBEDDED 44#else //KAB_EMBEDDED
45//MOC_SKIP_BEGIN 45//MOC_SKIP_BEGIN
46KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 ) 46KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainWindow( 0 )
47//MOC_SKIP_END 47//MOC_SKIP_END
48#endif //KAB_EMBEDDED 48#endif //KAB_EMBEDDED
49{ 49{
50 setIcon(SmallIcon( "ka24" ) ); 50 setIcon(SmallIcon( "ka24" ) );
51#if 0 51#if 0
52 //US for embedded systems, create the toolbar before we initiate KABCore. 52 //US for embedded systems, create the toolbar before we initiate KABCore.
53 // KABCore will fill the toolbar with menues and icons 53 // KABCore will fill the toolbar with menues and icons
54 QMainWindow::ToolBarDock tbd; 54 QMainWindow::ToolBarDock tbd;
55 tbd = Top; 55 tbd = Top;
56 iconToolBar = new QToolBar( this ); 56 iconToolBar = new QToolBar( this );
57 addToolBar (iconToolBar , tbd ); 57 addToolBar (iconToolBar , tbd );
58 iconToolBar->setHorizontalStretchable(true); 58 iconToolBar->setHorizontalStretchable(true);
59//US iconToolBar->setWidth(300); 59//US iconToolBar->setWidth(300);
60#endif // 0 60#endif // 0
61 61
62 mCore = new KABCore( this, true, this ); 62 mCore = new KABCore( this, true, this );
63 63
64#ifdef KAB_EMBEDDED 64#ifdef KAB_EMBEDDED
65 setCaption( i18n( "KAddressbook/Pi" ) ); 65 setCaption( i18n( "KAddressbook/Pi" ) );
66#else //KAB_EMBEDDED 66#else //KAB_EMBEDDED
67 setCaption( i18n( "Address Book Browser" ) ); 67 setCaption( i18n( "Address Book Browser" ) );
68#endif //KAB_EMBEDDED 68#endif //KAB_EMBEDDED
69 69
70 //mCore->restoreSettings(); 70 //mCore->restoreSettings();
71 71
72 initActions(); 72 initActions();
73 73
74 setCentralWidget( mCore ); 74 setCentralWidget( mCore );
75 75
76//US statusBar()->show(); 76//US statusBar()->show();
77 77
78#ifndef KAB_EMBEDDED 78#ifndef KAB_EMBEDDED
79 setStandardToolBarMenuEnabled(true); 79 setStandardToolBarMenuEnabled(true);
80 80
81 createGUI( "kaddressbookui.rc", false ); 81 createGUI( "kaddressbookui.rc", false );
82 82
83 83
84#endif //KAB_EMBEDDED 84#endif //KAB_EMBEDDED
85 setAutoSaveSettings(); 85 setAutoSaveSettings();
86 qApp->processEvents();
87 mCore->restoreSettings(); 86 mCore->restoreSettings();
87#ifndef DESKTOP_VERSION
88 QObject::connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), mCore, SLOT (receiveStart ( const QCString &, const QByteArray & )));
89#endif
88} 90}
89 91
90KAddressBookMain::~KAddressBookMain() 92KAddressBookMain::~KAddressBookMain()
91{ 93{
92 // mCore->saveSettings(); 94 // mCore->saveSettings();
93} 95}
94 96
95void KAddressBookMain::showMinimized () 97void KAddressBookMain::showMinimized ()
96{ 98{
97 QWidget::showMinimized () ; 99 QWidget::showMinimized () ;
98} 100}
99void KAddressBookMain::addEmail( QString addr ) 101void KAddressBookMain::addEmail( QString addr )
100{ 102{
101 mCore->addEmail( addr ); 103 mCore->addEmail( addr );
102} 104}
103 105
104#ifndef KAB_EMBEDDED 106#ifndef KAB_EMBEDDED
105ASYNC KAddressBookMain::showContactEditor( QString uid ) 107ASYNC KAddressBookMain::showContactEditor( QString uid )
106{ 108{
107 mCore->editContact( uid ); 109 mCore->editContact( uid );
108} 110}
109#endif //KAB_EMBEDDED 111#endif //KAB_EMBEDDED
110void KAddressBookMain::newContact() 112void KAddressBookMain::newContact()
111{ 113{
112 mCore->newContact(); 114 mCore->newContact();
113} 115}
114 116
115QString KAddressBookMain::getNameByPhone( QString phone ) 117QString KAddressBookMain::getNameByPhone( QString phone )
116{ 118{
117 return mCore->getNameByPhone( phone ); 119 return mCore->getNameByPhone( phone );
118} 120}
119 121
120void KAddressBookMain::save() 122void KAddressBookMain::save()
121{ 123{
122 mCore->save(); 124 mCore->save();
123} 125}
124 126
125void KAddressBookMain::exit() 127void KAddressBookMain::exit()
126{ 128{
127 close( ); 129 close( );
128} 130}
129 131
130void KAddressBookMain::saveProperties( KConfig* ) 132void KAddressBookMain::saveProperties( KConfig* )
131{ 133{
132} 134}
133 135
134void KAddressBookMain::readProperties( KConfig* ) 136void KAddressBookMain::readProperties( KConfig* )
135{ 137{
136} 138}
137 139
138void KAddressBookMain::initActions() 140void KAddressBookMain::initActions()
139{ 141{
140#ifndef KAB_EMBEDDED 142#ifndef KAB_EMBEDDED
141 KStdAction::quit( this, SLOT( close() ), actionCollection() ); 143 KStdAction::quit( this, SLOT( close() ), actionCollection() );
142 KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() ); 144 KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() );
143#else //KAB_EMBEDDED 145#else //KAB_EMBEDDED
144 //US: transfered the setup of the actions into KABCore 146 //US: transfered the setup of the actions into KABCore
145#endif //KAB_EMBEDDED 147#endif //KAB_EMBEDDED
146 148
147 149
148} 150}
149 151
150//US new method to setup menues and toolbars on embedded systems 152//US new method to setup menues and toolbars on embedded systems
151#ifdef KAB_EMBEDDED 153#ifdef KAB_EMBEDDED
152/* 154/*
153QToolBar * KAddressBookMain::getIconToolBar() 155QToolBar * KAddressBookMain::getIconToolBar()
154{ 156{
155 return iconToolBar; 157 return iconToolBar;
156} 158}
157*/ 159*/
158 160
159void KAddressBookMain::createGUI() 161void KAddressBookMain::createGUI()
160{ 162{
161 163
162 164
163 165
164} 166}
165#endif //KAB_EMBEDDED 167#endif //KAB_EMBEDDED
166 168
167void KAddressBookMain::configureToolbars() 169void KAddressBookMain::configureToolbars()
168{ 170{
169#ifndef KAB_EMBEDDED 171#ifndef KAB_EMBEDDED
170 saveMainWindowSettings( KGlobal::config(), "MainWindow" ); 172 saveMainWindowSettings( KGlobal::config(), "MainWindow" );
171 173
172 KEditToolbar dlg( factory() ); 174 KEditToolbar dlg( factory() );
173 connect( &dlg, SIGNAL( newToolbarConfig() ), SLOT( slotNewToolbarConfig() ) ); 175 connect( &dlg, SIGNAL( newToolbarConfig() ), SLOT( slotNewToolbarConfig() ) );
174 176
175 dlg.exec(); 177 dlg.exec();
176#else //KAB_EMBEDDED 178#else //KAB_EMBEDDED
177 qDebug("KAddressBookMain::configureToolbars() not implemented by ulf" ); 179 qDebug("KAddressBookMain::configureToolbars() not implemented by ulf" );
178#endif //KAB_EMBEDDED 180#endif //KAB_EMBEDDED
179} 181}
180 182
181void KAddressBookMain::slotNewToolbarConfig() 183void KAddressBookMain::slotNewToolbarConfig()
182{ 184{
183#ifndef KAB_EMBEDDED 185#ifndef KAB_EMBEDDED
184 applyMainWindowSettings( KGlobal::config(), "MainWindow" ); 186 applyMainWindowSettings( KGlobal::config(), "MainWindow" );
185#else //KAB_EMBEDDED 187#else //KAB_EMBEDDED
186 qDebug("KAddressBookMain::slotNewToolbarConfig() not implemented by ulf" ); 188 qDebug("KAddressBookMain::slotNewToolbarConfig() not implemented by ulf" );
187#endif //KAB_EMBEDDED 189#endif //KAB_EMBEDDED
188} 190}
189 191
190void KAddressBookMain::configureKeys() 192void KAddressBookMain::configureKeys()
191{ 193{
192#ifndef KAB_EMBEDDED 194#ifndef KAB_EMBEDDED
193 KKeyDialog::configureKeys( actionCollection(), xmlFile(), true, this ); 195 KKeyDialog::configureKeys( actionCollection(), xmlFile(), true, this );
194#else //KAB_EMBEDDED 196#else //KAB_EMBEDDED
195 qDebug("KAddressBookMain::configureKeys() not implemented by ulf" ); 197 qDebug("KAddressBookMain::configureKeys() not implemented by ulf" );
196#endif //KAB_EMBEDDED 198#endif //KAB_EMBEDDED
197} 199}
198 200
199void KAddressBookMain::closeEvent( QCloseEvent* ce ) 201void KAddressBookMain::closeEvent( QCloseEvent* ce )
200{ 202{
201 bool mModified = mCore->modified(); 203 bool mModified = mCore->modified();
202 bool mAskForQuit = KABPrefs::instance()->mAskForQuit; 204 bool mAskForQuit = KABPrefs::instance()->mAskForQuit;
203 205
204 QString mess = i18n( "Close KA/Pi?"); 206 QString mess = i18n( "Close KA/Pi?");
205 if ( mModified == true ) 207 if ( mModified == true )
206 mess += i18n( "\nChanges will be saved!"); 208 mess += i18n( "\nChanges will be saved!");
207 else 209 else
208 mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!"); 210 mess += i18n( "\nNo unsaved changes detected!\nNothing will be saved!");
209 211
210 bool mQuit = true; 212 bool mQuit = true;
211 213
212 214
213 if (mAskForQuit) 215 if (mAskForQuit)
214 { 216 {
215 217
216 int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 ); 218 int res = QMessageBox::information( this, "KA/Pi", mess , i18n("Yes!"), i18n("No"), 0, 0 );
217 if (res == 0) 219 if (res == 0)
218 mQuit = true; 220 mQuit = true;
219 else 221 else
220 mQuit = false; 222 mQuit = false;
221 } 223 }
222 224
223 if (mQuit == false) 225 if (mQuit == false)
224 return; 226 return;
225 227
226 if (mModified == true) 228 if (mModified == true)
227 { 229 {
228 save(); 230 save();
229 mCore->saveSettings(); 231 mCore->saveSettings();
230 //KABPrefs::instance()->writeConfig(); 232 //KABPrefs::instance()->writeConfig();
231 } 233 }
232 234
233 ce->accept(); 235 ce->accept();
234} 236}
235 237
236#ifndef KAB_EMBEDDED 238#ifndef KAB_EMBEDDED
237#include "kaddressbookmain.moc" 239#include "kaddressbookmain.moc"
238#endif //KAB_EMBEDDED 240#endif //KAB_EMBEDDED
239 241
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 93ba53c..2f3531d 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,120 +1,119 @@
1#ifndef DESKTOP_VERSION 1#ifndef DESKTOP_VERSION
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <qcopchannel_qws.h> 3#include <qcopchannel_qws.h>
4#include <stdlib.h> 4#include <stdlib.h>
5#else 5#else
6#include <qapplication.h> 6#include <qapplication.h>
7#include <qwindowsstyle.h> 7#include <qwindowsstyle.h>
8#include <qplatinumstyle.h> 8#include <qplatinumstyle.h>
9#include <qmainwindow.h> 9#include <qmainwindow.h>
10#include <qmessagebox.h> 10#include <qmessagebox.h>
11#include <stdlib.h> 11#include <stdlib.h>
12#endif 12#endif
13 13
14#include <qtextcodec.h> 14#include <qtextcodec.h>
15#include <kstandarddirs.h> 15#include <kstandarddirs.h>
16#include <qregexp.h> 16#include <qregexp.h>
17#include <kglobal.h> 17#include <kglobal.h>
18#include <stdio.h> 18#include <stdio.h>
19#include <qdir.h> 19#include <qdir.h>
20#include "kabprefs.h" 20#include "kabprefs.h"
21#include "kaddressbookmain.h" 21#include "kaddressbookmain.h"
22#include "externalapphandler.h" 22#include "externalapphandler.h"
23#include <libkdepim/kpimglobalprefs.h> 23#include <libkdepim/kpimglobalprefs.h>
24void dumpMissing(); 24void dumpMissing();
25int main( int argc, char **argv ) 25int main( int argc, char **argv )
26{ 26{
27#ifndef DESKTOP_VERSION 27#ifndef DESKTOP_VERSION
28 QPEApplication a( argc, argv ); 28 QPEApplication a( argc, argv );
29 a.setKeepRunning (); 29 a.setKeepRunning ();
30#else 30#else
31 QApplication a( argc, argv ); 31 QApplication a( argc, argv );
32 QApplication::setStyle( new QPlatinumStyle ()); 32 QApplication::setStyle( new QPlatinumStyle ());
33#ifdef _WIN32_ 33#ifdef _WIN32_
34 QString hdir ( getenv( "HOME") ); 34 QString hdir ( getenv( "HOME") );
35 if ( hdir.isEmpty() ) { 35 if ( hdir.isEmpty() ) {
36 QString hd ("C:/" ); 36 QString hd ("C:/" );
37 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); 37 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd );
38 if ( QDir::homeDirPath().lower() == hd.lower() ) { 38 if ( QDir::homeDirPath().lower() == hd.lower() ) {
39 _putenv( "HOME=C:"); 39 _putenv( "HOME=C:");
40 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); 40 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) );
41 } 41 }
42 } else { 42 } else {
43 QDir app_dir; 43 QDir app_dir;
44 if ( !app_dir.exists(hdir) ) 44 if ( !app_dir.exists(hdir) )
45 app_dir.mkdir (hdir); 45 app_dir.mkdir (hdir);
46 } 46 }
47#endif 47#endif
48#endif 48#endif
49 49
50 bool exitHelp = false; 50 bool exitHelp = false;
51 if ( argc > 1 ) { 51 if ( argc > 1 ) {
52 QString command = argv[1]; 52 QString command = argv[1];
53 if ( command == "-help" ){ 53 if ( command == "-help" ){
54 printf("KA/E command line commands:\n"); 54 printf("KA/E command line commands:\n");
55 printf(" no command: Start KA/E in usual way\n"); 55 printf(" no command: Start KA/E in usual way\n");
56 printf(" -help: This output\n"); 56 printf(" -help: This output\n");
57 printf(" KA/E is exiting now. Bye!\n"); 57 printf(" KA/E is exiting now. Bye!\n");
58 exitHelp = true; 58 exitHelp = true;
59 } 59 }
60 } 60 }
61 if ( ! exitHelp ) { 61 if ( ! exitHelp ) {
62 62
63 KGlobal::setAppName( "kaddressbook" ); 63 KGlobal::setAppName( "kaddressbook" );
64#ifndef DESKTOP_VERSION 64#ifndef DESKTOP_VERSION
65 if ( QApplication::desktop()->width() > 320 ) 65 if ( QApplication::desktop()->width() > 320 )
66 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); 66 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
67 else 67 else
68 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 68 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
69#else 69#else
70 QString fileName ; 70 QString fileName ;
71 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 71 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
72 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 72 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
73 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 73 QApplication::addLibraryPath ( qApp->applicationDirPath () );
74 74
75#endif 75#endif
76 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 76 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
77 // init language 77 // init language
78 KPimGlobalPrefs::instance()->setGlobalConfig(); 78 KPimGlobalPrefs::instance()->setGlobalConfig();
79 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); 79 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont );
80 KAddressBookMain m ; 80 KAddressBookMain m ;
81//US MainWindow m; 81//US MainWindow m;
82#ifndef DESKTOP_VERSION 82
83 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
84#endif
85 83
86 84
87#ifndef DESKTOP_VERSION 85#ifndef DESKTOP_VERSION
88 a.showMainWidget( &m ); 86 a.showMainWidget( &m );
89 87
90#else 88#else
91 a.setMainWidget( &m ); 89 a.setMainWidget( &m );
92 m.show(); 90 m.show();
93#endif 91#endif
92 m.setCaption(i18n("Loading addressbook data ... please wait" ));
94 a.exec(); 93 a.exec();
95#ifdef DESKTOP_VERSION 94#ifdef DESKTOP_VERSION
96 KConfig *config = KABPrefs::instance()->getConfig(); 95 KConfig *config = KABPrefs::instance()->getConfig();
97 config->setGroup("WidgetLayout"); 96 config->setGroup("WidgetLayout");
98 QStringList list ;//= config->readListEntry("MainLayout"); 97 QStringList list ;//= config->readListEntry("MainLayout");
99 int x,y,w,h; 98 int x,y,w,h;
100 QWidget* wid; 99 QWidget* wid;
101 wid = &m; 100 wid = &m;
102 x = wid->geometry().x(); 101 x = wid->geometry().x();
103 y = wid->geometry().y(); 102 y = wid->geometry().y();
104 w = wid->width(); 103 w = wid->width();
105 h = wid->height(); 104 h = wid->height();
106 list.clear(); 105 list.clear();
107 list << QString::number( x ); 106 list << QString::number( x );
108 list << QString::number( y ); 107 list << QString::number( y );
109 list << QString::number( w ); 108 list << QString::number( w );
110 list << QString::number( h ); 109 list << QString::number( h );
111 config->writeEntry("MainLayout",list ); 110 config->writeEntry("MainLayout",list );
112 config->sync(); 111 config->sync();
113#endif 112#endif
114 dumpMissing(); 113 dumpMissing();
115 114
116 KPimGlobalPrefs::instance()->writeConfig(); 115 KPimGlobalPrefs::instance()->writeConfig();
117 } 116 }
118 qDebug("KA: Bye! "); 117 qDebug("KA: Bye! ");
119} 118}
120 119