summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp22
-rw-r--r--kaddressbook/kabcore.cpp45
-rw-r--r--kaddressbook/kabcore.h2
3 files changed, 41 insertions, 28 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 295ee4f..2564894 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -438,31 +438,49 @@ bool Addressee::containsAdr(const Addressee& ad )
438 found = true; 438 found = true;
439 break; 439 break;
440 } 440 }
441 } 441 }
442 if ( ! found ) 442 if ( ! found )
443 return false; 443 return false;
444 } 444 }
445 return true; 445 return true;
446 446
447} 447}
448void Addressee::simplifyAddresses() 448void Addressee::simplifyAddresses()
449{ 449{
450
451
452 Address::List list;
453 Address::List::Iterator it;
454 Address::List::Iterator it2;
455 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
456 it2 = it;
457 ++it2;
458 for( ; it2 != mData->addresses.end(); ++it2 ) {
459 if ( (*it) == (*it2) ) {
460 list.append( *it );
461 break;
462 }
463 }
464 }
465 for( it = list.begin(); it != list.end(); ++it ) {
466 removeAddress( (*it) );
467 }
468
469 list.clear();
450 int max = 2; 470 int max = 2;
451 if ( mData->url.isValid() ) 471 if ( mData->url.isValid() )
452 max = 1; 472 max = 1;
453 if ( mData->addresses.count() <= max ) return ; 473 if ( mData->addresses.count() <= max ) return ;
454 int count = 0; 474 int count = 0;
455 Address::List list;
456 Address::List::Iterator it;
457 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { 475 for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) {
458 if ( count >= max ) 476 if ( count >= max )
459 list.append( *it ); 477 list.append( *it );
460 ++count; 478 ++count;
461 } 479 }
462 for( it = list.begin(); it != list.end(); ++it ) { 480 for( it = list.begin(); it != list.end(); ++it ) {
463 removeAddress( (*it) ); 481 removeAddress( (*it) );
464 } 482 }
465} 483}
466 484
467// removes all emails but the first 485// removes all emails but the first
468// needed by phone sync 486// needed by phone sync
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index dae9cd2..087e9e3 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -684,49 +684,46 @@ void KABCore::export2phone()
684 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 684 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
685 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 685 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
686 686
687 687
688 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 688 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
689 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 689 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
690 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 690 KPimGlobalPrefs::instance()->mEx2PhoneModel );
691 691
692 QStringList uids = mViewManager->selectedUids(); 692 QStringList uids = mViewManager->selectedUids();
693 if ( uids.isEmpty() ) 693 if ( uids.isEmpty() )
694 return; 694 return;
695 695
696 QString fileName = getPhoneFile();
697 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) )
698 return;
699
700 QTimer::singleShot( 1, this , SLOT ( writeToPhone()));
701
702}
703QString KABCore::getPhoneFile()
704{
696#ifdef _WIN32_ 705#ifdef _WIN32_
697 QString fileName = locateLocal("tmp", "phonefile.vcf"); 706 return locateLocal("tmp", "phonefile.vcf");
698#else 707#else
699 QString fileName = "/tmp/phonefile.vcf"; 708 return "/tmp/phonefile.vcf";
700#endif 709#endif
701 710
702 if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) 711}
703 return; 712void KABCore::writeToPhone( )
704 713{
705 if ( PhoneAccess::writeToPhone( fileName ) ) 714 if ( PhoneAccess::writeToPhone( getPhoneFile() ) )
706 qDebug("Export okay "); 715 qDebug("Export okay ");
707 else
708 qDebug("Error export contacts ");
709
710
711#if 0
712
713 setCaption( i18n("Writing to phone..."));
714 if ( PhoneFormat::writeToPhone( cal ) )
715 setCaption( i18n("Export to phone successful!"));
716 else 716 else
717 setCaption( i18n("Error exporting to phone!")); 717 qDebug("Error export contacts ");
718#endif
719
720
721} 718}
722void KABCore::beamVCard() 719void KABCore::beamVCard()
723{ 720{
724 QStringList uids = mViewManager->selectedUids(); 721 QStringList uids = mViewManager->selectedUids();
725 if ( !uids.isEmpty() ) 722 if ( !uids.isEmpty() )
726 beamVCard( uids ); 723 beamVCard( uids );
727} 724}
728 725
729 726
730void KABCore::beamVCard(const QStringList& uids) 727void KABCore::beamVCard(const QStringList& uids)
731{ 728{
732/*US 729/*US
@@ -825,24 +822,25 @@ void KABCore::beamVCard(const QStringList& uids)
825 return; 822 return;
826 } 823 }
827#endif 824#endif
828 825
829} 826}
830 827
831void KABCore::beamDone( Ir *ir ) 828void KABCore::beamDone( Ir *ir )
832{ 829{
833#ifndef DESKTOP_VERSION 830#ifndef DESKTOP_VERSION
834 delete ir; 831 delete ir;
835#endif 832#endif
836 topLevelWidget()->raise(); 833 topLevelWidget()->raise();
834 message( i18n("Beaming successful!") );
837} 835}
838 836
839 837
840void KABCore::browse( const QString& url ) 838void KABCore::browse( const QString& url )
841{ 839{
842#ifndef KAB_EMBEDDED 840#ifndef KAB_EMBEDDED
843 kapp->invokeBrowser( url ); 841 kapp->invokeBrowser( url );
844#else //KAB_EMBEDDED 842#else //KAB_EMBEDDED
845 qDebug("KABCore::browse must be fixed"); 843 qDebug("KABCore::browse must be fixed");
846#endif //KAB_EMBEDDED 844#endif //KAB_EMBEDDED
847} 845}
848 846
@@ -2809,30 +2807,25 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2809 return syncOK; 2807 return syncOK;
2810 2808
2811} 2809}
2812void KABCore::message( QString m ) 2810void KABCore::message( QString m )
2813{ 2811{
2814 2812
2815 topLevelWidget()->setCaption( m ); 2813 topLevelWidget()->setCaption( m );
2816 QTimer::singleShot( 15000, this , SLOT ( setCaptionBack())); 2814 QTimer::singleShot( 15000, this , SLOT ( setCaptionBack()));
2817} 2815}
2818bool KABCore::syncPhone() 2816bool KABCore::syncPhone()
2819{ 2817{
2820 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); 2818 QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice();
2821 QString fileName; 2819 QString fileName = getPhoneFile();
2822#ifdef _WIN32_
2823 fileName = locateLocal("tmp", "phonefile.vcf");
2824#else
2825 fileName = "/tmp/phonefile.vcf";
2826#endif
2827 if ( !PhoneAccess::readFromPhone( fileName) ) { 2820 if ( !PhoneAccess::readFromPhone( fileName) ) {
2828 message(i18n("Phone access failed!")); 2821 message(i18n("Phone access failed!"));
2829 return false; 2822 return false;
2830 } 2823 }
2831 AddressBook abLocal( fileName,"syncContact"); 2824 AddressBook abLocal( fileName,"syncContact");
2832 bool syncOK = false; 2825 bool syncOK = false;
2833 { 2826 {
2834 abLocal.importFromFile( fileName ); 2827 abLocal.importFromFile( fileName );
2835 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1()); 2828 qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
2836 mGlobalSyncMode = SYNC_MODE_EXTERNAL; 2829 mGlobalSyncMode = SYNC_MODE_EXTERNAL;
2837 abLocal.preparePhoneSync( mCurrentSyncDevice, true ); 2830 abLocal.preparePhoneSync( mCurrentSyncDevice, true );
2838 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true ); 2831 abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 3c33923..5871d39 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -139,24 +139,25 @@ class KABCore : public QWidget, public KSyncInterface
139#endif //KAB_EMBEDDED 139#endif //KAB_EMBEDDED
140 140
141 public slots: 141 public slots:
142#ifdef KAB_EMBEDDED 142#ifdef KAB_EMBEDDED
143 void createAboutData(); 143 void createAboutData();
144#endif //KAB_EMBEDDED 144#endif //KAB_EMBEDDED
145 145
146 void statusMessage(QString, int time = 0 ); 146 void statusMessage(QString, int time = 0 );
147 void showLicence(); 147 void showLicence();
148 void faq(); 148 void faq();
149 void whatsnew() ; 149 void whatsnew() ;
150 void synchowto() ; 150 void synchowto() ;
151 void writeToPhone();
151 152
152 /** 153 /**
153 Is called whenever a contact is selected in the view. 154 Is called whenever a contact is selected in the view.
154 */ 155 */
155 void setContactSelected( const QString &uid ); 156 void setContactSelected( const QString &uid );
156 157
157 /** 158 /**
158 Opens the preferred mail composer with all selected contacts as 159 Opens the preferred mail composer with all selected contacts as
159 arguments. 160 arguments.
160 */ 161 */
161 void sendMail(); 162 void sendMail();
162 163
@@ -362,24 +363,25 @@ class KABCore : public QWidget, public KSyncInterface
362 void removeVoice(); 363 void removeVoice();
363#ifdef KAB_EMBEDDED 364#ifdef KAB_EMBEDDED
364 void configureResources(); 365 void configureResources();
365#endif //KAB_EMBEDDED 366#endif //KAB_EMBEDDED
366 367
367 void slotEditorDestroyed( const QString &uid ); 368 void slotEditorDestroyed( const QString &uid );
368 void configurationChanged(); 369 void configurationChanged();
369 void addressBookChanged(); 370 void addressBookChanged();
370 371
371 private: 372 private:
372 void initGUI(); 373 void initGUI();
373 void initActions(); 374 void initActions();
375 QString getPhoneFile();
374 376
375 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 377 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
376 const char *name = 0 ); 378 const char *name = 0 );
377 379
378 KXMLGUIClient *mGUIClient; 380 KXMLGUIClient *mGUIClient;
379 381
380 KABC::AddressBook *mAddressBook; 382 KABC::AddressBook *mAddressBook;
381 383
382 ViewManager *mViewManager; 384 ViewManager *mViewManager;
383 // QSplitter *mDetailsSplitter; 385 // QSplitter *mDetailsSplitter;
384 KDGanttMinimizeSplitter *mExtensionBarSplitter; 386 KDGanttMinimizeSplitter *mExtensionBarSplitter;
385 ViewContainer *mDetails; 387 ViewContainer *mDetails;