From 57bd80b04dddd40a897dce8b6902d1046d71c631 Mon Sep 17 00:00:00 2001 From: zautrix Date: Thu, 14 Oct 2004 07:24:50 +0000 Subject: phone fixes --- (limited to 'kaddressbook') diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index dae9cd2..087e9e3 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -693,31 +693,28 @@ void KABCore::export2phone() 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 ) ) - 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!")); +} +void KABCore::writeToPhone( ) +{ + if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) + qDebug("Export okay "); else - setCaption( i18n("Error exporting to phone!")); -#endif - - + qDebug("Error export contacts "); } void KABCore::beamVCard() { @@ -834,6 +831,7 @@ void KABCore::beamDone( Ir *ir ) delete ir; #endif topLevelWidget()->raise(); + message( i18n("Beaming successful!") ); } @@ -2818,12 +2816,7 @@ void KABCore::message( QString m ) 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; diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 3c33923..5871d39 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h @@ -148,6 +148,7 @@ class KABCore : public QWidget, public KSyncInterface void faq(); void whatsnew() ; void synchowto() ; + void writeToPhone(); /** Is called whenever a contact is selected in the view. @@ -371,6 +372,7 @@ class KABCore : public QWidget, public KSyncInterface private: void initGUI(); void initActions(); + QString getPhoneFile(); AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, const char *name = 0 ); -- cgit v0.9.0.2