-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 |
4 files changed, 28 insertions, 4 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 31e103d..8965d3b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1978,7 +1978,6 @@ bool CalendarView::syncCalendar(QString filename, int mode) void CalendarView::syncExternal( int mode ) { mGlobalSyncMode = SYNC_MODE_EXTERNAL; - qApp->processEvents(); CalendarLocal* calendar = new CalendarLocal(); calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); @@ -5034,7 +5033,7 @@ void CalendarView::keyPressEvent ( QKeyEvent *e) } -bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) +bool CalendarView::sync(KSyncManager* manager, QString filename, int mode,QString resource) { if ( manager != mSyncManager) @@ -5044,7 +5043,21 @@ bool CalendarView::sync(KSyncManager* manager, QString filename, int mode) } 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) { diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 80f7ed4..f85b6a3 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -518,7 +518,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser // show a standard warning // returns KMsgBox::yesNoCancel() int msgCalModified(); - virtual bool sync(KSyncManager* manager, QString filename, int mode); + virtual bool sync(KSyncManager* manager, QString filename, int mode, QString resource); virtual bool syncExternal(KSyncManager* manager, QString resource); virtual void removeSyncInfo( QString syncProfile); diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 1b0e5f4..31ef338 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -528,6 +528,16 @@ int KOPrefs::getCalendarID( const QString & name ) } return 1; } +int KOPrefs::getFuzzyCalendarID( const QString & name ) +{ + KopiCalendarFile * kkf = mCalendars.first(); + while ( kkf ) { + if ( name.lower() == kkf->mName.lower()) + return kkf->mCalNumber; + kkf = mCalendars.next(); + } + return 0; +} QString KOPrefs::calName( int calNum) const { return (mDefCalColors[calNum-1])->mName; diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index bac8010..70da096 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -105,6 +105,7 @@ class KOPrefs : public KPimPrefs QColor defaultColor( int ) const; QString calName( int ) const; int getCalendarID( const QString & name ); + int getFuzzyCalendarID( const QString & name ); protected: void setTimeZoneIdDefault(); |