summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp19
-rw-r--r--korganizer/calendarview.h2
-rw-r--r--korganizer/koprefs.cpp10
-rw-r--r--korganizer/koprefs.h1
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
@@ -1979,5 +1979,4 @@ void CalendarView::syncExternal( int mode )
{
mGlobalSyncMode = SYNC_MODE_EXTERNAL;
-
qApp->processEvents();
CalendarLocal* calendar = new CalendarLocal();
@@ -5035,5 +5034,5 @@ 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)
{
@@ -5045,5 +5044,19 @@ 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
@@ -519,5 +519,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
// 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);
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 1b0e5f4..31ef338 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -529,4 +529,14 @@ 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
{
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index bac8010..70da096 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -106,4 +106,5 @@ class KOPrefs : public KPimPrefs
QString calName( int ) const;
int getCalendarID( const QString & name );
+ int getFuzzyCalendarID( const QString & name );
protected:
void setTimeZoneIdDefault();