-rw-r--r-- | libkcal/calendarlocal.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
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() | |||
71 | } | 71 | } |
72 | bool CalendarLocal::mergeCalendarFile( QString name ) | 72 | bool CalendarLocal::mergeCalendarFile( QString name ) |
73 | { | 73 | { |
74 | CalendarLocal calendar( timeZoneId() ); | 74 | CalendarLocal calendar( timeZoneId() ); |
75 | calendar.setDefaultCalendar( 1 ); | 75 | calendar.setDefaultCalendar( 1 ); |
76 | if ( calendar.load( name ) ) { | 76 | if ( calendar.load( name ) ) { |
77 | mergeCalendar( &calendar ); | 77 | mergeCalendar( &calendar ); |
78 | return true; | 78 | return true; |
79 | } | 79 | } |
80 | return false; | 80 | return false; |
81 | } | 81 | } |
82 | 82 | ||
83 | Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates) | 83 | Incidence* CalendarLocal::incidenceForUid( const QString& uid , bool doNotCheckDuplicates, bool enabledOnly ) |
84 | { | 84 | { |
85 | Todo *todo;; | 85 | Todo *todo;; |
86 | Incidence *retVal = 0; | 86 | Incidence *retVal = 0; |
87 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { | 87 | for ( todo = mTodoList.first(); todo; todo = mTodoList.next() ) { |
88 | if ( todo->uid() == uid ) { | 88 | if ( todo->uid() == uid ) { |
89 | if ( enabledOnly ) | ||
90 | if ( !todo->calEnabled() ) | ||
91 | continue; | ||
89 | if ( doNotCheckDuplicates ) return todo; | 92 | if ( doNotCheckDuplicates ) return todo; |
90 | if ( retVal ) { | 93 | if ( retVal ) { |
91 | if ( retVal->calID() > todo->calID() ) { | 94 | if ( retVal->calID() > todo->calID() ) { |
92 | retVal = todo; | 95 | retVal = todo; |
93 | } | 96 | } |
94 | } else { | 97 | } else { |
95 | retVal = todo; | 98 | retVal = todo; |
96 | } | 99 | } |
97 | } | 100 | } |
98 | } | 101 | } |
99 | if ( retVal ) return retVal; | 102 | if ( retVal ) return retVal; |
100 | Event *event; | 103 | Event *event; |
101 | for ( event = mEventList.first(); event; event = mEventList.next() ) { | 104 | for ( event = mEventList.first(); event; event = mEventList.next() ) { |
102 | if ( event->uid() == uid ) { | 105 | if ( event->uid() == uid ) { |
106 | if ( enabledOnly ) | ||
107 | if ( !event->calEnabled() ) | ||
108 | continue; | ||
103 | if ( doNotCheckDuplicates ) return event; | 109 | if ( doNotCheckDuplicates ) return event; |
104 | if ( retVal ) { | 110 | if ( retVal ) { |
105 | if ( retVal->calID() > event->calID() ) { | 111 | if ( retVal->calID() > event->calID() ) { |
106 | retVal = event; | 112 | retVal = event; |
107 | } | 113 | } |
108 | } else { | 114 | } else { |
109 | retVal = event; | 115 | retVal = event; |
110 | } | 116 | } |
111 | } | 117 | } |
112 | } | 118 | } |
113 | if ( retVal ) return retVal; | 119 | if ( retVal ) return retVal; |
114 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) | 120 | for ( Journal *it = mJournalList.first(); it; it = mJournalList.next() ) |
115 | if ( it->uid() == uid ) { | 121 | if ( it->uid() == uid ) { |
122 | if ( enabledOnly ) | ||
123 | if ( !it->calEnabled() ) | ||
124 | continue; | ||
116 | if ( doNotCheckDuplicates ) return it; | 125 | if ( doNotCheckDuplicates ) return it; |
117 | if ( retVal ) { | 126 | if ( retVal ) { |
118 | if ( retVal->calID() > it->calID() ) { | 127 | if ( retVal->calID() > it->calID() ) { |
119 | retVal = it; | 128 | retVal = it; |
120 | } | 129 | } |
121 | } else { | 130 | } else { |
122 | retVal = it; | 131 | retVal = it; |
123 | } | 132 | } |
124 | } | 133 | } |
125 | return retVal; | 134 | return retVal; |
126 | } | 135 | } |
127 | 136 | ||