-rw-r--r-- | libkcal/event.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libkcal/event.cpp b/libkcal/event.cpp index de8dceb..9b99855 100644 --- a/libkcal/event.cpp +++ b/libkcal/event.cpp | |||
@@ -158,37 +158,37 @@ 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 | QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const | 174 | QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const |
175 | { | 175 | { |
176 | 176 | ||
177 | bool yes; | 177 | bool yes; |
178 | QDateTime incidenceStart = getNextOccurence( QDateTime::currentDateTime(), &yes ); | 178 | QDateTime incidenceStart = getNextOccurence( start_dt, &yes ); |
179 | if ( ! yes || cancelled() ) { | 179 | if ( ! yes || cancelled() ) { |
180 | *ok = false; | 180 | *ok = false; |
181 | return QDateTime (); | 181 | return QDateTime (); |
182 | } | 182 | } |
183 | 183 | ||
184 | bool enabled = false; | 184 | bool enabled = false; |
185 | Alarm* alarm; | 185 | Alarm* alarm; |
186 | int off = 0; | 186 | int off = 0; |
187 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; | 187 | QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; |
188 | // if ( QDateTime::currentDateTime() > incidenceStart ){ | 188 | // if ( QDateTime::currentDateTime() > incidenceStart ){ |
189 | // *ok = false; | 189 | // *ok = false; |
190 | // return incidenceStart; | 190 | // return incidenceStart; |
191 | // } | 191 | // } |
192 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { | 192 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { |
193 | if (alarm->enabled()) { | 193 | if (alarm->enabled()) { |
194 | if ( alarm->hasTime () ) { | 194 | if ( alarm->hasTime () ) { |
@@ -196,26 +196,26 @@ QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const | |||
196 | alarmStart = alarm->time(); | 196 | alarmStart = alarm->time(); |
197 | enabled = true; | 197 | enabled = true; |
198 | off = alarmStart.secsTo( incidenceStart ); | 198 | off = alarmStart.secsTo( incidenceStart ); |
199 | } | 199 | } |
200 | 200 | ||
201 | } else { | 201 | } else { |
202 | int secs = alarm->startOffset().asSeconds(); | 202 | int secs = alarm->startOffset().asSeconds(); |
203 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { | 203 | if ( incidenceStart.addSecs( secs ) < alarmStart ) { |
204 | alarmStart = incidenceStart.addSecs( secs ); | 204 | alarmStart = incidenceStart.addSecs( secs ); |
205 | enabled = true; | 205 | enabled = true; |
206 | off = -secs; | 206 | off = -secs; |
207 | } | 207 | } |
208 | } | 208 | } |
209 | } | 209 | } |
210 | } | 210 | } |
211 | if ( enabled ) { | 211 | if ( enabled ) { |
212 | if ( alarmStart > QDateTime::currentDateTime() ) { | 212 | if ( alarmStart > start_dt ) { |
213 | *ok = true; | 213 | *ok = true; |
214 | * offset = off; | 214 | * offset = off; |
215 | return alarmStart; | 215 | return alarmStart; |
216 | } | 216 | } |
217 | } | 217 | } |
218 | *ok = false; | 218 | *ok = false; |
219 | return QDateTime (); | 219 | return QDateTime (); |
220 | 220 | ||
221 | } | 221 | } |