-rw-r--r-- | libkdepim/ksyncmanager.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 21af295..c12ba1c 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -476,162 +476,164 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) | |||
476 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 476 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
477 | return false; | 477 | return false; |
478 | } | 478 | } |
479 | if ( result == 0 ) { | 479 | if ( result == 0 ) { |
480 | //qDebug("Now sycing ... "); | 480 | //qDebug("Now sycing ... "); |
481 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) | 481 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) |
482 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); | 482 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); |
483 | else | 483 | else |
484 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 484 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
485 | if ( ! quick ) | 485 | if ( ! quick ) |
486 | mPrefs->mLastSyncedLocalFile = fn; | 486 | mPrefs->mLastSyncedLocalFile = fn; |
487 | } | 487 | } |
488 | return ret; | 488 | return ret; |
489 | } | 489 | } |
490 | 490 | ||
491 | void KSyncManager::quickSyncLocalFile() | 491 | void KSyncManager::quickSyncLocalFile() |
492 | { | 492 | { |
493 | 493 | ||
494 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { | 494 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { |
495 | qDebug("quick syncLocalFile() successful "); | 495 | qDebug("quick syncLocalFile() successful "); |
496 | 496 | ||
497 | } | 497 | } |
498 | } | 498 | } |
499 | 499 | ||
500 | void KSyncManager::multiSync( bool askforPrefs ) | 500 | void KSyncManager::multiSync( bool askforPrefs ) |
501 | { | 501 | { |
502 | if (blockSave()) | 502 | if (blockSave()) |
503 | return; | 503 | return; |
504 | setBlockSave(true); | 504 | setBlockSave(true); |
505 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 505 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
506 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), | 506 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), |
507 | question, | 507 | question, |
508 | i18n("Yes"), i18n("No"), | 508 | i18n("Yes"), i18n("No"), |
509 | 0, 0 ) != 0 ) { | 509 | 0, 0 ) != 0 ) { |
510 | setBlockSave(false); | 510 | setBlockSave(false); |
511 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); | 511 | mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); |
512 | return; | 512 | return; |
513 | } | 513 | } |
514 | mCurrentSyncDevice = i18n("Multiple profiles") ; | 514 | mCurrentSyncDevice = i18n("Multiple profiles") ; |
515 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; | 515 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; |
516 | if ( askforPrefs ) { | 516 | if ( askforPrefs ) { |
517 | if ( !edit_sync_options()) { | 517 | if ( !edit_sync_options()) { |
518 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") ); | 518 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") ); |
519 | return; | 519 | return; |
520 | } | 520 | } |
521 | mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; | 521 | mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; |
522 | } | 522 | } |
523 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); | 523 | mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); |
524 | qApp->processEvents(); | 524 | qApp->processEvents(); |
525 | int num = ringSync() ; | 525 | int num = ringSync() ; |
526 | if ( num > 1 ) | 526 | if ( num > 1 ) |
527 | ringSync(); | 527 | ringSync(); |
528 | setBlockSave(false); | 528 | setBlockSave(false); |
529 | if ( num ) | 529 | if ( num ) |
530 | emit save(); | 530 | emit save(); |
531 | if ( num ) | 531 | if ( num ) |
532 | mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); | 532 | mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); |
533 | else | 533 | else |
534 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 534 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
535 | return; | 535 | return; |
536 | } | 536 | } |
537 | 537 | ||
538 | int KSyncManager::ringSync() | 538 | int KSyncManager::ringSync() |
539 | { | 539 | { |
540 | |||
540 | int syncedProfiles = 0; | 541 | int syncedProfiles = 0; |
541 | unsigned int i; | 542 | unsigned int i; |
542 | QTime timer; | 543 | QTime timer; |
543 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 544 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
544 | QStringList syncProfileNames = mSyncProfileNames; | 545 | QStringList syncProfileNames = mSyncProfileNames; |
545 | KSyncProfile* temp = new KSyncProfile (); | 546 | KSyncProfile* temp = new KSyncProfile (); |
546 | mAskForPreferences = false; | 547 | mAskForPreferences = false; |
547 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 548 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
548 | mCurrentSyncProfile = i; | 549 | mCurrentSyncProfile = i; |
549 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 550 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
550 | temp->readConfig(&config); | 551 | temp->readConfig(&config); |
551 | 552 | ||
552 | bool includeInRingSync; | 553 | bool includeInRingSync; |
553 | switch(mTargetApp) | 554 | switch(mTargetApp) |
554 | { | 555 | { |
555 | case (KAPI): | 556 | case (KAPI): |
556 | includeInRingSync = temp->getIncludeInRingSyncAB(); | 557 | includeInRingSync = temp->getIncludeInRingSyncAB(); |
557 | break; | 558 | break; |
558 | case (KOPI): | 559 | case (KOPI): |
559 | includeInRingSync = temp->getIncludeInRingSync(); | 560 | includeInRingSync = temp->getIncludeInRingSync(); |
560 | break; | 561 | break; |
561 | case (PWMPI): | 562 | case (PWMPI): |
562 | includeInRingSync = temp->getIncludeInRingSyncPWM(); | 563 | includeInRingSync = temp->getIncludeInRingSyncPWM(); |
563 | break; | 564 | break; |
564 | default: | 565 | default: |
565 | qDebug("KSyncManager::ringSync: invalid apptype selected"); | 566 | qDebug("KSyncManager::ringSync: invalid apptype selected"); |
566 | break; | 567 | break; |
567 | 568 | ||
568 | } | 569 | } |
569 | 570 | ||
570 | 571 | ||
571 | if ( includeInRingSync && ( i < 1 || i > 2 )) { | 572 | if ( includeInRingSync && ( i < 1 || i > 2 )) { |
572 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); | 573 | mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); |
573 | ++syncedProfiles; | 574 | ++syncedProfiles; |
575 | mSyncWithDesktop = false; | ||
574 | // mAskForPreferences = temp->getAskForPreferences(); | 576 | // mAskForPreferences = temp->getAskForPreferences(); |
575 | mWriteBackFile = temp->getWriteBackFile(); | 577 | mWriteBackFile = temp->getWriteBackFile(); |
576 | mWriteBackExistingOnly = temp->getWriteBackExisting(); | 578 | mWriteBackExistingOnly = temp->getWriteBackExisting(); |
577 | mIsKapiFile = temp->getIsKapiFile(); | 579 | mIsKapiFile = temp->getIsKapiFile(); |
578 | mWriteBackInFuture = 0; | 580 | mWriteBackInFuture = 0; |
579 | if ( temp->getWriteBackFuture() ) | 581 | if ( temp->getWriteBackFuture() ) |
580 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); | 582 | mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); |
581 | mShowSyncSummary = false; | 583 | mShowSyncSummary = false; |
582 | mCurrentSyncDevice = syncProfileNames[i] ; | 584 | mCurrentSyncDevice = syncProfileNames[i] ; |
583 | mCurrentSyncName = mLocalMachineName; | 585 | mCurrentSyncName = mLocalMachineName; |
584 | if ( i == 0 ) { | 586 | if ( i == 0 ) { |
585 | mIsKapiFile = false; | 587 | mIsKapiFile = false; |
586 | #ifdef DESKTOP_VERSION | 588 | #ifdef DESKTOP_VERSION |
587 | syncKDE(); | 589 | syncKDE(); |
588 | #else | 590 | #else |
589 | syncSharp(); | 591 | syncSharp(); |
590 | #endif | 592 | #endif |
591 | } else { | 593 | } else { |
592 | if ( temp->getIsLocalFileSync() ) { | 594 | if ( temp->getIsLocalFileSync() ) { |
593 | switch(mTargetApp) | 595 | switch(mTargetApp) |
594 | { | 596 | { |
595 | case (KAPI): | 597 | case (KAPI): |
596 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) | 598 | if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) |
597 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); | 599 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); |
598 | break; | 600 | break; |
599 | case (KOPI): | 601 | case (KOPI): |
600 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 602 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
601 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); | 603 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); |
602 | break; | 604 | break; |
603 | case (PWMPI): | 605 | case (PWMPI): |
604 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) | 606 | if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) |
605 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); | 607 | mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); |
606 | break; | 608 | break; |
607 | default: | 609 | default: |
608 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); | 610 | qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); |
609 | break; | 611 | break; |
610 | } | 612 | } |
611 | } else { | 613 | } else { |
612 | if ( temp->getIsPhoneSync() ) { | 614 | if ( temp->getIsPhoneSync() ) { |
613 | mPhoneDevice = temp->getPhoneDevice( ) ; | 615 | mPhoneDevice = temp->getPhoneDevice( ) ; |
614 | mPhoneConnection = temp->getPhoneConnection( ); | 616 | mPhoneConnection = temp->getPhoneConnection( ); |
615 | mPhoneModel = temp->getPhoneModel( ); | 617 | mPhoneModel = temp->getPhoneModel( ); |
616 | syncPhone(); | 618 | syncPhone(); |
617 | } else if ( temp->getIsPiSync() ) { | 619 | } else if ( temp->getIsPiSync() ) { |
618 | if ( mTargetApp == KAPI ) { | 620 | if ( mTargetApp == KAPI ) { |
619 | mPassWordPiSync = temp->getRemotePwAB(); | 621 | mPassWordPiSync = temp->getRemotePwAB(); |
620 | mActiveSyncPort = temp->getRemotePortAB(); | 622 | mActiveSyncPort = temp->getRemotePortAB(); |
621 | mActiveSyncIP = temp->getRemoteIPAB(); | 623 | mActiveSyncIP = temp->getRemoteIPAB(); |
622 | } else if ( mTargetApp == KOPI ) { | 624 | } else if ( mTargetApp == KOPI ) { |
623 | mPassWordPiSync = temp->getRemotePw(); | 625 | mPassWordPiSync = temp->getRemotePw(); |
624 | mActiveSyncPort = temp->getRemotePort(); | 626 | mActiveSyncPort = temp->getRemotePort(); |
625 | mActiveSyncIP = temp->getRemoteIP(); | 627 | mActiveSyncIP = temp->getRemoteIP(); |
626 | } else { | 628 | } else { |
627 | mPassWordPiSync = temp->getRemotePwPWM(); | 629 | mPassWordPiSync = temp->getRemotePwPWM(); |
628 | mActiveSyncPort = temp->getRemotePortPWM(); | 630 | mActiveSyncPort = temp->getRemotePortPWM(); |
629 | mActiveSyncIP = temp->getRemoteIPPWM(); | 631 | mActiveSyncIP = temp->getRemoteIPPWM(); |
630 | } | 632 | } |
631 | syncPi(); | 633 | syncPi(); |
632 | while ( !mPisyncFinished ) { | 634 | while ( !mPisyncFinished ) { |
633 | //qDebug("waiting "); | 635 | //qDebug("waiting "); |
634 | qApp->processEvents(); | 636 | qApp->processEvents(); |
635 | } | 637 | } |
636 | timer.start(); | 638 | timer.start(); |
637 | while ( timer.elapsed () < 2000 ) { | 639 | while ( timer.elapsed () < 2000 ) { |