-rw-r--r-- | kaddressbook/kabcore.cpp | 41 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 |
2 files changed, 19 insertions, 24 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index dae9cd2..087e9e3 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -690,37 +690,34 @@ void KABCore::export2phone() KPimGlobalPrefs::instance()->mEx2PhoneModel ); QStringList uids = mViewManager->selectedUids(); if ( uids.isEmpty() ) return; + QString fileName = getPhoneFile(); + if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) + return; + + QTimer::singleShot( 1, this , SLOT ( writeToPhone())); + +} +QString KABCore::getPhoneFile() +{ #ifdef _WIN32_ - QString fileName = locateLocal("tmp", "phonefile.vcf"); + return locateLocal("tmp", "phonefile.vcf"); #else - QString fileName = "/tmp/phonefile.vcf"; + return "/tmp/phonefile.vcf"; #endif - if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) - return; - - if ( PhoneAccess::writeToPhone( fileName ) ) +} +void KABCore::writeToPhone( ) +{ + if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) qDebug("Export okay "); else qDebug("Error export contacts "); - - -#if 0 - - setCaption( i18n("Writing to phone...")); - if ( PhoneFormat::writeToPhone( cal ) ) - setCaption( i18n("Export to phone successful!")); - else - setCaption( i18n("Error exporting to phone!")); -#endif - - } void KABCore::beamVCard() { QStringList uids = mViewManager->selectedUids(); if ( !uids.isEmpty() ) beamVCard( uids ); @@ -831,12 +828,13 @@ void KABCore::beamVCard(const QStringList& uids) void KABCore::beamDone( Ir *ir ) { #ifndef DESKTOP_VERSION delete ir; #endif topLevelWidget()->raise(); + message( i18n("Beaming successful!") ); } void KABCore::browse( const QString& url ) { #ifndef KAB_EMBEDDED @@ -2815,18 +2813,13 @@ void KABCore::message( QString m ) topLevelWidget()->setCaption( m ); QTimer::singleShot( 15000, this , SLOT ( setCaptionBack())); } bool KABCore::syncPhone() { QString mCurrentSyncDevice = syncManager->getCurrentSyncDevice(); - QString fileName; -#ifdef _WIN32_ - fileName = locateLocal("tmp", "phonefile.vcf"); -#else - fileName = "/tmp/phonefile.vcf"; -#endif + QString fileName = getPhoneFile(); if ( !PhoneAccess::readFromPhone( fileName) ) { message(i18n("Phone access failed!")); return false; } AddressBook abLocal( fileName,"syncContact"); bool syncOK = false; diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 3c33923..5871d39 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h @@ -145,12 +145,13 @@ class KABCore : public QWidget, public KSyncInterface void statusMessage(QString, int time = 0 ); void showLicence(); void faq(); void whatsnew() ; void synchowto() ; + void writeToPhone(); /** Is called whenever a contact is selected in the view. */ void setContactSelected( const QString &uid ); @@ -368,12 +369,13 @@ class KABCore : public QWidget, public KSyncInterface void configurationChanged(); void addressBookChanged(); private: void initGUI(); void initActions(); + QString getPhoneFile(); AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, const char *name = 0 ); KXMLGUIClient *mGUIClient; |