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
@@ -1973,17 +1973,16 @@ bool CalendarView::syncCalendar(QString filename, int mode)
if ( syncOK )
updateView();
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;
emit tempDisableBR(true);
#ifndef DESKTOP_VERSION
@@ -5029,27 +5028,41 @@ void CalendarView::slotCalendarChanged()
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 ");
mCurrentSyncDevice = mSyncManager->getCurrentSyncDevice();
mCurrentSyncName = mSyncManager->getCurrentSyncName();
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index 80f7ed4..f85b6a3 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -513,17 +513,17 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void selectWeekNum ( int );
void checkConflictForEvent();
public:
void createRunningDate4Todo( Todo * runT, QDateTime start , QDateTime end, int secLenRunning, int secLenPausing,int dayInterval );
// 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);
void setSyncManager(KSyncManager* manager);
void setLoadedFileVersion(QDateTime);
bool checkFileVersion(QString fn);
bool checkAllFileVersions();
bool checkFileChanged(QString fn);
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 1b0e5f4..31ef338 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -523,16 +523,26 @@ int KOPrefs::getCalendarID( const QString & name )
KopiCalendarFile * kkf = mCalendars.first();
while ( kkf ) {
if ( name == kkf->mName)
return kkf->mCalNumber;
kkf = mCalendars.next();
}
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;
}
QColor KOPrefs::defaultColor( int calNum ) const
{
if ( calNum == 1 ) return mEventColor;
return (mDefCalColors[calNum-1])->mDefaultColor;
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index bac8010..70da096 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -100,16 +100,17 @@ class KOPrefs : public KPimPrefs
void setCategoryDefaults();
void setAllDefaults();
KopiCalendarFile * getNewCalendar();
KopiCalendarFile * getCalendar( int );
void deleteCalendar( int );
QColor defaultColor( int ) const;
QString calName( int ) const;
int getCalendarID( const QString & name );
+ int getFuzzyCalendarID( const QString & name );
protected:
void setTimeZoneIdDefault();
/** Fill empty mail fields with default values. */
void fillMailDefaults();
private:
/** Constructor disabled for public. Use instance() to create a KOPrefs