-rw-r--r-- | kaddressbook/kabcore.cpp | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index dae9cd2..087e9e3 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -688,41 +688,38 @@ void KABCore::export2phone() | |||
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 | } | ||
703 | QString 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; | 712 | void 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 | } |
722 | void KABCore::beamVCard() | 719 | void 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 | ||
@@ -829,16 +826,17 @@ void KABCore::beamVCard(const QStringList& uids) | |||
829 | } | 826 | } |
830 | 827 | ||
831 | void KABCore::beamDone( Ir *ir ) | 828 | void 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 | ||
840 | void KABCore::browse( const QString& url ) | 838 | void 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 |
@@ -2813,22 +2811,17 @@ void 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 | } |
2818 | bool KABCore::syncPhone() | 2816 | bool 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 ); |