summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 0faa24d..08b1a3d 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -328,193 +328,193 @@ void KSyncManager::syncLocalFile()
328 328
329bool KSyncManager::syncWithFile( QString fn , bool quick ) 329bool KSyncManager::syncWithFile( QString fn , bool quick )
330{ 330{
331 bool ret = false; 331 bool ret = false;
332 QFileInfo info; 332 QFileInfo info;
333 info.setFile( fn ); 333 info.setFile( fn );
334 QString mess; 334 QString mess;
335 bool loadbup = true; 335 bool loadbup = true;
336 if ( !info. exists() ) { 336 if ( !info. exists() ) {
337 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); 337 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
338 int result = QMessageBox::warning( mParent, i18n("Warning!"), 338 int result = QMessageBox::warning( mParent, i18n("Warning!"),
339 mess ); 339 mess );
340 return ret; 340 return ret;
341 } 341 }
342 int result = 0; 342 int result = 0;
343 if ( !quick ) { 343 if ( !quick ) {
344 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 344 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
345 result = QMessageBox::warning( mParent, i18n("Warning!"), 345 result = QMessageBox::warning( mParent, i18n("Warning!"),
346 mess, 346 mess,
347 i18n("Sync"), i18n("Cancel"), 0, 347 i18n("Sync"), i18n("Cancel"), 0,
348 0, 1 ); 348 0, 1 );
349 if ( result ) 349 if ( result )
350 return false; 350 return false;
351 } 351 }
352 if ( mAskForPreferences ) 352 if ( mAskForPreferences )
353 edit_sync_options(); 353 edit_sync_options();
354 if ( result == 0 ) { 354 if ( result == 0 ) {
355 //qDebug("Now sycing ... "); 355 //qDebug("Now sycing ... ");
356 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) 356 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) )
357 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); 357 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") );
358 else 358 else
359 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); 359 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
360 if ( ! quick ) 360 if ( ! quick )
361 mPrefs->mLastSyncedLocalFile = fn; 361 mPrefs->mLastSyncedLocalFile = fn;
362 } 362 }
363 return ret; 363 return ret;
364} 364}
365 365
366void KSyncManager::quickSyncLocalFile() 366void KSyncManager::quickSyncLocalFile()
367{ 367{
368 368
369 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) { 369 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) {
370 qDebug("quick syncLocalFile() successful "); 370 qDebug("quick syncLocalFile() successful ");
371 371
372 } 372 }
373} 373}
374 374
375void KSyncManager::multiSync( bool askforPrefs ) 375void KSyncManager::multiSync( bool askforPrefs )
376{ 376{
377 if (blockSave()) 377 if (blockSave())
378 return; 378 return;
379 setBlockSave(true); 379 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!"); 380 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"), 381 if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"),
382 question, 382 question,
383 i18n("Yes"), i18n("No"), 383 i18n("Yes"), i18n("No"),
384 0, 0 ) != 0 ) { 384 0, 0 ) != 0 ) {
385 setBlockSave(false); 385 setBlockSave(false);
386 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); 386 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!"));
387 return; 387 return;
388 } 388 }
389 mCurrentSyncDevice = i18n("Multiple profiles") ; 389 mCurrentSyncDevice = i18n("Multiple profiles") ;
390 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; 390 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs;
391 if ( askforPrefs ) { 391 if ( askforPrefs ) {
392 edit_sync_options(); 392 edit_sync_options();
393 mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; 393 mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs;
394 } 394 }
395 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); 395 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") );
396 qApp->processEvents(); 396 qApp->processEvents();
397 int num = ringSync() ; 397 int num = ringSync() ;
398 if ( num > 1 ) 398 if ( num > 1 )
399 ringSync(); 399 ringSync();
400 setBlockSave(false); 400 setBlockSave(false);
401 if ( num ) 401 if ( num )
402 emit save(); 402 emit save();
403 if ( num ) 403 if ( num )
404 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); 404 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) );
405 else 405 else
406 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 406 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
407 return; 407 return;
408} 408}
409 409
410int KSyncManager::ringSync() 410int KSyncManager::ringSync()
411{ 411{
412 int syncedProfiles = 0; 412 int syncedProfiles = 0;
413 unsigned int i; 413 unsigned int i;
414 QTime timer; 414 QTime timer;
415 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 415 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
416 QStringList syncProfileNames = mSyncProfileNames; 416 QStringList syncProfileNames = mSyncProfileNames;
417 KSyncProfile* temp = new KSyncProfile (); 417 KSyncProfile* temp = new KSyncProfile ();
418 mAskForPreferences = false; 418 mAskForPreferences = false;
419 for ( i = 0; i < syncProfileNames.count(); ++i ) { 419 for ( i = 0; i < syncProfileNames.count(); ++i ) {
420 mCurrentSyncProfile = i; 420 mCurrentSyncProfile = i;
421 temp->setName(syncProfileNames[mCurrentSyncProfile]); 421 temp->setName(syncProfileNames[mCurrentSyncProfile]);
422 temp->readConfig(&config); 422 temp->readConfig(&config);
423 423
424 QString includeInRingSync; 424 bool includeInRingSync;
425 switch(mTargetApp) 425 switch(mTargetApp)
426 { 426 {
427 case (KAPI): 427 case (KAPI):
428 includeInRingSync = temp->getIncludeInRingSyncAB(); 428 includeInRingSync = temp->getIncludeInRingSyncAB();
429 break; 429 break;
430 case (KOPI): 430 case (KOPI):
431 includeInRingSync = temp->getIncludeInRingSync(); 431 includeInRingSync = temp->getIncludeInRingSync();
432 break; 432 break;
433 case (PWMPI): 433 case (PWMPI):
434 includeInRingSync = temp->getIncludeInRingSyncPWM(); 434 includeInRingSync = temp->getIncludeInRingSyncPWM();
435 break; 435 break;
436 default: 436 default:
437 qDebug("KSyncManager::ringSync: invalid apptype selected"); 437 qDebug("KSyncManager::ringSync: invalid apptype selected");
438 break; 438 break;
439 439
440 } 440 }
441 441
442 442
443 if ( includeInRingSync && ( i < 1 || i > 2 )) { 443 if ( includeInRingSync && ( i < 1 || i > 2 )) {
444 mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 444 mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
445 ++syncedProfiles; 445 ++syncedProfiles;
446 // mAskForPreferences = temp->getAskForPreferences(); 446 // mAskForPreferences = temp->getAskForPreferences();
447 mWriteBackFile = temp->getWriteBackFile(); 447 mWriteBackFile = temp->getWriteBackFile();
448 mWriteBackExistingOnly = temp->getWriteBackExisting(); 448 mWriteBackExistingOnly = temp->getWriteBackExisting();
449 mWriteBackInFuture = 0; 449 mWriteBackInFuture = 0;
450 if ( temp->getWriteBackFuture() ) 450 if ( temp->getWriteBackFuture() )
451 mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 451 mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
452 mShowSyncSummary = false; 452 mShowSyncSummary = false;
453 mCurrentSyncDevice = syncProfileNames[i] ; 453 mCurrentSyncDevice = syncProfileNames[i] ;
454 mCurrentSyncName = mLocalMachineName; 454 mCurrentSyncName = mLocalMachineName;
455 if ( i == 0 ) { 455 if ( i == 0 ) {
456 syncSharp(); 456 syncSharp();
457 } else { 457 } else {
458 if ( temp->getIsLocalFileSync() ) { 458 if ( temp->getIsLocalFileSync() ) {
459 switch(mTargetApp) 459 switch(mTargetApp)
460 { 460 {
461 case (KAPI): 461 case (KAPI):
462 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) 462 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
463 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); 463 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
464 break; 464 break;
465 case (KOPI): 465 case (KOPI):
466 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 466 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
467 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); 467 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
468 break; 468 break;
469 case (PWMPI): 469 case (PWMPI):
470 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) 470 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
471 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); 471 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
472 break; 472 break;
473 default: 473 default:
474 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); 474 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
475 break; 475 break;
476 } 476 }
477 } else { 477 } else {
478 if ( temp->getIsPhoneSync() ) { 478 if ( temp->getIsPhoneSync() ) {
479 mPhoneDevice = temp->getPhoneDevice( ) ; 479 mPhoneDevice = temp->getPhoneDevice( ) ;
480 mPhoneConnection = temp->getPhoneConnection( ); 480 mPhoneConnection = temp->getPhoneConnection( );
481 mPhoneModel = temp->getPhoneModel( ); 481 mPhoneModel = temp->getPhoneModel( );
482 syncPhone(); 482 syncPhone();
483 } else if ( temp->getIsPiSync() ) { 483 } else if ( temp->getIsPiSync() ) {
484 if ( mTargetApp == KAPI ) { 484 if ( mTargetApp == KAPI ) {
485 mPassWordPiSync = temp->getRemotePwAB(); 485 mPassWordPiSync = temp->getRemotePwAB();
486 mActiveSyncPort = temp->getRemotePortAB(); 486 mActiveSyncPort = temp->getRemotePortAB();
487 mActiveSyncIP = temp->getRemoteIPAB(); 487 mActiveSyncIP = temp->getRemoteIPAB();
488 } else if ( mTargetApp == KOPI ) { 488 } else if ( mTargetApp == KOPI ) {
489 mPassWordPiSync = temp->getRemotePw(); 489 mPassWordPiSync = temp->getRemotePw();
490 mActiveSyncPort = temp->getRemotePort(); 490 mActiveSyncPort = temp->getRemotePort();
491 mActiveSyncIP = temp->getRemoteIP(); 491 mActiveSyncIP = temp->getRemoteIP();
492 } else { 492 } else {
493 mPassWordPiSync = temp->getRemotePwPWM(); 493 mPassWordPiSync = temp->getRemotePwPWM();
494 mActiveSyncPort = temp->getRemotePortPWM(); 494 mActiveSyncPort = temp->getRemotePortPWM();
495 mActiveSyncIP = temp->getRemoteIPPWM(); 495 mActiveSyncIP = temp->getRemoteIPPWM();
496 } 496 }
497 syncPi(); 497 syncPi();
498 } else 498 } else
499 syncRemote( temp, false ); 499 syncRemote( temp, false );
500 500
501 } 501 }
502 } 502 }
503 timer.start(); 503 timer.start();
504 mParent->topLevelWidget()->setCaption(i18n("Multiple sync in progress ... please wait!") ); 504 mParent->topLevelWidget()->setCaption(i18n("Multiple sync in progress ... please wait!") );
505 while ( timer.elapsed () < 2000 ) { 505 while ( timer.elapsed () < 2000 ) {
506 qApp->processEvents(); 506 qApp->processEvents();
507#ifndef _WIN32_ 507#ifndef _WIN32_
508 sleep (1); 508 sleep (1);
509#endif 509#endif
510 } 510 }
511 511
512 } 512 }
513 513
514 } 514 }
515 delete temp; 515 delete temp;
516 return syncedProfiles; 516 return syncedProfiles;
517} 517}
518 518
519void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) 519void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
520{ 520{