-rw-r--r-- | libkdepim/ksyncmanager.cpp | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 7ca3ee0..554c6e5 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -183,2 +183,8 @@ void KSyncManager::slotSyncMenu( int action ) setBlockSave(true); + bool silent = false; + if ( action == 999 ) { + //special mode for silent syncing + action = 1000; + silent = true; + } @@ -191,5 +197,14 @@ void KSyncManager::slotSyncMenu( int action ) temp->readConfig(&config); + if (silent) { + mAskForPreferences = false; + mShowSyncSummary = false; + mWriteBackFile = true; + mSyncAlgoPrefs = 2;// take newest + } + else { mAskForPreferences = temp->getAskForPreferences(); - mSyncAlgoPrefs = temp->getSyncPrefs(); + mShowSyncSummary = temp->getShowSummaryAfterSync(); mWriteBackFile = temp->getWriteBackFile(); + mSyncAlgoPrefs = temp->getSyncPrefs(); + } mWriteBackExistingOnly = temp->getWriteBackExisting(); @@ -199,3 +214,3 @@ void KSyncManager::slotSyncMenu( int action ) mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); - mShowSyncSummary = temp->getShowSummaryAfterSync(); + if ( action == 1000 ) { @@ -304,2 +319,3 @@ void KSyncManager::enableQuick( bool ask ) #else + mPrefs->mPassiveSyncWithDesktop = false; QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); @@ -418,3 +434,6 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) if ( mAskForPreferences ) - edit_sync_options(); + if ( !edit_sync_options()) { + mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); + return false; + } if ( result == 0 ) { @@ -457,3 +476,6 @@ void KSyncManager::multiSync( bool askforPrefs ) if ( askforPrefs ) { - edit_sync_options(); + if ( !edit_sync_options()) { + mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); + return; + } mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; @@ -689,3 +711,3 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) } -void KSyncManager::edit_pisync_options() +bool KSyncManager::edit_pisync_options() { @@ -718,6 +740,7 @@ void KSyncManager::edit_pisync_options() mActiveSyncIP = le2.text(); + return true; } - + return false; } -void KSyncManager::edit_sync_options() +bool KSyncManager::edit_sync_options() { @@ -768,5 +791,5 @@ void KSyncManager::edit_sync_options() mSyncAlgoPrefs = rem.isChecked()*1+newest.isChecked()*2+ ask.isChecked()*3+ f_loc.isChecked()*4+ f_rem.isChecked()*5;//+ both.isChecked()*6 ; + return true; } - - + return false; } @@ -867,3 +890,6 @@ bool KSyncManager::syncExternalApplication(QString resource) if ( mAskForPreferences ) - edit_sync_options(); + if ( !edit_sync_options()) { + mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); + return false; + } @@ -937,3 +963,6 @@ void KSyncManager::syncPi() if ( mAskForPreferences ) - edit_pisync_options(); + if ( !edit_pisync_options()) { + mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); + return; + } bool ok; @@ -1168,7 +1197,7 @@ void KServerSocket::readBackFileFromSocket() file.close(); + piFileString = ""; + emit file_received( true ); delete mSyncActionDialog; mSyncActionDialog = 0; - piFileString = ""; blockRC = false; - emit file_received( true ); @@ -1201,3 +1230,3 @@ void KCommandSocket::readFile( QString fn ) os << "GET " << mPassWord << "\r\n"; - mTimerSocket->start( 10000 ); + mTimerSocket->start( 20000 ); } |