author | zautrix <zautrix> | 2005-11-25 15:49:13 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-25 15:49:13 (UTC) |
commit | 794a5204686ad9bfc16172b01db35f1f3b7683e5 (patch) (side-by-side diff) | |
tree | 29da2cb35a4d6a0cd6885436087fe0659b58a9f4 /korganizer | |
parent | 90b62d1158d00f162a258541e24aaed4c967480b (diff) | |
download | kdepimpi-794a5204686ad9bfc16172b01db35f1f3b7683e5.zip kdepimpi-794a5204686ad9bfc16172b01db35f1f3b7683e5.tar.gz kdepimpi-794a5204686ad9bfc16172b01db35f1f3b7683e5.tar.bz2 |
sync
-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 @@ -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 "); 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 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); 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 ) 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 { 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 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(); |