author | zautrix <zautrix> | 2005-11-25 20:49:16 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-25 20:49:16 (UTC) |
commit | 2468bddcb380d8621d5bb49b69b3492d90562d93 (patch) (side-by-side diff) | |
tree | c310f4fff5e476087e8406614e57a7f258f1b14f /libkcal | |
parent | 7a439999b9fa2bd7ad76e195cdf95bf5211952cb (diff) | |
download | kdepimpi-2468bddcb380d8621d5bb49b69b3492d90562d93.zip kdepimpi-2468bddcb380d8621d5bb49b69b3492d90562d93.tar.gz kdepimpi-2468bddcb380d8621d5bb49b69b3492d90562d93.tar.bz2 |
sync
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 25 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 1 |
3 files changed, 26 insertions, 1 deletions
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 0a94914..66836a1 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h @@ -316,6 +316,7 @@ public: public slots: void setDefaultCalendar( int ); virtual void setCalendarEnabled( int id, bool enable ) = 0; + virtual void setAllCalendarEnabled( bool enable ) = 0; virtual void setAlarmEnabled( int id, bool enable ) = 0; virtual void setReadOnly( int id, bool enable ) = 0; virtual void setDefaultCalendarEnabledOnly() = 0; diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 45e3128..2a57724 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -190,23 +190,33 @@ void CalendarLocal::setSyncEventsReadOnly() while ( ev ) { if ( ev->uid().left(15) == QString("last-syncEvent-") ) { ev->setReadOnly( true ); - ev->setCalID( 1 ); } ev = mEventList.next(); } } + void CalendarLocal::addCalendar( Calendar* cal ) { cal->setDontDeleteIncidencesOnClose(); + setSyncEventsEnabled(); { QPtrList<Event> EventList = cal->rawEvents(); + QPtrList<Event> el; Event * ev = EventList.first(); while ( ev ) { + if ( ev->uid().left( 15 ) == QString("last-syncEvent-") ) { + Event * se = event( ev->uid() ); + if ( se ) + el.append( se ); + } ev->unRegisterObserver( cal ); ev->registerObserver( this ); mEventList.append( ev ); ev = EventList.next(); } + for ( ev = el.first(); ev; ev = el.next() ) { + deleteIncidence ( ev ); + } } { @@ -1003,6 +1013,19 @@ void CalendarLocal::setCalendarRemove( int id ) } +void CalendarLocal::setAllCalendarEnabled( bool enable ) +{ + for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) + it->setCalEnabled( enable ); + + for ( Event *it = mEventList.first(); it; it = mEventList.next() ) + it->setCalEnabled( enable ); + + for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) + it->setCalEnabled( enable ); + + +} void CalendarLocal::setCalendarEnabled( int id, bool enable ) { for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index eb7bf34..b70f0c9 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h @@ -194,6 +194,7 @@ public slots: void setReadOnly( int id, bool enable ); void setDefaultCalendarEnabledOnly(); void setCalendarRemove( int id ); + void setAllCalendarEnabled( bool enable ); protected: |