-rw-r--r-- | libkcal/calendarlocal.cpp | 6 | ||||
-rw-r--r-- | libkcal/event.cpp | 6 | ||||
-rw-r--r-- | libkcal/event.h | 2 | ||||
-rw-r--r-- | libkcal/incidence.h | 2 | ||||
-rw-r--r-- | libkcal/journal.cpp | 2 | ||||
-rw-r--r-- | libkcal/journal.h | 2 | ||||
-rw-r--r-- | libkcal/todo.cpp | 4 | ||||
-rw-r--r-- | libkcal/todo.h | 2 |
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 @@ -293,33 +293,33 @@ void CalendarLocal::checkAlarmForIncidence( Incidence * incidence, bool deleted { //mNextAlarmIncidence //mNextAlarmDateTime //return mNextSummary; //return mNextAlarmEventDateTime; bool newNextAlarm = false; bool computeNextAlarm = false; bool ok; int offset; QDateTime nextA; // QString nextSum; //QDateTime nextEvent; if ( mNextAlarmIncidence == 0 || incidence == 0 ) { computeNextAlarm = true; } else { if ( ! deleted ) { - nextA = incidence->getNextAlarmDateTime(& ok, &offset ) ; + nextA = incidence->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; if ( ok ) { if ( nextA < mNextAlarmDateTime ) { deRegisterAlarm(); mNextAlarmDateTime = nextA; mNextSummary = incidence->summary(); mNextAlarmEventDateTime = nextA.addSecs(offset ) ; mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); newNextAlarm = true; mNextAlarmIncidence = incidence; } else { if ( incidence == mNextAlarmIncidence ) { computeNextAlarm = true; } } } else { if ( mNextAlarmIncidence == incidence ) { @@ -408,46 +408,46 @@ void CalendarLocal::reInitAlarmSettings() } QDateTime CalendarLocal::nextAlarm( int daysTo ) { QDateTime nextA = QDateTime::currentDateTime().addDays( daysTo ); QDateTime start = QDateTime::currentDateTime().addSecs( 30 ); QDateTime next; Event *e; bool ok; bool found = false; int offset; mNextAlarmIncidence = 0; for( e = mEventList.first(); e; e = mEventList.next() ) { - next = e->getNextAlarmDateTime(& ok, &offset ) ; + next = e->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; if ( ok ) { if ( next < nextA ) { nextA = next; found = true; mNextSummary = e->summary(); mNextAlarmEventDateTime = next.addSecs(offset ) ; mNextAlarmIncidence = (Incidence *) e; } } } Todo *t; for( t = mTodoList.first(); t; t = mTodoList.next() ) { - next = t->getNextAlarmDateTime(& ok, &offset ) ; + next = t->getNextAlarmDateTime(& ok, &offset, QDateTime::currentDateTime() ) ; if ( ok ) { if ( next < nextA ) { nextA = next; found = true; mNextSummary = t->summary(); mNextAlarmEventDateTime = next.addSecs(offset ); mNextAlarmIncidence = (Incidence *) t; } } } if ( mNextAlarmIncidence ) { mNextAlarmEventDateTimeString = KGlobal::locale()->formatDateTime(mNextAlarmEventDateTime); mNextAlarmDateTime = nextA; } return nextA; } 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) { if (mReadOnly) return; mTransparency = transparency; updated(); } Event::Transparency Event::transparency() const { return mTransparency; } void Event::setDuration(int seconds) { setHasEndDate(false); Incidence::setDuration(seconds); } -QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const +QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const { bool yes; - QDateTime incidenceStart = getNextOccurence( QDateTime::currentDateTime(), &yes ); + QDateTime incidenceStart = getNextOccurence( start_dt, &yes ); if ( ! yes || cancelled() ) { *ok = false; return QDateTime (); } bool enabled = false; Alarm* alarm; int off = 0; QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; // if ( QDateTime::currentDateTime() > incidenceStart ){ // *ok = false; // return incidenceStart; // } for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { if (alarm->enabled()) { if ( alarm->hasTime () ) { @@ -196,26 +196,26 @@ QDateTime Event::getNextAlarmDateTime( bool * ok, int * offset ) const alarmStart = alarm->time(); enabled = true; off = alarmStart.secsTo( incidenceStart ); } } else { int secs = alarm->startOffset().asSeconds(); if ( incidenceStart.addSecs( secs ) < alarmStart ) { alarmStart = incidenceStart.addSecs( secs ); enabled = true; off = -secs; } } } } if ( enabled ) { - if ( alarmStart > QDateTime::currentDateTime() ) { + if ( alarmStart > start_dt ) { *ok = true; * offset = off; return alarmStart; } } *ok = false; return QDateTime (); } diff --git a/libkcal/event.h b/libkcal/event.h index 3bc8adc..8729956 100644 --- a/libkcal/event.h +++ b/libkcal/event.h @@ -29,33 +29,33 @@ namespace KCal { /** This class provides an Event in the sense of RFC2445. */ class Event : public Incidence { public: enum Transparency { Opaque, Transparent }; typedef ListBase<Event> List; Event(); Event(const Event &); ~Event(); QCString type() const { return "Event"; } Incidence *clone(); - QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; + QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; /** for setting an event's ending date/time with a QDateTime. */ void setDtEnd(const QDateTime &dtEnd); /** Return the event's ending date/time as a QDateTime. */ virtual QDateTime dtEnd() const; /** returns an event's end time as a string formatted according to the users locale settings */ QString dtEndTimeStr() const; /** returns an event's end date as a string formatted according to the users locale settings */ QString dtEndDateStr(bool shortfmt=true) const; /** returns an event's end date and time as a string formatted according to the users locale settings */ QString dtEndStr(bool shortfmt=true) const; void setHasEndDate(bool); /** Return whether the event has an end date/time. */ diff --git a/libkcal/incidence.h b/libkcal/incidence.h index ebd50d0..aa51e84 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -101,33 +101,33 @@ class Incidence : public IncidenceBase Incidence(); Incidence(const Incidence &); ~Incidence(); /** Accept IncidenceVisitor. A class taking part in the visitor mechanism has to provide this implementation: <pre> bool accept(Visitor &v) { return v.visit(this); } </pre> */ virtual bool accept(Visitor &) { return false; } virtual Incidence *clone() = 0; virtual void cloneRelations( Incidence * ); - virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const = 0; + virtual QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const = 0; void setReadOnly( bool ); /** Recreate event. The event is made a new unique event, but already stored event information is preserved. Sets uniquie id, creation date, last modification date and revision number. */ void recreate(); Incidence* recreateCloneException(QDate); /** set creation date */ void setCreated(QDateTime); /** return time and date of creation. */ QDateTime created() const; /** set the number of revisions this event has seen */ diff --git a/libkcal/journal.cpp b/libkcal/journal.cpp index 351fb32..859161f 100644 --- a/libkcal/journal.cpp +++ b/libkcal/journal.cpp @@ -29,21 +29,21 @@ Journal::Journal() Journal::~Journal() { } Incidence *Journal::clone() { return new Journal(*this); } bool KCal::operator==( const Journal& j1, const Journal& j2 ) { return operator==( (const Incidence&)j1, (const Incidence&)j2 ); } -QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset ) const +QDateTime Journal::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const { *ok = false; return QDateTime (); } diff --git a/libkcal/journal.h b/libkcal/journal.h index cb90c7a..2c1d7ea 100644 --- a/libkcal/journal.h +++ b/libkcal/journal.h @@ -26,25 +26,25 @@ #include "incidence.h" namespace KCal { /** This class provides a Journal in the sense of RFC2445. */ class Journal : public Incidence { public: Journal(); ~Journal(); QCString type() const { return "Journal"; } Incidence *clone(); - QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; + QDateTime getNextAlarmDateTime( bool * ok, int * offset ,QDateTime start_dt ) const; private: bool accept(Visitor &v) { return v.visit(this); } }; bool operator==( const Journal&, const Journal& ); } #endif diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index d7431c7..473247a 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp @@ -502,33 +502,33 @@ bool Todo::setRecurDates() setHasRecurrenceID( false ); recurrence()->unsetRecurs(); } return true; } void Todo::setPercentComplete(int v) { if ( mHasRecurrenceID && v == 100 && mPercentComplete != 100 ) { if ( !setRecurDates() ) v = 0; } mPercentComplete = v; if ( v != 100 ) mHasCompletedDate = false; updated(); } -QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const +QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const { if ( isCompleted() || ! hasDueDate() || cancelled() ) { *ok = false; return QDateTime (); } QDateTime incidenceStart; incidenceStart = dtDue(); bool enabled = false; Alarm* alarm; int off = 0; QDateTime alarmStart = QDateTime::currentDateTime().addDays( 3650 );; // if ( QDateTime::currentDateTime() > incidenceStart ){ // *ok = false; // return incidenceStart; // } for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { @@ -538,33 +538,33 @@ QDateTime Todo::getNextAlarmDateTime( bool * ok, int * offset ) const alarmStart = alarm->time(); enabled = true; off = alarmStart.secsTo( incidenceStart ); } } else { int secs = alarm->startOffset().asSeconds(); if ( incidenceStart.addSecs( secs ) < alarmStart ) { alarmStart = incidenceStart.addSecs( secs ); enabled = true; off = -secs; } } } } if ( enabled ) { - if ( alarmStart > QDateTime::currentDateTime() ) { + if ( alarmStart > start_dt ) { *ok = true; * offset = off; return alarmStart; } } *ok = false; return QDateTime (); } void Todo::checkSetCompletedFalse() { if ( !hasRecurrenceID() ) { qDebug("ERROR 1 in Todo::checkSetCompletedFalse"); } // qDebug("Todo::checkSetCompletedFalse()"); diff --git a/libkcal/todo.h b/libkcal/todo.h index a5354ce..ab8fdf1 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h @@ -31,33 +31,33 @@ namespace KCal { /** This class provides a Todo in the sense of RFC2445. */ class Todo : public QObject,public Incidence { Q_OBJECT public: Todo(); Todo(const Todo &); ~Todo(); typedef ListBase<Todo> List; QCString type() const { return "Todo"; } /** Return an exact copy of this todo. */ Incidence *clone(); - QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; + QDateTime getNextAlarmDateTime( bool * ok, int * offset, QDateTime start_dt ) const; /** for setting the todo's due date/time with a QDateTime. */ void setDtDue(const QDateTime &dtDue); /** returns an event's Due date/time as a QDateTime. */ QDateTime dtDue() const; /** returns an event's due time as a string formatted according to the users locale settings */ QString dtDueTimeStr() const; /** returns an event's due date as a string formatted according to the users locale settings */ QString dtDueDateStr(bool shortfmt=true) const; /** returns an event's due date and time as a string formatted according to the users locale settings */ QString dtDueStr(bool shortfmt=true) const; /** returns TRUE or FALSE depending on whether the todo has a due date */ |