summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-03-29 17:05:50 (UTC)
committer zautrix <zautrix>2005-03-29 17:05:50 (UTC)
commita7c827aa0e555206b60dec3bc07f7afab4352883 (patch) (unidiff)
tree56dbda15314f27ffabd143d09ea036b092444198 /kaddressbook
parent3116f249fc6ccd0e067213e826d3d924f6986972 (diff)
downloadkdepimpi-a7c827aa0e555206b60dec3bc07f7afab4352883.zip
kdepimpi-a7c827aa0e555206b60dec3bc07f7afab4352883.tar.gz
kdepimpi-a7c827aa0e555206b60dec3bc07f7afab4352883.tar.bz2
fixes
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp40
-rw-r--r--kaddressbook/kabcore.h4
2 files changed, 36 insertions, 8 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 27aca2d..3f9b546 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -281,192 +281,193 @@ public:
281 QCheckBox* mWriteToSim; 281 QCheckBox* mWriteToSim;
282}; 282};
283 283
284 284
285bool pasteWithNewUid = true; 285bool pasteWithNewUid = true;
286 286
287#ifdef KAB_EMBEDDED 287#ifdef KAB_EMBEDDED
288KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name ) 288KABCore::KABCore( KAddressBookMain *client, bool readWrite, QWidget *parent, const char *name )
289 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 289 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
290 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/ 290 mExtensionManager( 0 ),mConfigureDialog( 0 ),/*US mLdapSearchDialog( 0 ),*/
291 mReadWrite( readWrite ), mModified( false ), mMainWindow(client) 291 mReadWrite( readWrite ), mModified( false ), mMainWindow(client)
292#else //KAB_EMBEDDED 292#else //KAB_EMBEDDED
293KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name ) 293KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const char *name )
294 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ), 294 : QWidget( parent, name ), KSyncInterface(), mGUIClient( client ), mViewManager( 0 ),
295 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ), 295 mExtensionManager( 0 ), mConfigureDialog( 0 ), mLdapSearchDialog( 0 ),
296 mReadWrite( readWrite ), mModified( false ) 296 mReadWrite( readWrite ), mModified( false )
297#endif //KAB_EMBEDDED 297#endif //KAB_EMBEDDED
298{ 298{
299 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu); 299 // syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::KAPI, KABPrefs::instance(), syncMenu);
300 // syncManager->setBlockSave(false); 300 // syncManager->setBlockSave(false);
301 mIncSearchWidget = 0; 301 mIncSearchWidget = 0;
302 mMiniSplitter = 0; 302 mMiniSplitter = 0;
303 mExtensionBarSplitter = 0; 303 mExtensionBarSplitter = 0;
304 mIsPart = !parent->inherits( "KAddressBookMain" ); 304 mIsPart = !parent->inherits( "KAddressBookMain" );
305 mAddressBook = KABC::StdAddressBook::self(); 305 mAddressBook = KABC::StdAddressBook::self();
306 KABC::StdAddressBook::setAutomaticSave( false ); 306 KABC::StdAddressBook::setAutomaticSave( false );
307 307
308#ifndef KAB_EMBEDDED 308#ifndef KAB_EMBEDDED
309 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler ); 309 mAddressBook->setErrorHandler( new KABC::GUIErrorHandler );
310#endif //KAB_EMBEDDED 310#endif //KAB_EMBEDDED
311 311
312 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ), 312 connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook * ) ),
313 SLOT( addressBookChanged() ) ); 313 SLOT( addressBookChanged() ) );
314 314
315#if 0 315#if 0
316 // LP moved to addressbook init method 316 // LP moved to addressbook init method
317 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization, 317 mAddressBook->addCustomField( i18n( "Department" ), KABC::Field::Organization,
318 "X-Department", "KADDRESSBOOK" ); 318 "X-Department", "KADDRESSBOOK" );
319 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization, 319 mAddressBook->addCustomField( i18n( "Profession" ), KABC::Field::Organization,
320 "X-Profession", "KADDRESSBOOK" ); 320 "X-Profession", "KADDRESSBOOK" );
321 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, 321 mAddressBook->addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization,
322 "X-AssistantsName", "KADDRESSBOOK" ); 322 "X-AssistantsName", "KADDRESSBOOK" );
323 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, 323 mAddressBook->addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization,
324 "X-ManagersName", "KADDRESSBOOK" ); 324 "X-ManagersName", "KADDRESSBOOK" );
325 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, 325 mAddressBook->addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal,
326 "X-SpousesName", "KADDRESSBOOK" ); 326 "X-SpousesName", "KADDRESSBOOK" );
327 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal, 327 mAddressBook->addCustomField( i18n( "Office" ), KABC::Field::Personal,
328 "X-Office", "KADDRESSBOOK" ); 328 "X-Office", "KADDRESSBOOK" );
329 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal, 329 mAddressBook->addCustomField( i18n( "IM Address" ), KABC::Field::Personal,
330 "X-IMAddress", "KADDRESSBOOK" ); 330 "X-IMAddress", "KADDRESSBOOK" );
331 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, 331 mAddressBook->addCustomField( i18n( "Anniversary" ), KABC::Field::Personal,
332 "X-Anniversary", "KADDRESSBOOK" ); 332 "X-Anniversary", "KADDRESSBOOK" );
333 333
334 //US added this field to become compatible with Opie/qtopia addressbook 334 //US added this field to become compatible with Opie/qtopia addressbook
335 // values can be "female" or "male" or "". An empty field represents undefined. 335 // values can be "female" or "male" or "". An empty field represents undefined.
336 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal, 336 mAddressBook->addCustomField( i18n( "Gender" ), KABC::Field::Personal,
337 "X-Gender", "KADDRESSBOOK" ); 337 "X-Gender", "KADDRESSBOOK" );
338 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal, 338 mAddressBook->addCustomField( i18n( "Children" ), KABC::Field::Personal,
339 "X-Children", "KADDRESSBOOK" ); 339 "X-Children", "KADDRESSBOOK" );
340 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, 340 mAddressBook->addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal,
341 "X-FreeBusyUrl", "KADDRESSBOOK" ); 341 "X-FreeBusyUrl", "KADDRESSBOOK" );
342#endif 342#endif
343 initGUI(); 343 initGUI();
344 344
345 mIncSearchWidget->setFocus(); 345 mIncSearchWidget->setFocus();
346 346
347 347
348 connect( mViewManager, SIGNAL( selected( const QString& ) ), 348 connect( mViewManager, SIGNAL( selected( const QString& ) ),
349 SLOT( setContactSelected( const QString& ) ) ); 349 SLOT( setContactSelected( const QString& ) ) );
350 connect( mViewManager, SIGNAL( executed( const QString& ) ), 350 connect( mViewManager, SIGNAL( executed( const QString& ) ),
351 SLOT( executeContact( const QString& ) ) ); 351 SLOT( executeContact( const QString& ) ) );
352 352
353 connect( mViewManager, SIGNAL( deleteRequest( ) ), 353 connect( mViewManager, SIGNAL( deleteRequest( ) ),
354 SLOT( deleteContacts( ) ) ); 354 SLOT( deleteContacts( ) ) );
355 connect( mViewManager, SIGNAL( modified() ), 355 connect( mViewManager, SIGNAL( modified() ),
356 SLOT( setModified() ) ); 356 SLOT( setModified() ) );
357 357
358 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) ); 358 connect( mExtensionManager, SIGNAL( modified( const KABC::Addressee::List& ) ), this, SLOT( extensionModified( const KABC::Addressee::List& ) ) );
359 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 359 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
360 360
361 connect( mXXPortManager, SIGNAL( modified() ), 361 connect( mXXPortManager, SIGNAL( modified() ),
362 SLOT( setModified() ) ); 362 SLOT( setModified() ) );
363 363
364 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 364 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
365 SLOT( incrementalSearch( const QString& ) ) ); 365 SLOT( incrementalSearch( const QString& ) ) );
366 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 366 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
367 mJumpButtonBar, SLOT( recreateButtons() ) ); 367 mJumpButtonBar, SLOT( recreateButtons() ) );
368 368
369 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 369 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
370 SLOT( sendMail( const QString& ) ) ); 370 SLOT( sendMail( const QString& ) ) );
371 371
372 372
373 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 373 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
374 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&))); 374 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 (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 375 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
376 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle())); 376 connect( ExternalAppHandler::instance(), SIGNAL (nextView()),this, SLOT(setDetailsToggle()));
377 connect( ExternalAppHandler::instance(), SIGNAL (callContactdialog()),this, SLOT(callContactdialog()));
377 378
378 379
379#ifndef KAB_EMBEDDED 380#ifndef KAB_EMBEDDED
380 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 381 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
381 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 382 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
382 383
383 connect( mDetails, SIGNAL( browse( const QString& ) ), 384 connect( mDetails, SIGNAL( browse( const QString& ) ),
384 SLOT( browse( const QString& ) ) ); 385 SLOT( browse( const QString& ) ) );
385 386
386 387
387 mAddressBookService = new KAddressBookService( this ); 388 mAddressBookService = new KAddressBookService( this );
388 389
389#endif //KAB_EMBEDDED 390#endif //KAB_EMBEDDED
390 391
391 mMessageTimer = new QTimer( this ); 392 mMessageTimer = new QTimer( this );
392 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) ); 393 connect( mMessageTimer, SIGNAL( timeout() ), this, SLOT( setCaptionBack() ) );
393 mEditorDialog = 0; 394 mEditorDialog = 0;
394 createAddresseeEditorDialog( this ); 395 createAddresseeEditorDialog( this );
395 setModified( false ); 396 setModified( false );
396 mBRdisabled = false; 397 mBRdisabled = false;
397#ifndef DESKTOP_VERSION 398#ifndef DESKTOP_VERSION
398 infrared = 0; 399 infrared = 0;
399#endif 400#endif
400 //toggleBeamReceive( ); 401 //toggleBeamReceive( );
401 //mMainWindow->toolBar()->show(); 402 //mMainWindow->toolBar()->show();
402 // we have a toolbar repainting error on the Zaurus when starting KA/Pi 403 // we have a toolbar repainting error on the Zaurus when starting KA/Pi
403 QTimer::singleShot( 10, this , SLOT ( updateToolBar())); 404 QTimer::singleShot( 10, this , SLOT ( updateToolBar()));
404} 405}
405 406
406void KABCore::updateToolBar() 407void KABCore::updateToolBar()
407{ 408{
408 static int iii = 0; 409 static int iii = 0;
409 ++iii; 410 ++iii;
410 mMainWindow->toolBar()->repaintMe(); 411 mMainWindow->toolBar()->repaintMe();
411 if ( iii < 4 ) 412 if ( iii < 4 )
412 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar())); 413 QTimer::singleShot( 100*iii, this , SLOT ( updateToolBar()));
413} 414}
414KABCore::~KABCore() 415KABCore::~KABCore()
415{ 416{
416 // save(); 417 // save();
417 //saveSettings(); 418 //saveSettings();
418 //KABPrefs::instance()->writeConfig(); 419 //KABPrefs::instance()->writeConfig();
419 delete AddresseeConfig::instance(); 420 delete AddresseeConfig::instance();
420 mAddressBook = 0; 421 mAddressBook = 0;
421 KABC::StdAddressBook::close(); 422 KABC::StdAddressBook::close();
422 423
423 delete syncManager; 424 delete syncManager;
424#ifndef DESKTOP_VERSION 425#ifndef DESKTOP_VERSION
425 if ( infrared ) 426 if ( infrared )
426 delete infrared; 427 delete infrared;
427#endif 428#endif
428} 429}
429void KABCore::receive( const QCString& cmsg, const QByteArray& data ) 430void KABCore::receive( const QCString& cmsg, const QByteArray& data )
430{ 431{
431 //qDebug("KA: QCOP message received: %s ", cmsg.data() ); 432 //qDebug("KA: QCOP message received: %s ", cmsg.data() );
432 if ( cmsg == "setDocument(QString)" ) { 433 if ( cmsg == "setDocument(QString)" ) {
433 QDataStream stream( data, IO_ReadOnly ); 434 QDataStream stream( data, IO_ReadOnly );
434 QString fileName; 435 QString fileName;
435 stream >> fileName; 436 stream >> fileName;
436 recieve( fileName ); 437 recieve( fileName );
437 return; 438 return;
438 } 439 }
439} 440}
440void KABCore::toggleBeamReceive( ) 441void KABCore::toggleBeamReceive( )
441{ 442{
442 if ( mBRdisabled ) 443 if ( mBRdisabled )
443 return; 444 return;
444#ifndef DESKTOP_VERSION 445#ifndef DESKTOP_VERSION
445 if ( infrared ) { 446 if ( infrared ) {
446 qDebug("KA: AB disable BeamReceive "); 447 qDebug("KA: AB disable BeamReceive ");
447 delete infrared; 448 delete infrared;
448 infrared = 0; 449 infrared = 0;
449 mActionBR->setChecked(false); 450 mActionBR->setChecked(false);
450 return; 451 return;
451 } 452 }
452 qDebug("KA: AB enable BeamReceive "); 453 qDebug("KA: AB enable BeamReceive ");
453 mActionBR->setChecked(true); 454 mActionBR->setChecked(true);
454 455
455 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ; 456 infrared = new QCopChannel("QPE/Application/addressbook",this, "channelAB" ) ;
456 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& ))); 457 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(receive( const QCString&, const QByteArray& )));
457#endif 458#endif
458} 459}
459 460
460 461
461void KABCore::disableBR(bool b) 462void KABCore::disableBR(bool b)
462{ 463{
463#ifndef DESKTOP_VERSION 464#ifndef DESKTOP_VERSION
464 if ( b ) { 465 if ( b ) {
465 if ( infrared ) { 466 if ( infrared ) {
466 toggleBeamReceive( ); 467 toggleBeamReceive( );
467 } 468 }
468 mBRdisabled = true; 469 mBRdisabled = true;
469 } else { 470 } else {
470 if ( mBRdisabled ) { 471 if ( mBRdisabled ) {
471 mBRdisabled = false; 472 mBRdisabled = false;
472 //toggleBeamReceive( ); 473 //toggleBeamReceive( );
@@ -742,218 +743,220 @@ void KABCore::sendMail( const QString& emaillist )
742 743
743void KABCore::mailVCard() 744void KABCore::mailVCard()
744{ 745{
745 QStringList uids = mViewManager->selectedUids(); 746 QStringList uids = mViewManager->selectedUids();
746 if ( !uids.isEmpty() ) 747 if ( !uids.isEmpty() )
747 mailVCard( uids ); 748 mailVCard( uids );
748} 749}
749 750
750void KABCore::mailVCard( const QStringList& uids ) 751void KABCore::mailVCard( const QStringList& uids )
751{ 752{
752 QStringList urls; 753 QStringList urls;
753 754
754// QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); 755// QString tmpdir = locateLocal("tmp", KGlobal::getAppName());
755 756
756 QString dirName = "/tmp/" + KApplication::randomString( 8 ); 757 QString dirName = "/tmp/" + KApplication::randomString( 8 );
757 758
758 759
759 760
760 QDir().mkdir( dirName, true ); 761 QDir().mkdir( dirName, true );
761 762
762 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 763 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
763 KABC::Addressee a = mAddressBook->findByUid( *it ); 764 KABC::Addressee a = mAddressBook->findByUid( *it );
764 765
765 if ( a.isEmpty() ) 766 if ( a.isEmpty() )
766 continue; 767 continue;
767 768
768 QString name = a.givenName() + "_" + a.familyName() + ".vcf"; 769 QString name = a.givenName() + "_" + a.familyName() + ".vcf";
769 770
770 QString fileName = dirName + "/" + name; 771 QString fileName = dirName + "/" + name;
771 772
772 QFile outFile(fileName); 773 QFile outFile(fileName);
773 774
774 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully 775 if ( outFile.open(IO_WriteOnly) ) { // file opened successfully
775 KABC::VCardConverter converter; 776 KABC::VCardConverter converter;
776 QString vcard; 777 QString vcard;
777 778
778 converter.addresseeToVCard( a, vcard ); 779 converter.addresseeToVCard( a, vcard );
779 780
780 QTextStream t( &outFile ); // use a text stream 781 QTextStream t( &outFile ); // use a text stream
781 t.setEncoding( QTextStream::UnicodeUTF8 ); 782 t.setEncoding( QTextStream::UnicodeUTF8 );
782 t << vcard; 783 t << vcard;
783 784
784 outFile.close(); 785 outFile.close();
785 786
786 urls.append( fileName ); 787 urls.append( fileName );
787 } 788 }
788 } 789 }
789 790
790 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); 791 bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") );
791 792
792 793
793/*US 794/*US
794 kapp->invokeMailer( QString::null, QString::null, QString::null, 795 kapp->invokeMailer( QString::null, QString::null, QString::null,
795 QString::null, // subject 796 QString::null, // subject
796 QString::null, // body 797 QString::null, // body
797 QString::null, 798 QString::null,
798 urls ); // attachments 799 urls ); // attachments
799*/ 800*/
800 801
801} 802}
802 803
803/** 804/**
804 Beams the "WhoAmI contact. 805 Beams the "WhoAmI contact.
805*/ 806*/
806void KABCore::beamMySelf() 807void KABCore::beamMySelf()
807{ 808{
808 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); 809 KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI();
809 if (!a.isEmpty()) 810 if (!a.isEmpty())
810 { 811 {
811 QStringList uids; 812 QStringList uids;
812 uids << a.uid(); 813 uids << a.uid();
813 814
814 beamVCard(uids); 815 beamVCard(uids);
815 } else { 816 } else {
816 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); 817 KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) );
817 818
818 819
819 } 820 }
820} 821}
821void KABCore::updateMainWindow() 822void KABCore::updateMainWindow()
822{ 823{
823 mMainWindow->showMaximized(); 824 mMainWindow->showMaximized();
824 mMainWindow->update(); 825 mMainWindow->update();
825} 826}
826void KABCore::resizeEvent(QResizeEvent* e ) 827void KABCore::resizeEvent(QResizeEvent* e )
827{ 828{
828 if ( !mMiniSplitter ) 829 if ( !mMiniSplitter )
829 return; 830 return;
830 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); 831 //qDebug("KABCore::resizeEvent(QResizeEvent* e ) ");
831 if ( QApplication::desktop()->width() >= 480 ) { 832 if ( QApplication::desktop()->width() >= 480 ) {
832 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 833 if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480
833 if ( mMiniSplitter->orientation() == Qt::Vertical ) { 834 if ( mMiniSplitter->orientation() == Qt::Vertical ) {
834 mMiniSplitter->setOrientation( Qt::Horizontal); 835 mMiniSplitter->setOrientation( Qt::Horizontal);
835 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); 836 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right );
836 } 837 }
837 if ( QApplication::desktop()->width() <= 640 ) { 838 if ( QApplication::desktop()->width() <= 640 ) {
839 mMainWindow->showMinimized();
838 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 840 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
839 mViewManager->getFilterAction()->setComboWidth( 150 ); 841 mViewManager->getFilterAction()->setComboWidth( 150 );
840 if ( mIncSearchWidget ) 842 if ( mIncSearchWidget )
841 mIncSearchWidget->setSize(); 843 mIncSearchWidget->setSize();
842 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 844 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
843 } 845 }
844 846
845 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 847 } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640
846 if ( mMiniSplitter->orientation() == Qt::Horizontal ) { 848 if ( mMiniSplitter->orientation() == Qt::Horizontal ) {
847 mMiniSplitter->setOrientation( Qt::Vertical ); 849 mMiniSplitter->setOrientation( Qt::Vertical );
848 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 850 mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
849 } 851 }
850 if ( QApplication::desktop()->width() <= 640 ) { 852 if ( QApplication::desktop()->width() <= 640 ) {
851 //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); 853 //mMainWindow->setMaximumSize( QApplication::desktop()->size() );
852 mMainWindow->showMinimized(); 854 mMainWindow->showMinimized();
853 if ( KABPrefs::instance()->mHideSearchOnSwitch ) { 855 if ( KABPrefs::instance()->mHideSearchOnSwitch ) {
854 if ( mIncSearchWidget ) { 856 if ( mIncSearchWidget ) {
855 mIncSearchWidget->setSize(); 857 mIncSearchWidget->setSize();
856 } 858 }
857 } else { 859 } else {
858 mViewManager->getFilterAction()->setComboWidth( 0 ); 860 mViewManager->getFilterAction()->setComboWidth( 0 );
859 } 861 }
860 QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); 862 QTimer::singleShot( 1, this , SLOT ( updateMainWindow()));
861 } 863 }
862 } 864 }
863 } 865 }
866 QWidget::resizeEvent( e );
864 867
865} 868}
866void KABCore::export2phone() 869void KABCore::export2phone()
867{ 870{
868 871
869 QStringList uids; 872 QStringList uids;
870 XXPortSelectDialog dlg( this, false, this ); 873 XXPortSelectDialog dlg( this, false, this );
871 if ( dlg.exec() ) 874 if ( dlg.exec() )
872 uids = dlg.uids(); 875 uids = dlg.uids();
873 else 876 else
874 return; 877 return;
875 if ( uids.isEmpty() ) 878 if ( uids.isEmpty() )
876 return; 879 return;
877 // qDebug("count %d ", uids.count()); 880 // qDebug("count %d ", uids.count());
878 881
879 KAex2phonePrefs ex2phone; 882 KAex2phonePrefs ex2phone;
880 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 883 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
881 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 884 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
882 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 885 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
883 886
884 if ( !ex2phone.exec() ) { 887 if ( !ex2phone.exec() ) {
885 return; 888 return;
886 } 889 }
887 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 890 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
888 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 891 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
889 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 892 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
890 893
891 894
892 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 895 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
893 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 896 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
894 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 897 KPimGlobalPrefs::instance()->mEx2PhoneModel );
895 898
896 QString fileName = getPhoneFile(); 899 QString fileName = getPhoneFile();
897 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 900 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
898 return; 901 return;
899 902
900 message(i18n("Exporting to phone...")); 903 message(i18n("Exporting to phone..."));
901 QTimer::singleShot( 1, this , SLOT ( writeToPhone())); 904 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
902 905
903} 906}
904QString KABCore::getPhoneFile() 907QString KABCore::getPhoneFile()
905{ 908{
906#ifdef DESKTOP_VERSION 909#ifdef DESKTOP_VERSION
907 return locateLocal("tmp", "phonefile.vcf"); 910 return locateLocal("tmp", "phonefile.vcf");
908#else 911#else
909 return "/tmp/phonefile.vcf"; 912 return "/tmp/phonefile.vcf";
910#endif 913#endif
911 914
912} 915}
913void KABCore::writeToPhone( ) 916void KABCore::writeToPhone( )
914{ 917{
915 if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) 918 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
916 message(i18n("Export to phone finished!")); 919 message(i18n("Export to phone finished!"));
917 else 920 else
918 qDebug(i18n("KA: Error exporting to phone")); 921 qDebug(i18n("KA: Error exporting to phone"));
919} 922}
920void KABCore::beamVCard() 923void KABCore::beamVCard()
921{ 924{
922 QStringList uids; 925 QStringList uids;
923 XXPortSelectDialog dlg( this, false, this ); 926 XXPortSelectDialog dlg( this, false, this );
924 if ( dlg.exec() ) 927 if ( dlg.exec() )
925 uids = dlg.uids(); 928 uids = dlg.uids();
926 else 929 else
927 return; 930 return;
928 if ( uids.isEmpty() ) 931 if ( uids.isEmpty() )
929 return; 932 return;
930 beamVCard( uids ); 933 beamVCard( uids );
931} 934}
932 935
933 936
934void KABCore::beamVCard(const QStringList& uids) 937void KABCore::beamVCard(const QStringList& uids)
935{ 938{
936 939
937 // LR: we should use the /tmp dir on the Zaurus, 940 // LR: we should use the /tmp dir on the Zaurus,
938 // because: /tmp = RAM, (HOME)/kdepim = flash memory 941 // because: /tmp = RAM, (HOME)/kdepim = flash memory
939 942
940#ifdef DESKTOP_VERSION 943#ifdef DESKTOP_VERSION
941 QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); 944 QString fileName = locateLocal("tmp", "kapibeamfile.vcf");
942#else 945#else
943 QString fileName = "/tmp/kapibeamfile.vcf"; 946 QString fileName = "/tmp/kapibeamfile.vcf";
944#endif 947#endif
945 948
946 KABC::VCardConverter converter; 949 KABC::VCardConverter converter;
947 QString description; 950 QString description;
948 QString datastream; 951 QString datastream;
949 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { 952 for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) {
950 KABC::Addressee a = mAddressBook->findByUid( *it ); 953 KABC::Addressee a = mAddressBook->findByUid( *it );
951 954
952 if ( a.isEmpty() ) 955 if ( a.isEmpty() )
953 continue; 956 continue;
954 957
955 if (description.isEmpty()) 958 if (description.isEmpty())
956 description = a.formattedName(); 959 description = a.formattedName();
957 960
958 QString vcard; 961 QString vcard;
959 converter.addresseeToVCard( a, vcard ); 962 converter.addresseeToVCard( a, vcard );
@@ -2412,222 +2415,243 @@ void KABCore::removeVoice()
2412void KABCore::setFormattedName() 2415void KABCore::setFormattedName()
2413{ 2416{
2414 KABFormatPrefs setpref; 2417 KABFormatPrefs setpref;
2415 if ( !setpref.exec() ) { 2418 if ( !setpref.exec() ) {
2416 return; 2419 return;
2417 } 2420 }
2418 XXPortSelectDialog dlg( this, false, this ); 2421 XXPortSelectDialog dlg( this, false, this );
2419 if ( !dlg.exec() ) 2422 if ( !dlg.exec() )
2420 return; 2423 return;
2421 mAddressBook->setUntagged(); 2424 mAddressBook->setUntagged();
2422 dlg.tagSelected(); 2425 dlg.tagSelected();
2423 int count = 0; 2426 int count = 0;
2424 KABC::AddressBook::Iterator it; 2427 KABC::AddressBook::Iterator it;
2425 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2428 for ( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2426 if ( (*it).tagged() ) { 2429 if ( (*it).tagged() ) {
2427 ++count; 2430 ++count;
2428 if ( count %10 == 0 ) 2431 if ( count %10 == 0 )
2429 message(i18n("Changing contact #%1").arg( count ) ); 2432 message(i18n("Changing contact #%1").arg( count ) );
2430 qApp->processEvents(); 2433 qApp->processEvents();
2431 QString fName; 2434 QString fName;
2432 if ( setpref.simple->isChecked() ) 2435 if ( setpref.simple->isChecked() )
2433 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName ); 2436 fName = NameEditDialog::formattedName( (*it), NameEditDialog::SimpleName );
2434 else if ( setpref.full->isChecked() ) 2437 else if ( setpref.full->isChecked() )
2435 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName ); 2438 fName = NameEditDialog::formattedName( (*it), NameEditDialog::FullName );
2436 else if ( setpref.reverse->isChecked() ) 2439 else if ( setpref.reverse->isChecked() )
2437 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName ); 2440 fName = NameEditDialog::formattedName( (*it), NameEditDialog::ReverseName );
2438 else 2441 else
2439 fName = (*it).organization(); 2442 fName = (*it).organization();
2440 if ( setpref.setCompany->isChecked() ) 2443 if ( setpref.setCompany->isChecked() )
2441 if ( fName.isEmpty() || fName =="," ) 2444 if ( fName.isEmpty() || fName =="," )
2442 fName = (*it).organization(); 2445 fName = (*it).organization();
2443 (*it).setFormattedName( fName ); 2446 (*it).setFormattedName( fName );
2444 } 2447 }
2445 } 2448 }
2446 message(i18n("Refreshing view...") ); 2449 message(i18n("Refreshing view...") );
2447 qApp->processEvents(); 2450 qApp->processEvents();
2448 mViewManager->refreshView( "" ); 2451 mViewManager->refreshView( "" );
2449 Addressee add; 2452 Addressee add;
2450 mDetails->setAddressee( add ); 2453 mDetails->setAddressee( add );
2451 message(i18n("Setting formatted name completed!") ); 2454 message(i18n("Setting formatted name completed!") );
2452} 2455}
2453 2456
2454void KABCore::clipboardDataChanged() 2457void KABCore::clipboardDataChanged()
2455{ 2458{
2456 2459
2457 if ( mReadWrite ) 2460 if ( mReadWrite )
2458 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2461 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2459 2462
2460} 2463}
2461 2464
2462void KABCore::updateActionMenu() 2465void KABCore::updateActionMenu()
2463{ 2466{
2464 UndoStack *undo = UndoStack::instance(); 2467 UndoStack *undo = UndoStack::instance();
2465 RedoStack *redo = RedoStack::instance(); 2468 RedoStack *redo = RedoStack::instance();
2466 2469
2467 if ( undo->isEmpty() ) 2470 if ( undo->isEmpty() )
2468 mActionUndo->setText( i18n( "Undo" ) ); 2471 mActionUndo->setText( i18n( "Undo" ) );
2469 else 2472 else
2470 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2473 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2471 2474
2472 mActionUndo->setEnabled( !undo->isEmpty() ); 2475 mActionUndo->setEnabled( !undo->isEmpty() );
2473 2476
2474 if ( !redo->top() ) 2477 if ( !redo->top() )
2475 mActionRedo->setText( i18n( "Redo" ) ); 2478 mActionRedo->setText( i18n( "Redo" ) );
2476 else 2479 else
2477 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2480 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2478 2481
2479 mActionRedo->setEnabled( !redo->isEmpty() ); 2482 mActionRedo->setEnabled( !redo->isEmpty() );
2480} 2483}
2481 2484
2482void KABCore::configureKeyBindings() 2485void KABCore::configureKeyBindings()
2483{ 2486{
2484#ifndef KAB_EMBEDDED 2487#ifndef KAB_EMBEDDED
2485 KKeyDialog::configure( actionCollection(), true ); 2488 KKeyDialog::configure( actionCollection(), true );
2486#else //KAB_EMBEDDED 2489#else //KAB_EMBEDDED
2487 qDebug("KABCore::configureKeyBindings() not implemented"); 2490 qDebug("KABCore::configureKeyBindings() not implemented");
2488#endif //KAB_EMBEDDED 2491#endif //KAB_EMBEDDED
2489} 2492}
2490 2493
2491#ifdef KAB_EMBEDDED 2494#ifdef KAB_EMBEDDED
2492void KABCore::configureResources() 2495void KABCore::configureResources()
2493{ 2496{
2494 KRES::KCMKResources dlg( this, "" , 0 ); 2497 KRES::KCMKResources dlg( this, "" , 0 );
2495 2498
2496 if ( !dlg.exec() ) 2499 if ( !dlg.exec() )
2497 return; 2500 return;
2498 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); 2501 KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") );
2499} 2502}
2500#endif //KAB_EMBEDDED 2503#endif //KAB_EMBEDDED
2501 2504
2502 2505
2503/* this method will be called through the QCop interface from Ko/Pi to select addresses 2506/* this method will be called through the QCop interface from Ko/Pi to select addresses
2504 * for the attendees list of an event. 2507 * for the attendees list of an event.
2505 */ 2508 */
2506void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid) 2509void KABCore::requestForNameEmailUidList(const QString& sourceChannel, const QString& uid)
2507{ 2510{
2508 QStringList nameList; 2511
2509 QStringList emailList;
2510 QStringList uidList;
2511 bool ok = false; 2512 bool ok = false;
2513 mEmailSourceChannel = sourceChannel;
2512 int wid = uid.toInt( &ok ); 2514 int wid = uid.toInt( &ok );
2515 qDebug("UID %s ", uid.latin1());
2513 if ( ok ) { 2516 if ( ok ) {
2514 if ( wid != QApplication::desktop()->width() ) { 2517 if ( wid != QApplication::desktop()->width() ) {
2515 qDebug("KA/Pi: Request from different desktop geometry. Resizing ..."); 2518 qDebug("KA/Pi: Request from different desktop geometry. Resizing ...");
2516 message( i18n("Resizing, please wait...") ); 2519 message( i18n("Resizing, please wait...") );
2517 raise(); 2520 mMainWindow->showMinimized();
2518 qApp->processEvents(); 2521 /*
2522 {
2523 QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
2524 }
2525 */
2526 QTimer::singleShot( 1,this, SLOT ( resizeAndCallContactdialog() ) );
2527 return;
2519 } 2528 }
2520 2529
2521 } else { 2530 } else {
2522 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid "); 2531 qDebug("KABCore::requestForNameEmailUidList:: Got invalid uid ");
2523 } 2532 }
2524 2533 callContactdialog();
2534 //QCopEnvelope e("QPE/Application/kapi", "callContactdialog()");
2535
2536}
2537void KABCore::resizeAndCallContactdialog()
2538{
2539 updateMainWindow();
2540 QTimer::singleShot( 100,this, SLOT ( callContactdialog() ) );
2541}
2542
2543void KABCore::callContactdialog()
2544{
2545 QStringList nameList;
2546 QStringList emailList;
2547 QStringList uidList;
2548 qDebug("WIDTH %d ", QApplication::desktop()->width() );
2525 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); 2549 KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this);
2526 uint i=0; 2550 uint i=0;
2527 for (i=0; i < list.count(); i++) 2551 for (i=0; i < list.count(); i++)
2528 { 2552 {
2529 nameList.append(list[i].realName()); 2553 nameList.append(list[i].realName());
2530 emailList.append(list[i].preferredEmail()); 2554 emailList.append(list[i].preferredEmail());
2531 uidList.append(list[i].uid()); 2555 uidList.append(list[i].uid());
2532 } 2556 }
2557 QString uid = "unnamed";
2533 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1()); 2558 //qDebug("%s %s ", sourceChannel.latin1(), uid.latin1());
2534 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(sourceChannel, uid, nameList, emailList, uidList); 2559 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI(mEmailSourceChannel, uid, nameList, emailList, uidList);
2535 2560
2536} 2561}
2537
2538/* this method will be called through the QCop interface from Ko/Pi to select birthdays 2562/* this method will be called through the QCop interface from Ko/Pi to select birthdays
2539 * to put them into the calendar. 2563 * to put them into the calendar.
2540 */ 2564 */
2541void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid) 2565void KABCore::requestForBirthdayList(const QString& sourceChannel, const QString& uid)
2542{ 2566{
2543 // qDebug("KABCore::requestForBirthdayList"); 2567 // qDebug("KABCore::requestForBirthdayList");
2544 QStringList birthdayList; 2568 QStringList birthdayList;
2545 QStringList anniversaryList; 2569 QStringList anniversaryList;
2546 QStringList realNameList; 2570 QStringList realNameList;
2547 QStringList preferredEmailList; 2571 QStringList preferredEmailList;
2548 QStringList assembledNameList; 2572 QStringList assembledNameList;
2549 QStringList uidList; 2573 QStringList uidList;
2550 2574
2551 KABC::AddressBook::Iterator it; 2575 KABC::AddressBook::Iterator it;
2552 2576
2553 int count = 0; 2577 int count = 0;
2554 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 2578 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
2555 ++count; 2579 ++count;
2556 } 2580 }
2557 QProgressBar bar(count,0 ); 2581 QProgressBar bar(count,0 );
2558 int w = 300; 2582 int w = 300;
2559 if ( QApplication::desktop()->width() < 320 ) 2583 if ( QApplication::desktop()->width() < 320 )
2560 w = 220; 2584 w = 220;
2561 int h = bar.sizeHint().height() ; 2585 int h = bar.sizeHint().height() ;
2562 int dw = QApplication::desktop()->width(); 2586 int dw = QApplication::desktop()->width();
2563 int dh = QApplication::desktop()->height(); 2587 int dh = QApplication::desktop()->height();
2564 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 2588 bar.setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
2565 bar.show(); 2589 bar.show();
2566 bar.setCaption (i18n("Collecting birthdays - close to abort!") ); 2590 bar.setCaption (i18n("Collecting birthdays - close to abort!") );
2567 qApp->processEvents(); 2591 qApp->processEvents();
2568 2592
2569 QDate bday; 2593 QDate bday;
2570 QString anni; 2594 QString anni;
2571 QString formattedbday; 2595 QString formattedbday;
2572 2596
2573 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) 2597 for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it )
2574 { 2598 {
2575 if ( ! bar.isVisible() ) 2599 if ( ! bar.isVisible() )
2576 return; 2600 return;
2577 bar.setProgress( count++ ); 2601 bar.setProgress( count++ );
2578 qApp->processEvents(); 2602 qApp->processEvents();
2579 bday = (*it).birthday().date(); 2603 bday = (*it).birthday().date();
2580 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" ); 2604 anni = (*it).custom("KADDRESSBOOK", "X-Anniversary" );
2581 2605
2582 if ( bday.isValid() || !anni.isEmpty()) 2606 if ( bday.isValid() || !anni.isEmpty())
2583 { 2607 {
2584 if (bday.isValid()) 2608 if (bday.isValid())
2585 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate); 2609 formattedbday = KGlobal::locale()->formatDate(bday, true, KLocale::ISODate);
2586 else 2610 else
2587 formattedbday = "NOTVALID"; 2611 formattedbday = "NOTVALID";
2588 if (anni.isEmpty()) 2612 if (anni.isEmpty())
2589 anni = "INVALID"; 2613 anni = "INVALID";
2590 2614
2591 birthdayList.append(formattedbday); 2615 birthdayList.append(formattedbday);
2592 anniversaryList.append(anni); //should be ISODate 2616 anniversaryList.append(anni); //should be ISODate
2593 realNameList.append((*it).realName()); 2617 realNameList.append((*it).realName());
2594 preferredEmailList.append((*it).preferredEmail()); 2618 preferredEmailList.append((*it).preferredEmail());
2595 assembledNameList.append((*it).assembledName()); 2619 assembledNameList.append((*it).assembledName());
2596 uidList.append((*it).uid()); 2620 uidList.append((*it).uid());
2597 2621
2598 //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() ); 2622 //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() );
2599 } 2623 }
2600 } 2624 }
2601 2625
2602 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList); 2626 bool res = ExternalAppHandler::instance()->returnBirthdayListFromKAPI(sourceChannel, uid, birthdayList, anniversaryList, realNameList, preferredEmailList, assembledNameList, uidList);
2603 2627
2604} 2628}
2605 2629
2606/* this method will be called through the QCop interface from other apps to show details of a contact. 2630/* this method will be called through the QCop interface from other apps to show details of a contact.
2607 */ 2631 */
2608void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) 2632void KABCore::requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid)
2609{ 2633{
2610 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1()); 2634 //qDebug("KABCore::requestForDetails %s %s %s %s %s", sourceChannel.latin1(), sessionuid.latin1(), name.latin1(), email.latin1(), uid.latin1());
2611 2635
2612 QString foundUid = QString::null; 2636 QString foundUid = QString::null;
2613 if ( ! uid.isEmpty() ) { 2637 if ( ! uid.isEmpty() ) {
2614 Addressee adrr = mAddressBook->findByUid( uid ); 2638 Addressee adrr = mAddressBook->findByUid( uid );
2615 if ( !adrr.isEmpty() ) { 2639 if ( !adrr.isEmpty() ) {
2616 foundUid = uid; 2640 foundUid = uid;
2617 } 2641 }
2618 if ( email == "sendbacklist" ) { 2642 if ( email == "sendbacklist" ) {
2619 //qDebug("ssssssssssssssssssssssend "); 2643 //qDebug("ssssssssssssssssssssssend ");
2620 QStringList nameList; 2644 QStringList nameList;
2621 QStringList emailList; 2645 QStringList emailList;
2622 QStringList uidList; 2646 QStringList uidList;
2623 nameList.append(adrr.realName()); 2647 nameList.append(adrr.realName());
2624 emailList = adrr.emails(); 2648 emailList = adrr.emails();
2625 uidList.append( adrr.preferredEmail()); 2649 uidList.append( adrr.preferredEmail());
2626 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); 2650 bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList);
2627 return; 2651 return;
2628 } 2652 }
2629 2653
2630 } 2654 }
2631 2655
2632 if ( email == "sendbacklist" ) 2656 if ( email == "sendbacklist" )
2633 return; 2657 return;
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c185117..47ea152 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -275,209 +275,213 @@ class KABCore : public QWidget, public KSyncInterface
275 275
276 /** 276 /**
277 Called whenever an contact is modified in the contact editor 277 Called whenever an contact is modified in the contact editor
278 dialog or the quick edit. 278 dialog or the quick edit.
279 */ 279 */
280 void contactModified( const KABC::Addressee &addr ); 280 void contactModified( const KABC::Addressee &addr );
281 void addrModified( const KABC::Addressee &addr, bool updateDetails = true ); 281 void addrModified( const KABC::Addressee &addr, bool updateDetails = true );
282 282
283 /** 283 /**
284 DCOP METHODS. 284 DCOP METHODS.
285 */ 285 */
286 void addEmail( QString addr ); 286 void addEmail( QString addr );
287 void importVCard( const KURL& url, bool showPreview ); 287 void importVCard( const KURL& url, bool showPreview );
288 void importVCard( const QString& vCard, bool showPreview ); 288 void importVCard( const QString& vCard, bool showPreview );
289 void newContact(); 289 void newContact();
290 QString getNameByPhone( const QString& phone ); 290 QString getNameByPhone( const QString& phone );
291 /** 291 /**
292 END DCOP METHODS 292 END DCOP METHODS
293 */ 293 */
294 294
295 /** 295 /**
296 Saves the contents of the AddressBook back to disk. 296 Saves the contents of the AddressBook back to disk.
297 */ 297 */
298 void save(); 298 void save();
299 299
300 /** 300 /**
301 Undos the last command using the undo stack. 301 Undos the last command using the undo stack.
302 */ 302 */
303 void undo(); 303 void undo();
304 304
305 /** 305 /**
306 Redos the last command that was undone, using the redo stack. 306 Redos the last command that was undone, using the redo stack.
307 */ 307 */
308 void redo(); 308 void redo();
309 309
310 /** 310 /**
311 Shows the edit dialog for the given uid. If the uid is QString::null, 311 Shows the edit dialog for the given uid. If the uid is QString::null,
312 the method will try to find a selected addressee in the view. 312 the method will try to find a selected addressee in the view.
313 */ 313 */
314 void editContact( const QString &uid /*US = QString::null*/ ); 314 void editContact( const QString &uid /*US = QString::null*/ );
315//US added a second method without defaultparameter 315//US added a second method without defaultparameter
316 void editContact2(); 316 void editContact2();
317 317
318 /** 318 /**
319 Shows or edits the detail view for the given uid. If the uid is QString::null, 319 Shows or edits the detail view for the given uid. If the uid is QString::null,
320 the method will try to find a selected addressee in the view. 320 the method will try to find a selected addressee in the view.
321 */ 321 */
322 void executeContact( const QString &uid /*US = QString::null*/ ); 322 void executeContact( const QString &uid /*US = QString::null*/ );
323 323
324 /** 324 /**
325 Launches the configuration dialog. 325 Launches the configuration dialog.
326 */ 326 */
327 void openConfigDialog(); 327 void openConfigDialog();
328 328
329 /** 329 /**
330 Launches the ldap search dialog. 330 Launches the ldap search dialog.
331 */ 331 */
332 void openLDAPDialog(); 332 void openLDAPDialog();
333 333
334 /** 334 /**
335 Creates a KAddressBookPrinter, which will display the print 335 Creates a KAddressBookPrinter, which will display the print
336 dialog and do the printing. 336 dialog and do the printing.
337 */ 337 */
338 void print(); 338 void print();
339 339
340 /** 340 /**
341 Registers a new GUI client, so plugins can register its actions. 341 Registers a new GUI client, so plugins can register its actions.
342 */ 342 */
343 void addGUIClient( KXMLGUIClient *client ); 343 void addGUIClient( KXMLGUIClient *client );
344 344
345 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 345 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
346 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 346 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
347 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 347 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
348 348
349 349
350 signals: 350 signals:
351 void contactSelected( const QString &name ); 351 void contactSelected( const QString &name );
352 void contactSelected( const QPixmap &pixmap ); 352 void contactSelected( const QPixmap &pixmap );
353 public slots: 353 public slots:
354 void recieve(QString cmsg ); 354 void recieve(QString cmsg );
355 void getFile( bool success ); 355 void getFile( bool success );
356 void syncFileRequest(); 356 void syncFileRequest();
357 void setDetailsVisible( bool visible ); 357 void setDetailsVisible( bool visible );
358 void setDetailsToState(); 358 void setDetailsToState();
359 359
360 void saveSettings(); 360 void saveSettings();
361 361
362 private slots: 362 private slots:
363 void updateToolBar(); 363 void updateToolBar();
364 void updateMainWindow(); 364 void updateMainWindow();
365 void receive( const QCString& cmsg, const QByteArray& data ); 365 void receive( const QCString& cmsg, const QByteArray& data );
366 void toggleBeamReceive( ); 366 void toggleBeamReceive( );
367 void disableBR(bool); 367 void disableBR(bool);
368 void setJumpButtonBarVisible( bool visible ); 368 void setJumpButtonBarVisible( bool visible );
369 void setJumpButtonBar( bool visible ); 369 void setJumpButtonBar( bool visible );
370 void setCaptionBack(); 370 void setCaptionBack();
371 void resizeAndCallContactdialog();
372 void callContactdialog();
373
371 void importFromOL(); 374 void importFromOL();
372 void extensionModified( const KABC::Addressee::List &list ); 375 void extensionModified( const KABC::Addressee::List &list );
373 void extensionChanged( int id ); 376 void extensionChanged( int id );
374 void clipboardDataChanged(); 377 void clipboardDataChanged();
375 void updateActionMenu(); 378 void updateActionMenu();
376 void configureKeyBindings(); 379 void configureKeyBindings();
377 void removeVoice(); 380 void removeVoice();
378 void setFormattedName(); 381 void setFormattedName();
379#ifdef KAB_EMBEDDED 382#ifdef KAB_EMBEDDED
380 void configureResources(); 383 void configureResources();
381#endif //KAB_EMBEDDED 384#endif //KAB_EMBEDDED
382 385
383 void slotEditorDestroyed( const QString &uid ); 386 void slotEditorDestroyed( const QString &uid );
384 void configurationChanged(); 387 void configurationChanged();
385 void addressBookChanged(); 388 void addressBookChanged();
386 389
387 private: 390 private:
391 QString mEmailSourceChannel;
388 void resizeEvent(QResizeEvent* e ); 392 void resizeEvent(QResizeEvent* e );
389 bool mBRdisabled; 393 bool mBRdisabled;
390#ifndef DESKTOP_VERSION 394#ifndef DESKTOP_VERSION
391 QCopChannel* infrared; 395 QCopChannel* infrared;
392#endif 396#endif
393 QTimer *mMessageTimer; 397 QTimer *mMessageTimer;
394 void initGUI(); 398 void initGUI();
395 void initActions(); 399 void initActions();
396 QString getPhoneFile(); 400 QString getPhoneFile();
397 401
398 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 402 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
399 const char *name = 0 ); 403 const char *name = 0 );
400 404
401 KXMLGUIClient *mGUIClient; 405 KXMLGUIClient *mGUIClient;
402 406
403 KABC::AddressBook *mAddressBook; 407 KABC::AddressBook *mAddressBook;
404 408
405 ViewManager *mViewManager; 409 ViewManager *mViewManager;
406 // QSplitter *mDetailsSplitter; 410 // QSplitter *mDetailsSplitter;
407 KDGanttMinimizeSplitter *mExtensionBarSplitter; 411 KDGanttMinimizeSplitter *mExtensionBarSplitter;
408 ViewContainer *mDetails; 412 ViewContainer *mDetails;
409 KDGanttMinimizeSplitter* mMiniSplitter; 413 KDGanttMinimizeSplitter* mMiniSplitter;
410 XXPortManager *mXXPortManager; 414 XXPortManager *mXXPortManager;
411 JumpButtonBar *mJumpButtonBar; 415 JumpButtonBar *mJumpButtonBar;
412 IncSearchWidget *mIncSearchWidget; 416 IncSearchWidget *mIncSearchWidget;
413 ExtensionManager *mExtensionManager; 417 ExtensionManager *mExtensionManager;
414 418
415 KCMultiDialog *mConfigureDialog; 419 KCMultiDialog *mConfigureDialog;
416 420
417#ifndef KAB_EMBEDDED 421#ifndef KAB_EMBEDDED
418 LDAPSearchDialog *mLdapSearchDialog; 422 LDAPSearchDialog *mLdapSearchDialog;
419#endif //KAB_EMBEDDED 423#endif //KAB_EMBEDDED
420 // QDict<AddresseeEditorDialog> mEditorDict; 424 // QDict<AddresseeEditorDialog> mEditorDict;
421 AddresseeEditorDialog *mEditorDialog; 425 AddresseeEditorDialog *mEditorDialog;
422 bool mReadWrite; 426 bool mReadWrite;
423 bool mModified; 427 bool mModified;
424 bool mIsPart; 428 bool mIsPart;
425 bool mMultipleViewsAtOnce; 429 bool mMultipleViewsAtOnce;
426 430
427 431
428 //US file menu 432 //US file menu
429 KAction *mActionMail; 433 KAction *mActionMail;
430 KAction *mActionBeam; 434 KAction *mActionBeam;
431 KToggleAction *mActionBR; 435 KToggleAction *mActionBR;
432 KAction *mActionExport2phone; 436 KAction *mActionExport2phone;
433 KAction* mActionPrint; 437 KAction* mActionPrint;
434 KAction* mActionPrintDetails; 438 KAction* mActionPrintDetails;
435 KAction* mActionNewContact; 439 KAction* mActionNewContact;
436 KAction *mActionSave; 440 KAction *mActionSave;
437 KAction *mActionEditAddressee; 441 KAction *mActionEditAddressee;
438 KAction *mActionMailVCard; 442 KAction *mActionMailVCard;
439 KAction *mActionBeamVCard; 443 KAction *mActionBeamVCard;
440 444
441 KAction *mActionQuit; 445 KAction *mActionQuit;
442 446
443 //US edit menu 447 //US edit menu
444 KAction *mActionCopy; 448 KAction *mActionCopy;
445 KAction *mActionCut; 449 KAction *mActionCut;
446 KAction *mActionPaste; 450 KAction *mActionPaste;
447 KAction *mActionSelectAll; 451 KAction *mActionSelectAll;
448 KAction *mActionUndo; 452 KAction *mActionUndo;
449 KAction *mActionRedo; 453 KAction *mActionRedo;
450 KAction *mActionDelete; 454 KAction *mActionDelete;
451 455
452 //US settings menu 456 //US settings menu
453 KAction *mActionConfigResources; 457 KAction *mActionConfigResources;
454 KAction *mActionConfigKAddressbook; 458 KAction *mActionConfigKAddressbook;
455 KAction *mActionConfigShortcuts; 459 KAction *mActionConfigShortcuts;
456 KAction *mActionConfigureToolbars; 460 KAction *mActionConfigureToolbars;
457 KAction *mActionKeyBindings; 461 KAction *mActionKeyBindings;
458 KToggleAction *mActionJumpBar; 462 KToggleAction *mActionJumpBar;
459 KToggleAction *mActionDetails; 463 KToggleAction *mActionDetails;
460 KAction *mActionWhoAmI; 464 KAction *mActionWhoAmI;
461 KAction *mActionCategories; 465 KAction *mActionCategories;
462 KAction *mActionEditCategories; 466 KAction *mActionEditCategories;
463 KAction *mActionManageCategories; 467 KAction *mActionManageCategories;
464 KAction *mActionAboutKAddressbook; 468 KAction *mActionAboutKAddressbook;
465 KAction *mActionLicence; 469 KAction *mActionLicence;
466 KAction *mActionFaq; 470 KAction *mActionFaq;
467 KAction *mActionWN; 471 KAction *mActionWN;
468 KAction *mActionSyncHowto; 472 KAction *mActionSyncHowto;
469 KAction *mActionKdeSyncHowto; 473 KAction *mActionKdeSyncHowto;
470 KAction *mActionMultiSyncHowto; 474 KAction *mActionMultiSyncHowto;
471 475
472 KAction *mActionDeleteView; 476 KAction *mActionDeleteView;
473 477
474 QPopupMenu *viewMenu; 478 QPopupMenu *viewMenu;
475 QPopupMenu *filterMenu; 479 QPopupMenu *filterMenu;
476 QPopupMenu *settingsMenu; 480 QPopupMenu *settingsMenu;
477 QPopupMenu *changeMenu; 481 QPopupMenu *changeMenu;
478 QPopupMenu *beamMenu; 482 QPopupMenu *beamMenu;
479//US QAction *mActionSave; 483//US QAction *mActionSave;
480 QPopupMenu *ImportMenu; 484 QPopupMenu *ImportMenu;
481 QPopupMenu *ExportMenu; 485 QPopupMenu *ExportMenu;
482 //LR additional methods 486 //LR additional methods
483 KAction *mActionRemoveVoice; 487 KAction *mActionRemoveVoice;