-rw-r--r-- | libkcal/calendarlocal.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 336c3e8..8c4dde1 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -49,64 +49,74 @@ CalendarLocal::CalendarLocal() | |||
49 | : Calendar() | 49 | : Calendar() |
50 | { | 50 | { |
51 | init(); | 51 | init(); |
52 | } | 52 | } |
53 | 53 | ||
54 | CalendarLocal::CalendarLocal(const QString &timeZoneId) | 54 | CalendarLocal::CalendarLocal(const QString &timeZoneId) |
55 | : Calendar(timeZoneId) | 55 | : Calendar(timeZoneId) |
56 | { | 56 | { |
57 | init(); | 57 | init(); |
58 | } | 58 | } |
59 | 59 | ||
60 | void CalendarLocal::init() | 60 | void CalendarLocal::init() |
61 | { | 61 | { |
62 | mNextAlarmIncidence = 0; | 62 | mNextAlarmIncidence = 0; |
63 | } | 63 | } |
64 | 64 | ||
65 | 65 | ||
66 | CalendarLocal::~CalendarLocal() | 66 | CalendarLocal::~CalendarLocal() |
67 | { | 67 | { |
68 | if ( mDeleteIncidencesOnClose ) | 68 | if ( mDeleteIncidencesOnClose ) |
69 | close(); | 69 | close(); |
70 | } | 70 | } |
71 | bool CalendarLocal::addCalendarFile( QString name, int id ) | 71 | bool CalendarLocal::addCalendarFile( QString name, int id ) |
72 | { | 72 | { |
73 | CalendarLocal calendar( timeZoneId() ); | 73 | CalendarLocal calendar( timeZoneId() ); |
74 | calendar.setDefaultCalendar( id ); | 74 | calendar.setDefaultCalendar( id ); |
75 | if ( calendar.load( name ) ) { | 75 | if ( calendar.load( name ) ) { |
76 | addCalendar( &calendar ); | 76 | addCalendar( &calendar ); |
77 | return true; | 77 | return true; |
78 | } | 78 | } |
79 | return false; | 79 | return false; |
80 | } | 80 | } |
81 | void CalendarLocal::setSyncEventsReadOnly() | ||
82 | { | ||
83 | Event * ev; | ||
84 | ev = mEventList.first(); | ||
85 | while ( ev ) { | ||
86 | if ( ev->uid().left(15) == QString("last-syncEvent-") ) | ||
87 | ev->setReadOnly( true ); | ||
88 | ev = mEventList.next(); | ||
89 | } | ||
90 | } | ||
81 | void CalendarLocal::addCalendar( Calendar* cal ) | 91 | void CalendarLocal::addCalendar( Calendar* cal ) |
82 | { | 92 | { |
83 | cal->setDontDeleteIncidencesOnClose(); | 93 | cal->setDontDeleteIncidencesOnClose(); |
84 | { | 94 | { |
85 | QPtrList<Event> EventList = cal->rawEvents(); | 95 | QPtrList<Event> EventList = cal->rawEvents(); |
86 | Event * ev = EventList.first(); | 96 | Event * ev = EventList.first(); |
87 | while ( ev ) { | 97 | while ( ev ) { |
88 | ev->unRegisterObserver( cal ); | 98 | ev->unRegisterObserver( cal ); |
89 | ev->registerObserver( this ); | 99 | ev->registerObserver( this ); |
90 | mEventList.append( ev ); | 100 | mEventList.append( ev ); |
91 | ev = EventList.next(); | 101 | ev = EventList.next(); |
92 | } | 102 | } |
93 | } | 103 | } |
94 | { | 104 | { |
95 | 105 | ||
96 | QPtrList<Todo> TodoList = cal->rawTodos(); | 106 | QPtrList<Todo> TodoList = cal->rawTodos(); |
97 | Todo * ev = TodoList.first(); | 107 | Todo * ev = TodoList.first(); |
98 | while ( ev ) { | 108 | while ( ev ) { |
99 | QString rel = ev->relatedToUid(); | 109 | QString rel = ev->relatedToUid(); |
100 | if ( !rel.isEmpty() ){ | 110 | if ( !rel.isEmpty() ){ |
101 | ev->setRelatedTo ( 0 ); | 111 | ev->setRelatedTo ( 0 ); |
102 | ev->setRelatedToUid( rel ); | 112 | ev->setRelatedToUid( rel ); |
103 | } | 113 | } |
104 | ev = TodoList.next(); | 114 | ev = TodoList.next(); |
105 | } | 115 | } |
106 | //TodoList = cal->rawTodos(); | 116 | //TodoList = cal->rawTodos(); |
107 | ev = TodoList.first(); | 117 | ev = TodoList.first(); |
108 | while ( ev ) { | 118 | while ( ev ) { |
109 | ev->unRegisterObserver( cal ); | 119 | ev->unRegisterObserver( cal ); |
110 | ev->registerObserver( this ); | 120 | ev->registerObserver( this ); |
111 | mTodoList.append( ev ); | 121 | mTodoList.append( ev ); |
112 | setupRelations( ev ); | 122 | setupRelations( ev ); |