-rw-r--r-- | libkdepim/ksyncmanager.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 08b1a3d..80fb147 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -170,48 +170,52 @@ void KSyncManager::slotSyncMenu( int action ) | |||
170 | setBlockSave(true); | 170 | setBlockSave(true); |
171 | 171 | ||
172 | mCurrentSyncProfile = action - 1000 ; | 172 | mCurrentSyncProfile = action - 1000 ; |
173 | mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; | 173 | mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; |
174 | mCurrentSyncName = mLocalMachineName ; | 174 | mCurrentSyncName = mLocalMachineName ; |
175 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 175 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
176 | KSyncProfile* temp = new KSyncProfile (); | 176 | KSyncProfile* temp = new KSyncProfile (); |
177 | temp->setName(mSyncProfileNames[mCurrentSyncProfile]); | 177 | temp->setName(mSyncProfileNames[mCurrentSyncProfile]); |
178 | temp->readConfig(&config); | 178 | temp->readConfig(&config); |
179 | mAskForPreferences = temp->getAskForPreferences(); | 179 | mAskForPreferences = temp->getAskForPreferences(); |
180 | mSyncAlgoPrefs = temp->getSyncPrefs(); | 180 | mSyncAlgoPrefs = temp->getSyncPrefs(); |
181 | mWriteBackFile = temp->getWriteBackFile(); | 181 | mWriteBackFile = temp->getWriteBackFile(); |
182 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 182 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
183 | mWriteBackInFuture = 0; | 183 | mWriteBackInFuture = 0; |
184 | if ( temp->getWriteBackFuture() ) | 184 | if ( temp->getWriteBackFuture() ) |
185 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 185 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
186 | mShowSyncSummary = temp->getShowSummaryAfterSync(); | 186 | mShowSyncSummary = temp->getShowSummaryAfterSync(); |
187 | if ( action == 1000 ) { | 187 | if ( action == 1000 ) { |
188 | syncSharp(); | 188 | syncSharp(); |
189 | 189 | ||
190 | } else if ( action == 1001 ) { | 190 | } else if ( action == 1001 ) { |
191 | syncLocalFile(); | 191 | syncLocalFile(); |
192 | 192 | ||
193 | } else if ( action == 1002 ) { | 193 | } else if ( action == 1002 ) { |
194 | mWriteBackFile = false; | ||
195 | mAskForPreferences = false; | ||
196 | mShowSyncSummary = false; | ||
197 | mSyncAlgoPrefs = 3; | ||
194 | quickSyncLocalFile(); | 198 | quickSyncLocalFile(); |
195 | 199 | ||
196 | } else if ( action >= 1003 ) { | 200 | } else if ( action >= 1003 ) { |
197 | if ( temp->getIsLocalFileSync() ) { | 201 | if ( temp->getIsLocalFileSync() ) { |
198 | switch(mTargetApp) | 202 | switch(mTargetApp) |
199 | { | 203 | { |
200 | case (KAPI): | 204 | case (KAPI): |
201 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 205 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
202 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 206 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
203 | break; | 207 | break; |
204 | case (KOPI): | 208 | case (KOPI): |
205 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 209 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
206 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); | 210 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
207 | break; | 211 | break; |
208 | case (PWMPI): | 212 | case (PWMPI): |
209 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 213 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
210 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 214 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
211 | break; | 215 | break; |
212 | default: | 216 | default: |
213 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 217 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); |
214 | break; | 218 | break; |
215 | 219 | ||
216 | } | 220 | } |
217 | } else { | 221 | } else { |
@@ -345,49 +349,49 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) | |||
345 | result = QMessageBox::warning( mParent, i18n("Warning!"), | 349 | result = QMessageBox::warning( mParent, i18n("Warning!"), |
346 | mess, | 350 | mess, |
347 | i18n("Sync"), i18n("Cancel"), 0, | 351 | i18n("Sync"), i18n("Cancel"), 0, |
348 | 0, 1 ); | 352 | 0, 1 ); |
349 | if ( result ) | 353 | if ( result ) |
350 | return false; | 354 | return false; |
351 | } | 355 | } |
352 | if ( mAskForPreferences ) | 356 | if ( mAskForPreferences ) |
353 | edit_sync_options(); | 357 | edit_sync_options(); |
354 | if ( result == 0 ) { | 358 | if ( result == 0 ) { |
355 | //qDebug("Now sycing ... "); | 359 | //qDebug("Now sycing ... "); |
356 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) | 360 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) |
357 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); | 361 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); |
358 | else | 362 | else |
359 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); | 363 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); |
360 | if ( ! quick ) | 364 | if ( ! quick ) |
361 | mPrefs->mLastSyncedLocalFile = fn; | 365 | mPrefs->mLastSyncedLocalFile = fn; |
362 | } | 366 | } |
363 | return ret; | 367 | return ret; |
364 | } | 368 | } |
365 | 369 | ||
366 | void KSyncManager::quickSyncLocalFile() | 370 | void KSyncManager::quickSyncLocalFile() |
367 | { | 371 | { |
368 | 372 | ||
369 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) { | 373 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { |
370 | qDebug("quick syncLocalFile() successful "); | 374 | qDebug("quick syncLocalFile() successful "); |
371 | 375 | ||
372 | } | 376 | } |
373 | } | 377 | } |
374 | 378 | ||
375 | void KSyncManager::multiSync( bool askforPrefs ) | 379 | void KSyncManager::multiSync( bool askforPrefs ) |
376 | { | 380 | { |
377 | if (blockSave()) | 381 | if (blockSave()) |
378 | return; | 382 | return; |
379 | setBlockSave(true); | 383 | setBlockSave(true); |
380 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 384 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
381 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), | 385 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), |
382 | question, | 386 | question, |
383 | i18n("Yes"), i18n("No"), | 387 | i18n("Yes"), i18n("No"), |
384 | 0, 0 ) != 0 ) { | 388 | 0, 0 ) != 0 ) { |
385 | setBlockSave(false); | 389 | setBlockSave(false); |
386 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); | 390 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); |
387 | return; | 391 | return; |
388 | } | 392 | } |
389 | mCurrentSyncDevice = i18n("Multiple profiles") ; | 393 | mCurrentSyncDevice = i18n("Multiple profiles") ; |
390 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; | 394 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; |
391 | if ( askforPrefs ) { | 395 | if ( askforPrefs ) { |
392 | edit_sync_options(); | 396 | edit_sync_options(); |
393 | mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; | 397 | mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; |