-rw-r--r-- | korganizer/calendarview.cpp | 4 | ||||
-rw-r--r-- | libkcal/calendar.h | 2 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 11 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 2 |
4 files changed, 14 insertions, 5 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 538325e..9571f16 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1709,25 +1709,25 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( ! bar.isVisible() ) return false; if ( incCounter % modulo == 0 ) bar.setProgress( incCounter ); ++incCounter; uid = inR->uid(); bool skipIncidence = false; if ( uid.left(15) == QString("last-syncEvent-") ) skipIncidence = true; QString idS; qApp->processEvents(); if ( !skipIncidence ) { - inL = local->incidenceForUid( uid , false ); + inL = local->incidenceForUid( uid , false , true ); if ( inL ) { // maybe conflict - same uid in both calendars if ( (take = takeEvent( inL, inR, mode, fullDateRange )) > 0 ) { //qDebug("take %d %s ", take, inL->summary().latin1()); if ( take == 3 ) return false; if ( take == 1 ) {// take local ********************** if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) inL->setCsum( mCurrentSyncDevice, inR->getCsum(mCurrentSyncDevice) ); else idS = inR->IDStr(); int calID = inR->calID(); remote->deleteIncidence( inR ); @@ -1819,25 +1819,25 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int if ( ! bar.isVisible() ) return false; if ( incCounter % modulo == 0 ) bar.setProgress( incCounter ); ++incCounter; uid = inL->uid(); bool skipIncidence = false; if ( uid.left(15) == QString("last-syncEvent-") ) skipIncidence = true; if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL && inL->typeID() == journalID ) skipIncidence = true; if ( !skipIncidence ) { - inR = remote->incidenceForUid( uid , true ); + inR = remote->incidenceForUid( uid , true, true ); if ( ! inR ) { if ( !filterOUT || filterOUT->filterCalendarItem( inL ) ){ // no conflict ********** add or delete local if ( mGlobalSyncMode == SYNC_MODE_EXTERNAL ) { if ( !inL->getID(mCurrentSyncDevice).isEmpty() && mode != 4 ) { checkExternSyncEvent(eventLSyncSharp, inL); local->deleteIncidence( inL ); ++deletedEventL; } else { if ( ! mSyncManager->mWriteBackExistingOnly ) { inL->removeID(mCurrentSyncDevice ); ++addedEventR; diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 66836a1..f301768 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h @@ -68,25 +68,25 @@ public: Incidence * undoIncidence() { return mUndoIncidence; }; bool undoDeleteIncidence(); void deleteIncidence(Incidence *in); void resetTempSyncStat(); void resetPilotStat(int id); /** Clears out the current calendar, freeing all used memory etc. */ virtual void close() = 0; virtual void addCalendar( Calendar* ) = 0; virtual bool addCalendarFile( QString name, int id ) = 0; virtual bool mergeCalendarFile( QString name ) = 0; - virtual Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ) = 0; + virtual Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates , bool enabledOnly = false ) = 0; virtual void setSyncEventsReadOnly() = 0; virtual void setSyncEventsEnabled() = 0; virtual void stopAllTodos() = 0; virtual void clearUndo( Incidence * newUndo ); /** Sync changes in memory to persistant storage. */ virtual void save() = 0; virtual QPtrList<Event> getExternLastSyncEvents() = 0; virtual void removeSyncInfo( QString syncProfile) = 0; virtual bool isSaving() { return false; } diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index b02f706..ad8ace3 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -71,57 +71,66 @@ CalendarLocal::~CalendarLocal() } bool CalendarLocal::mergeCalendarFile( QString name ) { CalendarLocal calendar( timeZoneId() ); calendar.setDefaultCalendar( 1 ); if ( calendar.load( name ) ) { mergeCalendar( &calendar ); return true; } return false; } -Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates) +Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates, bool enabledOnly ) { Todo *todo;; Incidence *retVal = 0; for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { if ( todo->uid() == uid ) { + if ( enabledOnly ) + if ( !todo->calEnabled() ) + continue; if ( doNotCheckDuplicates ) return todo; if ( retVal ) { if ( retVal->calID() > todo->calID() ) { retVal = todo; } } else { retVal = todo; } } } if ( retVal ) return retVal; Event *event; for ( event = mEventList.first(); event; event = mEventList.next() ) { if ( event->uid() == uid ) { + if ( enabledOnly ) + if ( !event->calEnabled() ) + continue; if ( doNotCheckDuplicates ) return event; if ( retVal ) { if ( retVal->calID() > event->calID() ) { retVal = event; } } else { retVal = event; } } } if ( retVal ) return retVal; for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) if ( it->uid() == uid ) { + if ( enabledOnly ) + if ( !it->calEnabled() ) + continue; if ( doNotCheckDuplicates ) return it; if ( retVal ) { if ( retVal->calID() > it->calID() ) { retVal = it; } } else { retVal = it; } } return retVal; } diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index b70f0c9..b611704 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h @@ -38,25 +38,25 @@ class CalendarLocal : public Calendar Constructs a new calendar, with variables initialized to sane values. */ CalendarLocal(); /** Constructs a new calendar, with variables initialized to sane values. */ CalendarLocal( const QString &timeZoneId ); ~CalendarLocal(); void addCalendar( Calendar* ); bool addCalendarFile( QString name, int id ); bool mergeCalendarFile( QString name ); bool mergeCalendar( Calendar* cal ); - Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates ); + Incidence* incidenceForUid( const QString& uid, bool doNotCheckDuplicates, bool enabledOnly = false ); void setSyncEventsReadOnly(); void setSyncEventsEnabled(); void stopAllTodos(); /** Loads a calendar on disk in vCalendar or iCalendar format into the current calendar. Any information already present is lost. @return true, if successfull, false on error. @param fileName the name of the calendar on disk. */ bool load( const QString &fileName ); /** Writes out the calendar to disk in the specified \a format. |