summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
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
@@ -390,35 +390,58 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
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();
@@ -2432,85 +2455,82 @@ void 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
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index ceeeda7..42b7709 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -341,70 +341,74 @@ class KABCore : public QWidget, public KSyncInterface
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;
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index 519dc92..8fe3ee0 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -70,34 +70,36 @@ KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainW
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
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 93ba53c..2f3531d 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -66,44 +66,43 @@ int main( int argc, char **argv )
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 );