summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp45
-rw-r--r--kaddressbook/kabcore.h2
2 files changed, 21 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
@@ -680,57 +680,54 @@ void KABCore::export2phone()
if ( !ex2phone.exec() ) {
return;
}
KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
KPimGlobalPrefs::instance()->mEx2PhoneConnection,
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 ) )
- 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()
{
QStringList uids = mViewManager->selectedUids();
if ( !uids.isEmpty() )
beamVCard( uids );
}
void KABCore::beamVCard(const QStringList& uids)
{
/*US
QString beamFilename;
Opie::OPimContact c;
if ( actionPersonal->isOn() ) {
beamFilename = addressbookPersonalVCardName();
@@ -821,32 +818,33 @@ void KABCore::beamVCard(const QStringList& uids)
connect( ir, SIGNAL( done(Ir*) ), this, SLOT( beamDone(Ir*) ) );
ir->send( fileName, description, "text/x-vCard" );
} else {
qDebug("Error open temp beam file ");
return;
}
#endif
}
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
kapp->invokeBrowser( url );
#else //KAB_EMBEDDED
qDebug("KABCore::browse must be fixed");
#endif //KAB_EMBEDDED
}
void KABCore::selectAllContacts()
{
mViewManager->setSelected( QString::null, true );
}
@@ -2805,38 +2803,33 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
setModified();
}
if ( syncOK )
mViewManager->refreshView();
return syncOK;
}
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;
{
abLocal.importFromFile( fileName );
qDebug("AB phone loaded ,sync device %s",mCurrentSyncDevice.latin1());
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
abLocal.preparePhoneSync( mCurrentSyncDevice, true );
abLocal.preExternSync( mAddressBook ,mCurrentSyncDevice, true );
syncOK = synchronizeAddressbooks( mAddressBook, &abLocal, syncManager->mSyncAlgoPrefs );
if ( syncOK ) {
if ( syncManager->mWriteBackFile ) {
abLocal.removeSyncAddressees( true );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 3c33923..5871d39 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -135,32 +135,33 @@ class KABCore : public QWidget, public KSyncInterface
#ifdef KAB_EMBEDDED
inline QPopupMenu* getImportMenu() { return ImportMenu;}
inline QPopupMenu* getExportMenu() { return ExportMenu;}
#endif //KAB_EMBEDDED
public slots:
#ifdef KAB_EMBEDDED
void createAboutData();
#endif //KAB_EMBEDDED
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 );
/**
Opens the preferred mail composer with all selected contacts as
arguments.
*/
void sendMail();
/**
Opens the preferred mail composer with the given contacts as
arguments.
*/
@@ -358,32 +359,33 @@ class KABCore : public QWidget, public KSyncInterface
void extensionChanged( int id );
void clipboardDataChanged();
void updateActionMenu();
void configureKeyBindings();
void removeVoice();
#ifdef KAB_EMBEDDED
void configureResources();
#endif //KAB_EMBEDDED
void slotEditorDestroyed( const QString &uid );
void configurationChanged();
void addressBookChanged();
private:
void initGUI();
void initActions();
+ QString getPhoneFile();
AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
const char *name = 0 );
KXMLGUIClient *mGUIClient;
KABC::AddressBook *mAddressBook;
ViewManager *mViewManager;
// QSplitter *mDetailsSplitter;
KDGanttMinimizeSplitter *mExtensionBarSplitter;
ViewContainer *mDetails;
KDGanttMinimizeSplitter* mMiniSplitter;
XXPortManager *mXXPortManager;
JumpButtonBar *mJumpButtonBar;
IncSearchWidget *mIncSearchWidget;