summaryrefslogtreecommitdiffabout
path: root/libkcal
Unidiff
Diffstat (limited to 'libkcal') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/calendarlocal.cpp6
-rw-r--r--libkcal/event.cpp6
-rw-r--r--libkcal/event.h2
-rw-r--r--libkcal/incidence.h2
-rw-r--r--libkcal/journal.cpp2
-rw-r--r--libkcal/journal.h2
-rw-r--r--libkcal/todo.cpp4
-rw-r--r--libkcal/todo.h2
8 files changed, 13 insertions, 13 deletions
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp
index e75df70..bc76c0b 100644
--- a/libkcal/calendarlocal.cpp
+++ b/libkcal/calendarlocal.cpp
@@ -301,17 +301,17 @@ void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted
301 int offset; 301 int offset;
302 QDateTime nextA; 302 QDateTime nextA;
303 // QString nextSum; 303 // QString nextSum;
304 //QDateTime nextEvent; 304 //QDateTime nextEvent;
305 if ( mNextAlarmIncidence == 0 || incidence == 0 ) { 305 if ( mNextAlarmIncidence == 0 || incidence == 0 ) {
306 computeNextAlarm = true; 306 computeNextAlarm = true;
307 } else { 307 } else {
308 if ( ! deleted ) { 308 if ( ! deleted ) {
309 nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ; 309 nextA = incidence->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
310 if ( ok ) { 310 if ( ok ) {
311 if ( nextA < mNextAlarmDateTime ) { 311 if ( nextA < mNextAlarmDateTime ) {
312 deRegisterAlarm(); 312 deRegisterAlarm();
313 mNextAlarmDateTime = nextA; 313 mNextAlarmDateTime = nextA;
314 mNextSummary = incidence->summary(); 314 mNextSummary = incidence->summary();
315 mNextAlarmEventDateTime = nextA.addSecs(offset ) ; 315 mNextAlarmEventDateTime = nextA.addSecs(offset ) ;
316 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); 316 mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime);
317 newNextAlarm = true; 317 newNextAlarm = true;
@@ -416,30 +416,30 @@ QDateTime CalendarLocal::nextAlarm( int daysTo )
416 QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); 416 QDateTime start = QDateTime::currentDateTime().addSecs( 30 );
417 QDateTime next; 417 QDateTime next;
418 Event *e; 418 Event *e;
419 bool ok; 419 bool ok;
420 bool found = false; 420 bool found = false;
421 int offset; 421 int offset;
422 mNextAlarmIncidence = 0; 422 mNextAlarmIncidence = 0;
423 for( e = mEventList.first(); e; e = mEventList.next() ) { 423 for( e = mEventList.first(); e; e = mEventList.next() ) {
424 next = e->getNextAlarmDateTime(& ok, &offset ) ; 424 next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
425 if ( ok ) { 425 if ( ok ) {
426 if ( next < nextA ) { 426 if ( next < nextA ) {
427 nextA = next; 427 nextA = next;
428 found = true; 428 found = true;
429 mNextSummary = e->summary(); 429 mNextSummary = e->summary();
430 mNextAlarmEventDateTime = next.addSecs(offset ) ; 430 mNextAlarmEventDateTime = next.addSecs(offset ) ;
431 mNextAlarmIncidence = (Incidence *) e; 431 mNextAlarmIncidence = (Incidence *) e;
432 } 432 }
433 } 433 }
434 } 434 }
435 Todo *t; 435 Todo *t;
436 for( t = mTodoList.first(); t; t = mTodoList.next() ) { 436 for( t = mTodoList.first(); t; t = mTodoList.next() ) {
437 next = t->getNextAlarmDateTime(& ok, &offset ) ; 437 next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ;
438 if ( ok ) { 438 if ( ok ) {
439 if ( next < nextA ) { 439 if ( next < nextA ) {
440 nextA = next; 440 nextA = next;
441 found = true; 441 found = true;
442 mNextSummary = t->summary(); 442 mNextSummary = t->summary();
443 mNextAlarmEventDateTime = next.addSecs(offset ); 443 mNextAlarmEventDateTime = next.addSecs(offset );
444 mNextAlarmIncidence = (Incidence *) t; 444 mNextAlarmIncidence = (Incidence *) t;
445 } 445 }
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index de8dceb..9b99855 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -166,21 +166,21 @@ Event::Transparency Event::transparency() const
166 return mTransparency; 166 return mTransparency;
167} 167}
168 168
169void Event::setDuration(int seconds) 169void Event::setDuration(int seconds)
170{ 170{
171 setHasEndDate(false); 171 setHasEndDate(false);
172 Incidence::setDuration(seconds); 172 Incidence::setDuration(seconds);
173} 173}
174QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const 174QDateTime 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;
@@ -204,17 +204,17 @@ QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const
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
diff --git a/libkcal/event.h b/libkcal/event.h
index 3bc8adc..8729956 100644
--- a/libkcal/event.h
+++ b/libkcal/event.h
@@ -37,17 +37,17 @@ class Event : public Incidence
37 typedef ListBase<Event> List; 37 typedef ListBase<Event> List;
38 Event(); 38 Event();
39 Event(const Event &); 39 Event(const Event &);
40 ~Event(); 40 ~Event();
41 41
42 QCString type() const { return "Event"; } 42 QCString type() const { return "Event"; }
43 43
44 Incidence *clone(); 44 Incidence *clone();
45 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; 45 QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
46 46
47 /** for setting an event's ending date/time with a QDateTime. */ 47 /** for setting an event's ending date/time with a QDateTime. */
48 void setDtEnd(const QDateTime &dtEnd); 48 void setDtEnd(const QDateTime &dtEnd);
49 /** Return the event's ending date/time as a QDateTime. */ 49 /** Return the event's ending date/time as a QDateTime. */
50 virtual QDateTime dtEnd() const; 50 virtual QDateTime dtEnd() const;
51 /** returns an event's end time as a string formatted according to the 51 /** returns an event's end time as a string formatted according to the
52 users locale settings */ 52 users locale settings */
53 QString dtEndTimeStr() const; 53 QString dtEndTimeStr() const;
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index ebd50d0..aa51e84 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -109,17 +109,17 @@ class Incidence : public IncidenceBase
109 bool accept(Visitor &v) { return v.visit(this); } 109 bool accept(Visitor &v) { return v.visit(this); }
110 </pre> 110 </pre>
111 */ 111 */
112 virtual bool accept(Visitor &) { return false; } 112 virtual bool accept(Visitor &) { return false; }
113 113
114 virtual Incidence *clone() = 0; 114 virtual Incidence *clone() = 0;
115 virtual void cloneRelations( Incidence * ); 115 virtual void cloneRelations( Incidence * );
116 116
117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0; 117 virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0;
118 void setReadOnly( bool ); 118 void setReadOnly( bool );
119 119
120 /** 120 /**
121 Recreate event. The event is made a new unique event, but already stored 121 Recreate event. The event is made a new unique event, but already stored
122 event information is preserved. Sets uniquie id, creation date, last 122 event information is preserved. Sets uniquie id, creation date, last
123 modification date and revision number. 123 modification date and revision number.
124 */ 124 */
125 void recreate(); 125 void recreate();
diff --git a/libkcal/journal.cpp b/libkcal/journal.cpp
index 351fb32..859161f 100644
--- a/libkcal/journal.cpp
+++ b/libkcal/journal.cpp
@@ -37,13 +37,13 @@ Incidence *Journal::clone()
37 37
38 38
39bool KCal::operator==( const Journal& j1, const Journal& j2 ) 39bool KCal::operator==( const Journal& j1, const Journal& j2 )
40{ 40{
41 return operator==( (const Incidence&)j1, (const Incidence&)j2 ); 41 return operator==( (const Incidence&)j1, (const Incidence&)j2 );
42} 42}
43 43
44 44
45QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset ) const 45QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
46{ 46{
47 *ok = false; 47 *ok = false;
48 return QDateTime (); 48 return QDateTime ();
49} 49}
diff --git a/libkcal/journal.h b/libkcal/journal.h
index cb90c7a..2c1d7ea 100644
--- a/libkcal/journal.h
+++ b/libkcal/journal.h
@@ -34,17 +34,17 @@ class Journal : public Incidence
34{ 34{
35 public: 35 public:
36 Journal(); 36 Journal();
37 ~Journal(); 37 ~Journal();
38 38
39 QCString type() const { return "Journal"; } 39 QCString type() const { return "Journal"; }
40 40
41 Incidence *clone(); 41 Incidence *clone();
42 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; 42 QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const;
43private: 43private:
44 bool accept(Visitor &v) { return v.visit(this); } 44 bool accept(Visitor &v) { return v.visit(this); }
45}; 45};
46 46
47 bool operator==( const Journal&, const Journal& ); 47 bool operator==( const Journal&, const Journal& );
48} 48}
49 49
50#endif 50#endif
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index d7431c7..473247a 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -510,17 +510,17 @@ void Todo::setPercentComplete(int v)
510 if ( !setRecurDates() ) 510 if ( !setRecurDates() )
511 v = 0; 511 v = 0;
512 } 512 }
513 mPercentComplete = v; 513 mPercentComplete = v;
514 if ( v != 100 ) 514 if ( v != 100 )
515 mHasCompletedDate = false; 515 mHasCompletedDate = false;
516 updated(); 516 updated();
517} 517}
518QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const 518QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const
519{ 519{
520 if ( isCompleted() || ! hasDueDate() || cancelled() ) { 520 if ( isCompleted() || ! hasDueDate() || cancelled() ) {
521 *ok = false; 521 *ok = false;
522 return QDateTime (); 522 return QDateTime ();
523 } 523 }
524 QDateTime incidenceStart; 524 QDateTime incidenceStart;
525 incidenceStart = dtDue(); 525 incidenceStart = dtDue();
526 bool enabled = false; 526 bool enabled = false;
@@ -546,17 +546,17 @@ QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const
546 alarmStart = incidenceStart.addSecs( secs ); 546 alarmStart = incidenceStart.addSecs( secs );
547 enabled = true; 547 enabled = true;
548 off = -secs; 548 off = -secs;
549 } 549 }
550 } 550 }
551 } 551 }
552 } 552 }
553 if ( enabled ) { 553 if ( enabled ) {
554 if ( alarmStart > QDateTime::currentDateTime() ) { 554 if ( alarmStart > start_dt ) {
555 *ok = true; 555 *ok = true;
556 * offset = off; 556 * offset = off;
557 return alarmStart; 557 return alarmStart;
558 } 558 }
559 } 559 }
560 *ok = false; 560 *ok = false;
561 return QDateTime (); 561 return QDateTime ();
562 562
diff --git a/libkcal/todo.h b/libkcal/todo.h
index a5354ce..ab8fdf1 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -39,17 +39,17 @@ namespace KCal {
39 Todo(); 39 Todo();
40 Todo(const Todo &); 40 Todo(const Todo &);
41 ~Todo(); 41 ~Todo();
42 typedef ListBase<Todo> List; 42 typedef ListBase<Todo> List;
43 QCString type() const { return "Todo"; } 43 QCString type() const { return "Todo"; }
44 44
45 /** Return an exact copy of this todo. */ 45 /** Return an exact copy of this todo. */
46 Incidence *clone(); 46 Incidence *clone();
47 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; 47 QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const;
48 48
49 /** for setting the todo's due date/time with a QDateTime. */ 49 /** for setting the todo's due date/time with a QDateTime. */
50 void setDtDue(const QDateTime &dtDue); 50 void setDtDue(const QDateTime &dtDue);
51 /** returns an event's Due date/time as a QDateTime. */ 51 /** returns an event's Due date/time as a QDateTime. */
52 QDateTime dtDue() const; 52 QDateTime dtDue() const;
53 /** returns an event's due time as a string formatted according to the 53 /** returns an event's due time as a string formatted according to the
54 users locale settings */ 54 users locale settings */
55 QString dtDueTimeStr() const; 55 QString dtDueTimeStr() const;