summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-06-03 23:10:45 (UTC)
committer zautrix <zautrix>2005-06-03 23:10:45 (UTC)
commit858b047efb5627824438cb3877e7bec0cebb3751 (patch) (side-by-side diff)
tree7b36963344d4f5019f3a1ecb5eb9290f27c3b3c7 /libkcal
parent0207d193bdb6c66201562a17e68872e018ec223c (diff)
downloadkdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.zip
kdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.tar.gz
kdepimpi-858b047efb5627824438cb3877e7bec0cebb3751.tar.bz2
fixxx
Diffstat (limited to 'libkcal') (more/less context) (ignore 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
@@ -285,49 +285,49 @@ QString CalendarLocal::nextSummary() const
{
return mNextSummary;
}
QDateTime CalendarLocal::nextAlarmEventDateTime() const
{
return mNextAlarmEventDateTime;
}
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 ) {
computeNextAlarm = true;
}
}
} else { // deleted
if ( incidence == mNextAlarmIncidence ) {
computeNextAlarm = true;
}
}
@@ -400,62 +400,62 @@ QPtrList<Todo> CalendarLocal::todos( const QDate &date )
void CalendarLocal::reInitAlarmSettings()
{
if ( !mNextAlarmIncidence ) {
nextAlarm( 1000 );
}
deRegisterAlarm();
mNextAlarmIncidence = 0;
checkAlarmForIncidence( 0, false );
}
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;
}
Alarm::List CalendarLocal::alarmsTo( const QDateTime &to )
{
return alarms( QDateTime( QDate( 1900, 1, 1 ) ), to );
}
Alarm::List CalendarLocal::alarms( const QDateTime &from, const QDateTime &to )
{
kdDebug(5800) << "CalendarLocal::alarms(" << from.toString() << " - "
diff --git a/libkcal/event.cpp b/libkcal/event.cpp
index de8dceb..9b99855 100644
--- a/libkcal/event.cpp
+++ b/libkcal/event.cpp
@@ -150,72 +150,72 @@ bool Event::hasEndDate() const
bool Event::isMultiDay() const
{
bool multi = !(dtStart().date() == dtEnd().date());
return multi;
}
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 () ) {
if ( alarm->time() < alarmStart ) {
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
@@ -21,49 +21,49 @@
#ifndef EVENT_H
#define EVENT_H
//
// Event component, representing a VEVENT object
//
#include "incidence.h"
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. */
bool hasEndDate() const;
/** Return true if the event spans multiple days, otherwise return false. */
bool isMultiDay() const;
/** set the event's time transparency level. */
void setTransparency(Transparency transparency);
/** get the event's time transparency level. */
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index ebd50d0..aa51e84 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -93,49 +93,49 @@ class Incidence : public IncidenceBase
private:
T *mResource;
};
/** enumeration for describing an event's secrecy. */
enum { SecrecyPublic = 0, SecrecyPrivate = 1, SecrecyConfidential = 2 };
typedef ListBase<Incidence> List;
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 */
void setRevision(int rev);
/** return the number of revisions this event has seen */
int revision() const;
/** Set starting date/time. */
virtual void setDtStart(const QDateTime &dtStart);
/** Return the incidence's ending date/time as a QDateTime. */
virtual QDateTime dtEnd() const { return QDateTime(); }
diff --git a/libkcal/journal.cpp b/libkcal/journal.cpp
index 351fb32..859161f 100644
--- a/libkcal/journal.cpp
+++ b/libkcal/journal.cpp
@@ -21,29 +21,29 @@
#include "journal.h"
using namespace KCal;
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
@@ -18,33 +18,33 @@
Boston, MA 02111-1307, USA.
*/
#ifndef JOURNAL_H
#define JOURNAL_H
//
// Journal component, representing a VJOURNAL object
//
#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
@@ -494,84 +494,84 @@ bool Todo::setRecurDates()
QDateTime next = getNextOccurence( mRecurrenceID, &ok );
if ( ok ) {
mRecurrenceID = next;
mDtStart = next;
setDtDue( next.addSecs( secs ) );
if ( QDateTime::currentDateTime() > next)
return false;
} else {
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) {
if (alarm->enabled()) {
if ( alarm->hasTime () ) {
if ( alarm->time() < alarmStart ) {
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()");
//qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
if ( mPercentComplete == 100 && mDtStart == mRecurrenceID && QDateTime::currentDateTime() > mDtStart) {
qDebug("%s %s %s ",mDtStart.toString().latin1(), dtDue().toString().latin1(),mRecurrenceID.toString().latin1() );
setCompleted( false );
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
@@ -23,49 +23,49 @@
// Todo component, representing a VTODO object
//
#include "incidence.h"
#include <qtimer.h>
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 */
bool hasDueDate() const;
/** sets the event's hasDueDate value. */
void setHasDueDate(bool f);
/*
Looks for a subtodo (including itself ) which is not complete and is
- overdue, or
- due today.