-rw-r--r-- | korganizer/calendarview.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
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) return syncOK; } void CalendarView::syncExternal( int mode ) { mGlobalSyncMode = SYNC_MODE_EXTERNAL; - qApp->processEvents(); CalendarLocal* calendar = new CalendarLocal(); calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); bool syncOK = false; bool loadSuccess = false; PhoneFormat* phoneFormat = 0; @@ -5031,23 +5030,37 @@ void CalendarView::keyPressEvent ( QKeyEvent *e) { //qDebug("CalendarView::keyPressEvent "); e->ignore(); } -bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) +bool CalendarView::sync(KSyncManager* manager, QString filename, int mode,QString resource) { if ( manager != mSyncManager) qDebug("KO: Internal error-1. SyncManager mismatch "); if ( filename == QDir::homeDirPath ()+"/.kdecalendardump.ics" ) { qDebug("KO: SyncKDE request detected!"); } mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice(); mCurrentSyncName = mSyncManager->getCurrentSyncName(); - return syncCalendar( filename, mode ); + if ( !resource.isEmpty() ) { + int exclusiveSyncResource = KOPrefs::instance()->getFuzzyCalendarID( resource ); + qDebug( "KO: Sync request for resource: %s", resource.latin1() ); + + if ( !exclusiveSyncResource ) { + qDebug( "KO: Requested sync resource not found: %s", resource.latin1() ); + return false; + } + mCalendar->setDefaultCalendar( exclusiveSyncResource ); + mCalendar->setDefaultCalendarEnabledOnly(); + } + bool result = syncCalendar( filename, mode ); + if ( !resource.isEmpty() ) + restoreCalendarSettings(); + return result; } bool CalendarView::syncExternal(KSyncManager* manager, QString resource) { //mSyncManager = manager; if ( manager != mSyncManager) qDebug("KO: Internal error-2. SyncManager mismatch "); |