author | zautrix <zautrix> | 2005-11-25 15:49:13 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-25 15:49:13 (UTC) |
commit | 794a5204686ad9bfc16172b01db35f1f3b7683e5 (patch) (unidiff) | |
tree | 29da2cb35a4d6a0cd6885436087fe0659b58a9f4 | |
parent | 90b62d1158d00f162a258541e24aaed4c967480b (diff) | |
download | kdepimpi-794a5204686ad9bfc16172b01db35f1f3b7683e5.zip kdepimpi-794a5204686ad9bfc16172b01db35f1f3b7683e5.tar.gz kdepimpi-794a5204686ad9bfc16172b01db35f1f3b7683e5.tar.bz2 |
sync
-rw-r--r-- | kaddressbook/kabcore.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.h | 2 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 19 | ||||
-rw-r--r-- | korganizer/calendarview.h | 2 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 10 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 51 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 8 | ||||
-rw-r--r-- | libkdepim/ksyncprefsdialog.cpp | 6 |
9 files changed, 80 insertions, 21 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 033e537..2dea619 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -3302,13 +3302,13 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
3302 | } | 3302 | } |
3303 | return syncOK; | 3303 | return syncOK; |
3304 | } | 3304 | } |
3305 | 3305 | ||
3306 | 3306 | ||
3307 | //this is a overwritten callbackmethods from the syncinterface | 3307 | //this is a overwritten callbackmethods from the syncinterface |
3308 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode) | 3308 | bool KABCore::sync(KSyncManager* manager, QString filename, int mode,QString resource) |
3309 | { | 3309 | { |
3310 | 3310 | ||
3311 | //pending prepare addresseeview for output | 3311 | //pending prepare addresseeview for output |
3312 | //pending detect, if remote file has REV field. if not switch to external sync | 3312 | //pending detect, if remote file has REV field. if not switch to external sync |
3313 | mGlobalSyncMode = SYNC_MODE_NORMAL; | 3313 | mGlobalSyncMode = SYNC_MODE_NORMAL; |
3314 | if ( manager != syncManager ) | 3314 | if ( manager != syncManager ) |
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h index 42b7709..c4a0b3b 100644 --- a/kaddressbook/kabcore.h +++ b/kaddressbook/kabcore.h | |||
@@ -509,13 +509,13 @@ class KABCore : public QWidget, public KSyncInterface | |||
509 | 509 | ||
510 | #ifdef KAB_EMBEDDED | 510 | #ifdef KAB_EMBEDDED |
511 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient | 511 | KAddressBookMain *mMainWindow; // should be the same like mGUIClient |
512 | #endif //KAB_EMBEDDED | 512 | #endif //KAB_EMBEDDED |
513 | 513 | ||
514 | //this are the overwritten callbackmethods from the syncinterface | 514 | //this are the overwritten callbackmethods from the syncinterface |
515 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 515 | virtual bool sync(KSyncManager* manager, QString filename, int mode,QString resource); |
516 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 516 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
517 | virtual void removeSyncInfo( QString syncProfile); | 517 | virtual void removeSyncInfo( QString syncProfile); |
518 | bool syncPhone(); | 518 | bool syncPhone(); |
519 | void message( QString m , bool startTimer = true); | 519 | void message( QString m , bool startTimer = true); |
520 | 520 | ||
521 | // LR ******************************* | 521 | // LR ******************************* |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 31e103d..8965d3b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -1975,13 +1975,12 @@ bool CalendarView::syncCalendar(QString filename, int mode) | |||
1975 | return syncOK; | 1975 | return syncOK; |
1976 | } | 1976 | } |
1977 | 1977 | ||
1978 | void CalendarView::syncExternal( int mode ) | 1978 | void CalendarView::syncExternal( int mode ) |
1979 | { | 1979 | { |
1980 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; | 1980 | mGlobalSyncMode = SYNC_MODE_EXTERNAL; |
1981 | |||
1982 | qApp->processEvents(); | 1981 | qApp->processEvents(); |
1983 | CalendarLocal* calendar = new CalendarLocal(); | 1982 | CalendarLocal* calendar = new CalendarLocal(); |
1984 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 1983 | calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
1985 | bool syncOK = false; | 1984 | bool syncOK = false; |
1986 | bool loadSuccess = false; | 1985 | bool loadSuccess = false; |
1987 | PhoneFormat* phoneFormat = 0; | 1986 | PhoneFormat* phoneFormat = 0; |
@@ -5031,23 +5030,37 @@ void CalendarView::keyPressEvent ( QKeyEvent *e) | |||
5031 | { | 5030 | { |
5032 | //qDebug("CalendarView::keyPressEvent "); | 5031 | //qDebug("CalendarView::keyPressEvent "); |
5033 | e->ignore(); | 5032 | e->ignore(); |
5034 | } | 5033 | } |
5035 | 5034 | ||
5036 | 5035 | ||
5037 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) | 5036 | bool CalendarView::sync(KSyncManager* manager, QString filename, int mode,QString resource) |
5038 | { | 5037 | { |
5039 | 5038 | ||
5040 | if ( manager != mSyncManager) | 5039 | if ( manager != mSyncManager) |
5041 | qDebug("KO: Internal error-1. SyncManager mismatch "); | 5040 | qDebug("KO: Internal error-1. SyncManager mismatch "); |
5042 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { | 5041 | if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { |
5043 | qDebug("KO: SyncKDE request detected!"); | 5042 | qDebug("KO: SyncKDE request detected!"); |
5044 | } | 5043 | } |
5045 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); | 5044 | mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); |
5046 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); | 5045 | mCurrentSyncName = mSyncManager->getCurrentSyncName(); |
5047 | return syncCalendar( filename, mode ); | 5046 | if ( !resource.isEmpty() ) { |
5047 | int exclusiveSyncResource = KOPrefs::instance()->getFuzzyCalendarID( resource ); | ||
5048 | qDebug( "KO: Sync request for resource: %s", resource.latin1() ); | ||
5049 | |||
5050 | if ( !exclusiveSyncResource ) { | ||
5051 | qDebug( "KO: Requested sync resource not found: %s", resource.latin1() ); | ||
5052 | return false; | ||
5053 | } | ||
5054 | mCalendar->setDefaultCalendar( exclusiveSyncResource ); | ||
5055 | mCalendar->setDefaultCalendarEnabledOnly(); | ||
5056 | } | ||
5057 | bool result = syncCalendar( filename, mode ); | ||
5058 | if ( !resource.isEmpty() ) | ||
5059 | restoreCalendarSettings(); | ||
5060 | return result; | ||
5048 | } | 5061 | } |
5049 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) | 5062 | bool CalendarView::syncExternal(KSyncManager* manager, QString resource) |
5050 | { | 5063 | { |
5051 | //mSyncManager = manager; | 5064 | //mSyncManager = manager; |
5052 | if ( manager != mSyncManager) | 5065 | if ( manager != mSyncManager) |
5053 | qDebug("KO: Internal error-2. SyncManager mismatch "); | 5066 | qDebug("KO: Internal error-2. SyncManager mismatch "); |
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 80f7ed4..f85b6a3 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h | |||
@@ -515,13 +515,13 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser | |||
515 | 515 | ||
516 | public: | 516 | public: |
517 | void createRunningDate4Todo( Todo * runT, QDateTime start , QDateTime end, int secLenRunning, int secLenPausing,int dayInterval ); | 517 | void createRunningDate4Todo( Todo * runT, QDateTime start , QDateTime end, int secLenRunning, int secLenPausing,int dayInterval ); |
518 | // show a standard warning | 518 | // show a standard warning |
519 | // returns KMsgBox::yesNoCancel() | 519 | // returns KMsgBox::yesNoCancel() |
520 | int msgCalModified(); | 520 | int msgCalModified(); |
521 | virtual bool sync(KSyncManager* manager, QString filename, int mode); | 521 | virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource); |
522 | 522 | ||
523 | virtual bool syncExternal(KSyncManager* manager, QString resource); | 523 | virtual bool syncExternal(KSyncManager* manager, QString resource); |
524 | virtual void removeSyncInfo( QString syncProfile); | 524 | virtual void removeSyncInfo( QString syncProfile); |
525 | void setSyncManager(KSyncManager* manager); | 525 | void setSyncManager(KSyncManager* manager); |
526 | void setLoadedFileVersion(QDateTime); | 526 | void setLoadedFileVersion(QDateTime); |
527 | bool checkFileVersion(QString fn); | 527 | bool checkFileVersion(QString fn); |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 1b0e5f4..31ef338 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -525,12 +525,22 @@ int KOPrefs::getCalendarID( const QString & name ) | |||
525 | if ( name == kkf->mName) | 525 | if ( name == kkf->mName) |
526 | return kkf->mCalNumber; | 526 | return kkf->mCalNumber; |
527 | kkf = mCalendars.next(); | 527 | kkf = mCalendars.next(); |
528 | } | 528 | } |
529 | return 1; | 529 | return 1; |
530 | } | 530 | } |
531 | int KOPrefs::getFuzzyCalendarID( const QString & name ) | ||
532 | { | ||
533 | KopiCalendarFile * kkf = mCalendars.first(); | ||
534 | while ( kkf ) { | ||
535 | if ( name.lower() == kkf->mName.lower()) | ||
536 | return kkf->mCalNumber; | ||
537 | kkf = mCalendars.next(); | ||
538 | } | ||
539 | return 0; | ||
540 | } | ||
531 | QString KOPrefs::calName( int calNum) const | 541 | QString KOPrefs::calName( int calNum) const |
532 | { | 542 | { |
533 | return (mDefCalColors[calNum-1])->mName; | 543 | return (mDefCalColors[calNum-1])->mName; |
534 | } | 544 | } |
535 | QColor KOPrefs::defaultColor( int calNum ) const | 545 | QColor KOPrefs::defaultColor( int calNum ) const |
536 | { | 546 | { |
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index bac8010..70da096 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h | |||
@@ -102,12 +102,13 @@ class KOPrefs : public KPimPrefs | |||
102 | KopiCalendarFile * getNewCalendar(); | 102 | KopiCalendarFile * getNewCalendar(); |
103 | KopiCalendarFile * getCalendar( int ); | 103 | KopiCalendarFile * getCalendar( int ); |
104 | void deleteCalendar( int ); | 104 | void deleteCalendar( int ); |
105 | QColor defaultColor( int ) const; | 105 | QColor defaultColor( int ) const; |
106 | QString calName( int ) const; | 106 | QString calName( int ) const; |
107 | int getCalendarID( const QString & name ); | 107 | int getCalendarID( const QString & name ); |
108 | int getFuzzyCalendarID( const QString & name ); | ||
108 | protected: | 109 | protected: |
109 | void setTimeZoneIdDefault(); | 110 | void setTimeZoneIdDefault(); |
110 | 111 | ||
111 | /** Fill empty mail fields with default values. */ | 112 | /** Fill empty mail fields with default values. */ |
112 | void fillMailDefaults(); | 113 | void fillMailDefaults(); |
113 | 114 | ||
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index d71264f..a64eb34 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -193,12 +193,13 @@ void KSyncManager::slotClearMenu( int action ) | |||
193 | return; | 193 | return; |
194 | mImplementation->removeSyncInfo( syncDevice ); | 194 | mImplementation->removeSyncInfo( syncDevice ); |
195 | } | 195 | } |
196 | void KSyncManager::slotSyncMenu( int action ) | 196 | void KSyncManager::slotSyncMenu( int action ) |
197 | { | 197 | { |
198 | qDebug("KSM::syncaction %d ", action); | 198 | qDebug("KSM::syncaction %d ", action); |
199 | mCurrentResourceLocal = ""; | ||
199 | if ( action == 5000 ) | 200 | if ( action == 5000 ) |
200 | return; | 201 | return; |
201 | mSyncWithDesktop = false; | 202 | mSyncWithDesktop = false; |
202 | if ( action == 0 ) { | 203 | if ( action == 0 ) { |
203 | 204 | ||
204 | // seems to be a Qt2 event handling bug | 205 | // seems to be a Qt2 event handling bug |
@@ -310,18 +311,21 @@ void KSyncManager::slotSyncMenu( int action ) | |||
310 | } else { | 311 | } else { |
311 | if ( temp->getIsPhoneSync() ) { | 312 | if ( temp->getIsPhoneSync() ) { |
312 | mPhoneDevice = temp->getPhoneDevice( ) ; | 313 | mPhoneDevice = temp->getPhoneDevice( ) ; |
313 | mPhoneConnection = temp->getPhoneConnection( ); | 314 | mPhoneConnection = temp->getPhoneConnection( ); |
314 | mPhoneModel = temp->getPhoneModel( ); | 315 | mPhoneModel = temp->getPhoneModel( ); |
315 | syncPhone(); | 316 | syncPhone(); |
316 | } else if ( temp->getIsPiSync() ) { | 317 | } else if ( temp->getIsPiSync()|| temp->getIsPiSyncSpec()) { |
318 | mSpecificResources.clear(); | ||
317 | if ( mTargetApp == KAPI ) { | 319 | if ( mTargetApp == KAPI ) { |
318 | mPassWordPiSync = temp->getRemotePwAB(); | 320 | mPassWordPiSync = temp->getRemotePwAB(); |
319 | mActiveSyncPort = temp->getRemotePortAB(); | 321 | mActiveSyncPort = temp->getRemotePortAB(); |
320 | mActiveSyncIP = temp->getRemoteIPAB(); | 322 | mActiveSyncIP = temp->getRemoteIPAB(); |
321 | } else if ( mTargetApp == KOPI ) { | 323 | } else if ( mTargetApp == KOPI ) { |
324 | if ( temp->getIsPiSyncSpec() ) | ||
325 | mSpecificResources = QStringList::split( ":", temp->getResSpecKopi() ); | ||
322 | mPassWordPiSync = temp->getRemotePw(); | 326 | mPassWordPiSync = temp->getRemotePw(); |
323 | mActiveSyncPort = temp->getRemotePort(); | 327 | mActiveSyncPort = temp->getRemotePort(); |
324 | mActiveSyncIP = temp->getRemoteIP(); | 328 | mActiveSyncIP = temp->getRemoteIP(); |
325 | } else { | 329 | } else { |
326 | mPassWordPiSync = temp->getRemotePwPWM(); | 330 | mPassWordPiSync = temp->getRemotePwPWM(); |
327 | mActiveSyncPort = temp->getRemotePortPWM(); | 331 | mActiveSyncPort = temp->getRemotePortPWM(); |
@@ -500,13 +504,13 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) | |||
500 | if ( !edit_sync_options()) { | 504 | if ( !edit_sync_options()) { |
501 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); | 505 | mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); |
502 | return false; | 506 | return false; |
503 | } | 507 | } |
504 | if ( result == 0 ) { | 508 | if ( result == 0 ) { |
505 | //qDebug("Now sycing ... "); | 509 | //qDebug("Now sycing ... "); |
506 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) | 510 | if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ,mCurrentResourceLocal ) ) |
507 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); | 511 | mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); |
508 | else | 512 | else |
509 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); | 513 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); |
510 | if ( ! quick ) | 514 | if ( ! quick ) |
511 | mPrefs->mLastSyncedLocalFile = fn; | 515 | mPrefs->mLastSyncedLocalFile = fn; |
512 | } | 516 | } |
@@ -524,12 +528,13 @@ void KSyncManager::quickSyncLocalFile() | |||
524 | 528 | ||
525 | void KSyncManager::multiSync( bool askforPrefs ) | 529 | void KSyncManager::multiSync( bool askforPrefs ) |
526 | { | 530 | { |
527 | if (blockSave()) | 531 | if (blockSave()) |
528 | return; | 532 | return; |
529 | setBlockSave(true); | 533 | setBlockSave(true); |
534 | mCurrentResourceLocal = ""; | ||
530 | if ( askforPrefs ) { | 535 | if ( askforPrefs ) { |
531 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 536 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
532 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), | 537 | if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), |
533 | question, | 538 | question, |
534 | i18n("Yes"), i18n("No"), | 539 | i18n("Yes"), i18n("No"), |
535 | 0, 0 ) != 0 ) { | 540 | 0, 0 ) != 0 ) { |
@@ -569,12 +574,13 @@ int KSyncManager::ringSync() | |||
569 | unsigned int i; | 574 | unsigned int i; |
570 | QTime timer; | 575 | QTime timer; |
571 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); | 576 | KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); |
572 | QStringList syncProfileNames = mSyncProfileNames; | 577 | QStringList syncProfileNames = mSyncProfileNames; |
573 | KSyncProfile* temp = new KSyncProfile (); | 578 | KSyncProfile* temp = new KSyncProfile (); |
574 | mAskForPreferences = false; | 579 | mAskForPreferences = false; |
580 | mCurrentResourceLocal = ""; | ||
575 | for ( i = 0; i < syncProfileNames.count(); ++i ) { | 581 | for ( i = 0; i < syncProfileNames.count(); ++i ) { |
576 | mCurrentSyncProfile = i; | 582 | mCurrentSyncProfile = i; |
577 | temp->setName(syncProfileNames[mCurrentSyncProfile]); | 583 | temp->setName(syncProfileNames[mCurrentSyncProfile]); |
578 | temp->readConfig(&config); | 584 | temp->readConfig(&config); |
579 | 585 | ||
580 | bool includeInRingSync = false; | 586 | bool includeInRingSync = false; |
@@ -646,18 +652,20 @@ int KSyncManager::ringSync() | |||
646 | } else { | 652 | } else { |
647 | if ( temp->getIsPhoneSync() ) { | 653 | if ( temp->getIsPhoneSync() ) { |
648 | mPhoneDevice = temp->getPhoneDevice( ) ; | 654 | mPhoneDevice = temp->getPhoneDevice( ) ; |
649 | mPhoneConnection = temp->getPhoneConnection( ); | 655 | mPhoneConnection = temp->getPhoneConnection( ); |
650 | mPhoneModel = temp->getPhoneModel( ); | 656 | mPhoneModel = temp->getPhoneModel( ); |
651 | syncPhone(); | 657 | syncPhone(); |
652 | } else if ( temp->getIsPiSync() ) { | 658 | } else if ( temp->getIsPiSync() || temp->getIsPiSyncSpec()) { |
659 | mSpecificResources.clear(); | ||
653 | if ( mTargetApp == KAPI ) { | 660 | if ( mTargetApp == KAPI ) { |
654 | mPassWordPiSync = temp->getRemotePwAB(); | 661 | mPassWordPiSync = temp->getRemotePwAB(); |
655 | mActiveSyncPort = temp->getRemotePortAB(); | 662 | mActiveSyncPort = temp->getRemotePortAB(); |
656 | mActiveSyncIP = temp->getRemoteIPAB(); | 663 | mActiveSyncIP = temp->getRemoteIPAB(); |
657 | } else if ( mTargetApp == KOPI ) { | 664 | } else if ( mTargetApp == KOPI ) { |
665 | mSpecificResources = QStringList::split( ":", temp->getResSpecKopi() ); | ||
658 | mPassWordPiSync = temp->getRemotePw(); | 666 | mPassWordPiSync = temp->getRemotePw(); |
659 | mActiveSyncPort = temp->getRemotePort(); | 667 | mActiveSyncPort = temp->getRemotePort(); |
660 | mActiveSyncIP = temp->getRemoteIP(); | 668 | mActiveSyncIP = temp->getRemoteIP(); |
661 | } else { | 669 | } else { |
662 | mPassWordPiSync = temp->getRemotePwPWM(); | 670 | mPassWordPiSync = temp->getRemotePwPWM(); |
663 | mActiveSyncPort = temp->getRemotePortPWM(); | 671 | mActiveSyncPort = temp->getRemotePortPWM(); |
@@ -1124,15 +1132,35 @@ void KSyncManager::syncPi() | |||
1124 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); | 1132 | Q_UINT16 port = mActiveSyncPort.toUInt(&ok); |
1125 | if ( ! ok ) { | 1133 | if ( ! ok ) { |
1126 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); | 1134 | mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); |
1127 | mPisyncFinished = true; | 1135 | mPisyncFinished = true; |
1128 | return; | 1136 | return; |
1129 | } | 1137 | } |
1130 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); | 1138 | mCurrentResourceLocal = ""; |
1131 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 1139 | mCurrentResourceRemote = ""; |
1132 | commandSocket->readFile( syncFileName() ); | 1140 | if ( mSpecificResources.count() ) { |
1141 | int startLocal = 0; | ||
1142 | int startRemote = mSpecificResources.count()/2; | ||
1143 | while ( startLocal < mSpecificResources.count()/2 ) { | ||
1144 | mPisyncFinished = false; | ||
1145 | mCurrentResourceLocal = mSpecificResources[ startLocal ]; | ||
1146 | mCurrentResourceRemote = mSpecificResources[ startRemote ]; | ||
1147 | KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); | ||
1148 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | ||
1149 | commandSocket->readFile( syncFileName() ); | ||
1150 | while ( !mPisyncFinished ) { | ||
1151 | //qDebug("waiting "); | ||
1152 | qApp->processEvents(); | ||
1153 | } | ||
1154 | ++startLocal; | ||
1155 | } | ||
1156 | } else { | ||
1157 | KCommandSocket* commandSocket = new KCommandSocket( "", mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); | ||
1158 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | ||
1159 | commandSocket->readFile( syncFileName() ); | ||
1160 | } | ||
1133 | } | 1161 | } |
1134 | 1162 | ||
1135 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | 1163 | void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) |
1136 | { | 1164 | { |
1137 | //enum { success, errorW, errorR, quiet }; | 1165 | //enum { success, errorW, errorR, quiet }; |
1138 | 1166 | ||
@@ -1151,13 +1179,13 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | |||
1151 | else if ( state == KCommandSocket::errorED ) | 1179 | else if ( state == KCommandSocket::errorED ) |
1152 | mParent->topLevelWidget()->setCaption( i18n("Please close error dialog on remote.") ); | 1180 | mParent->topLevelWidget()->setCaption( i18n("Please close error dialog on remote.") ); |
1153 | else if ( state == KCommandSocket::errorUN ) | 1181 | else if ( state == KCommandSocket::errorUN ) |
1154 | mParent->topLevelWidget()->setCaption( i18n("Unknown error on remote.") ); | 1182 | mParent->topLevelWidget()->setCaption( i18n("Unknown error on remote.") ); |
1155 | delete s; | 1183 | delete s; |
1156 | if ( state == KCommandSocket::errorR ) { | 1184 | if ( state == KCommandSocket::errorR ) { |
1157 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); | 1185 | KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); |
1158 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1186 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1159 | commandSocket->sendStop(); | 1187 | commandSocket->sendStop(); |
1160 | } | 1188 | } |
1161 | mPisyncFinished = true; | 1189 | mPisyncFinished = true; |
1162 | return; | 1190 | return; |
1163 | 1191 | ||
@@ -1188,13 +1216,13 @@ void KSyncManager::readFileFromSocket() | |||
1188 | bool syncOK = true; | 1216 | bool syncOK = true; |
1189 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); | 1217 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); |
1190 | if ( ! syncWithFile( fileName , true ) ) { | 1218 | if ( ! syncWithFile( fileName , true ) ) { |
1191 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); | 1219 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); |
1192 | syncOK = false; | 1220 | syncOK = false; |
1193 | } | 1221 | } |
1194 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); | 1222 | KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); |
1195 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1223 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1196 | if ( mWriteBackFile && syncOK ) { | 1224 | if ( mWriteBackFile && syncOK ) { |
1197 | mParent->topLevelWidget()->setCaption( i18n("Sending back file ...") ); | 1225 | mParent->topLevelWidget()->setCaption( i18n("Sending back file ...") ); |
1198 | commandSocket->writeFile( fileName ); | 1226 | commandSocket->writeFile( fileName ); |
1199 | } | 1227 | } |
1200 | else { | 1228 | else { |
@@ -1459,14 +1487,17 @@ void KServerSocket::readBackFileFromSocket() | |||
1459 | delete mSyncActionDialog; | 1487 | delete mSyncActionDialog; |
1460 | mSyncActionDialog = 0; | 1488 | mSyncActionDialog = 0; |
1461 | blockRC = false; | 1489 | blockRC = false; |
1462 | 1490 | ||
1463 | } | 1491 | } |
1464 | 1492 | ||
1465 | KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name ) | 1493 | KCommandSocket::KCommandSocket ( QString remres, QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name ) |
1466 | { | 1494 | { |
1495 | mRemoteResource = remres; | ||
1496 | if ( mRemoteResource.isEmpty() ) | ||
1497 | mRemoteResource = "ALL"; | ||
1467 | mPassWord = password; | 1498 | mPassWord = password; |
1468 | mSocket = 0; | 1499 | mSocket = 0; |
1469 | mFirst = false; | 1500 | mFirst = false; |
1470 | mFirstLine = true; | 1501 | mFirstLine = true; |
1471 | mPort = port; | 1502 | mPort = port; |
1472 | mHost = host; | 1503 | mHost = host; |
@@ -1487,13 +1518,13 @@ void KCommandSocket::sendFileRequest() | |||
1487 | mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") ); | 1518 | mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") ); |
1488 | mTimerSocket->start( 100, true ); | 1519 | mTimerSocket->start( 100, true ); |
1489 | QTextStream os( mSocket ); | 1520 | QTextStream os( mSocket ); |
1490 | os.setEncoding( QTextStream::Latin1 ); | 1521 | os.setEncoding( QTextStream::Latin1 ); |
1491 | 1522 | ||
1492 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); | 1523 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); |
1493 | os << "GET " << mPassWord << curDt <<"\r\n\r\n"; | 1524 | os << "GET " << mPassWord << curDt << mRemoteResource << "\r\n\r\n"; |
1494 | } | 1525 | } |
1495 | 1526 | ||
1496 | void KCommandSocket::readFile( QString fn ) | 1527 | void KCommandSocket::readFile( QString fn ) |
1497 | { | 1528 | { |
1498 | if ( !mSocket ) { | 1529 | if ( !mSocket ) { |
1499 | mSocket = new QSocket( this ); | 1530 | mSocket = new QSocket( this ); |
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index d3734da..f4654ce 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -78,13 +78,13 @@ class KServerSocket : public QServerSocket | |||
78 | 78 | ||
79 | class KCommandSocket : public QObject | 79 | class KCommandSocket : public QObject |
80 | { | 80 | { |
81 | Q_OBJECT | 81 | Q_OBJECT |
82 | public: | 82 | public: |
83 | enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet }; | 83 | enum state { successR, errorR, successW, errorW, errorTO, errorPW, errorCA, errorFI, errorUN, errorED,quiet }; |
84 | KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); | 84 | KCommandSocket (QString remoteResource, QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 ); |
85 | void readFile( QString ); | 85 | void readFile( QString ); |
86 | void writeFile( QString ); | 86 | void writeFile( QString ); |
87 | void sendStop(); | 87 | void sendStop(); |
88 | 88 | ||
89 | private slots : | 89 | private slots : |
90 | void sendFileRequest(); | 90 | void sendFileRequest(); |
@@ -95,12 +95,13 @@ class KCommandSocket : public QObject | |||
95 | private slots: | 95 | private slots: |
96 | void startReadFileFromSocket(); | 96 | void startReadFileFromSocket(); |
97 | void readFileFromSocket(); | 97 | void readFileFromSocket(); |
98 | void deleteSocket(); | 98 | void deleteSocket(); |
99 | void writeFileToSocket(); | 99 | void writeFileToSocket(); |
100 | private : | 100 | private : |
101 | QString mRemoteResource; | ||
101 | int mConnectCount; | 102 | int mConnectCount; |
102 | int mConnectMax; | 103 | int mConnectMax; |
103 | KProgressDialog mConnectProgress; | 104 | KProgressDialog mConnectProgress; |
104 | QWidget* tlw; | 105 | QWidget* tlw; |
105 | QSocket* mSocket; | 106 | QSocket* mSocket; |
106 | QString mPassWord; | 107 | QString mPassWord; |
@@ -199,12 +200,15 @@ class KSyncManager : public QObject | |||
199 | void syncRemote( KSyncProfile* prof, bool ask = true); | 200 | void syncRemote( KSyncProfile* prof, bool ask = true); |
200 | bool edit_sync_options(); | 201 | bool edit_sync_options(); |
201 | bool edit_pisync_options(); | 202 | bool edit_pisync_options(); |
202 | int ringSync(); | 203 | int ringSync(); |
203 | QString getPassword( ); | 204 | QString getPassword( ); |
204 | bool mPisyncFinished; | 205 | bool mPisyncFinished; |
206 | QStringList mSpecificResources; | ||
207 | QString mCurrentResourceLocal; | ||
208 | QString mCurrentResourceRemote; | ||
205 | bool mBlockSaveFlag; | 209 | bool mBlockSaveFlag; |
206 | QWidget* mParent; | 210 | QWidget* mParent; |
207 | KSyncInterface* mImplementation; | 211 | KSyncInterface* mImplementation; |
208 | TargetApp mTargetApp; | 212 | TargetApp mTargetApp; |
209 | QPopupMenu* mSyncMenu; | 213 | QPopupMenu* mSyncMenu; |
210 | QProgressBar* bar; | 214 | QProgressBar* bar; |
@@ -219,13 +223,13 @@ private slots: | |||
219 | 223 | ||
220 | 224 | ||
221 | class KSyncInterface | 225 | class KSyncInterface |
222 | { | 226 | { |
223 | public : | 227 | public : |
224 | virtual void removeSyncInfo( QString syncProfile) = 0; | 228 | virtual void removeSyncInfo( QString syncProfile) = 0; |
225 | virtual bool sync(KSyncManager* manager, QString filename, int mode) = 0; | 229 | virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource) = 0; |
226 | virtual bool syncExternal(KSyncManager* manager, QString resource) | 230 | virtual bool syncExternal(KSyncManager* manager, QString resource) |
227 | { | 231 | { |
228 | // empty implementation, because some syncable applications do not | 232 | // empty implementation, because some syncable applications do not |
229 | // have an external(sharpdtm) syncmode, like pwmanager. | 233 | // have an external(sharpdtm) syncmode, like pwmanager. |
230 | return false; | 234 | return false; |
231 | } | 235 | } |
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 292cde1..27f7932 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp | |||
@@ -589,14 +589,14 @@ void KSyncPrefsDialog::profileChanged( int item ) | |||
589 | mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ; | 589 | mIsPiSpecific->setChecked(prof->getIsPiSyncSpec()) ; |
590 | mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; | 590 | mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; |
591 | mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; | 591 | mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; |
592 | 592 | ||
593 | 593 | ||
594 | QStringList res = QStringList::split( ":",prof->getResSpecKopi()); | 594 | QStringList res = QStringList::split( ":",prof->getResSpecKopi()); |
595 | int i; | 595 | int i= res.count()/2; |
596 | for ( i = 0;i < res.count(); ++i ) { | 596 | for ( ;i < res.count(); ++i ) { |
597 | mResTableKopi->setText( i, 0, res[i] ); | 597 | mResTableKopi->setText( i, 0, res[i] ); |
598 | } | 598 | } |
599 | res = QStringList::split( ":",prof->getResSpecKapi()); | 599 | res = QStringList::split( ":",prof->getResSpecKapi()); |
600 | for ( i = 0;i < res.count(); ++i ) { | 600 | for ( i = 0;i < res.count(); ++i ) { |
601 | mResTableKapi->setText( i, 0, res[i] ); | 601 | mResTableKapi->setText( i, 0, res[i] ); |
602 | } | 602 | } |
@@ -749,13 +749,13 @@ void KSyncPrefsDialog::saveProfile() | |||
749 | prof->setFilterInCal ( mFilterInCal->currentText ()); | 749 | prof->setFilterInCal ( mFilterInCal->currentText ()); |
750 | prof->setFilterOutCal ( mFilterOutCal ->currentText ()); | 750 | prof->setFilterOutCal ( mFilterOutCal ->currentText ()); |
751 | prof->setFilterInAB ( mFilterInAB ->currentText ()); | 751 | prof->setFilterInAB ( mFilterInAB ->currentText ()); |
752 | prof->setFilterOutAB ( mFilterOutAB ->currentText ()); | 752 | prof->setFilterOutAB ( mFilterOutAB ->currentText ()); |
753 | if ( mIsPiSpecific->isChecked() ) { | 753 | if ( mIsPiSpecific->isChecked() ) { |
754 | 754 | ||
755 | QStringList res; | 755 | QStringList res = mResourcesKopi; |
756 | int i; | 756 | int i; |
757 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { | 757 | for ( i = 0;i < mResourcesKopi.count(); ++i ) { |
758 | res.append( mResTableKopi->text( i, 0 )); | 758 | res.append( mResTableKopi->text( i, 0 )); |
759 | } | 759 | } |
760 | prof->setResSpecKopi( res.join(":")); | 760 | prof->setResSpecKopi( res.join(":")); |
761 | } | 761 | } |