-rw-r--r-- | libkcal/event.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libkcal/event.cpp b/libkcal/event.cpp index 5285559..ad66639 100644 --- a/libkcal/event.cpp +++ b/libkcal/event.cpp | |||
@@ -150,48 +150,68 @@ bool Event::hasEndDate() const | |||
150 | 150 | ||
151 | bool Event::isMultiDay() const | 151 | bool Event::isMultiDay() const |
152 | { | 152 | { |
153 | bool multi = !(dtStart().date() == dtEnd().date()); | 153 | bool multi = !(dtStart().date() == dtEnd().date()); |
154 | return multi; | 154 | return multi; |
155 | } | 155 | } |
156 | 156 | ||
157 | void Event::setTransparency(Event::Transparency transparency) | 157 | void Event::setTransparency(Event::Transparency transparency) |
158 | { | 158 | { |
159 | if (mReadOnly) return; | 159 | if (mReadOnly) return; |
160 | mTransparency = transparency; | 160 | mTransparency = transparency; |
161 | updated(); | 161 | updated(); |
162 | } | 162 | } |
163 | 163 | ||
164 | Event::Transparency Event::transparency() const | 164 | Event::Transparency Event::transparency() const |
165 | { | 165 | { |
166 | return mTransparency; | 166 | return mTransparency; |
167 | } | 167 | } |
168 | 168 | ||
169 | void Event::setDuration(int seconds) | 169 | void Event::setDuration(int seconds) |
170 | { | 170 | { |
171 | setHasEndDate(false); | 171 | setHasEndDate(false); |
172 | Incidence::setDuration(seconds); | 172 | Incidence::setDuration(seconds); |
173 | } | 173 | } |
174 | bool Event::matchTime(QDateTime*startDT, QDateTime* endDT) | ||
175 | { | ||
176 | if ( ! doesRecur() ) { | ||
177 | if ( doesFloat() ) { | ||
178 | if ( mDtEnd.addDays( 1 ) < *startDT) | ||
179 | return false; | ||
180 | if ( endDT && mDtStart > * endDT) | ||
181 | return false; | ||
182 | } else { | ||
183 | if ( mDtEnd < *startDT ) | ||
184 | return false; | ||
185 | if ( endDT && mDtStart > * endDT) | ||
186 | return false; | ||
187 | } | ||
188 | } else { | ||
189 | if ( endDT && mDtStart > * endDT) | ||
190 | return false; | ||
191 | } | ||
192 | return true; | ||
193 | } | ||
174 | bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, QDateTime* startDT ) | 194 | bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, QDateTime* startDT ) |
175 | { | 195 | { |
176 | if ( testEvent == this ) | 196 | if ( testEvent == this ) |
177 | return false; | 197 | return false; |
178 | if ( ! doesRecur() && !testEvent->doesRecur() ) { | 198 | if ( ! doesRecur() && !testEvent->doesRecur() ) { |
179 | QDateTime te; | 199 | QDateTime te; |
180 | if ( testEvent->doesFloat() ) | 200 | if ( testEvent->doesFloat() ) |
181 | te = testEvent->mDtEnd.addDays( 1 ); | 201 | te = testEvent->mDtEnd.addDays( 1 ); |
182 | else | 202 | else |
183 | te = testEvent->mDtEnd; | 203 | te = testEvent->mDtEnd; |
184 | QDateTime e; | 204 | QDateTime e; |
185 | if ( doesFloat() ) | 205 | if ( doesFloat() ) |
186 | e = mDtEnd.addDays( 1 ); | 206 | e = mDtEnd.addDays( 1 ); |
187 | else | 207 | else |
188 | e = mDtEnd; | 208 | e = mDtEnd; |
189 | if ( mDtStart < te && testEvent->mDtStart < e ) { | 209 | if ( mDtStart < te && testEvent->mDtStart < e ) { |
190 | if ( mDtStart < testEvent->mDtStart ) | 210 | if ( mDtStart < testEvent->mDtStart ) |
191 | *overlapDT = testEvent->mDtStart; | 211 | *overlapDT = testEvent->mDtStart; |
192 | else | 212 | else |
193 | *overlapDT = mDtStart; | 213 | *overlapDT = mDtStart; |
194 | if ( startDT ) | 214 | if ( startDT ) |
195 | return (*overlapDT >= *startDT ); | 215 | return (*overlapDT >= *startDT ); |
196 | return true; | 216 | return true; |
197 | } | 217 | } |