summaryrefslogtreecommitdiffabout
path: root/libkcal/incidence.cpp
authorzautrix <zautrix>2004-09-20 15:25:04 (UTC)
committer zautrix <zautrix>2004-09-20 15:25:04 (UTC)
commit6b6a28919908134ccbb3badcb24c2dcae0d426a5 (patch) (side-by-side diff)
tree72b3f69fa1f40bd4cfbd945d9f41699229604ae6 /libkcal/incidence.cpp
parentf222bd1339ac8323e3c99af84a6f83c21cacb8f8 (diff)
downloadkdepimpi-6b6a28919908134ccbb3badcb24c2dcae0d426a5.zip
kdepimpi-6b6a28919908134ccbb3badcb24c2dcae0d426a5.tar.gz
kdepimpi-6b6a28919908134ccbb3badcb24c2dcae0d426a5.tar.bz2
Several bugfixes
Diffstat (limited to 'libkcal/incidence.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/incidence.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp
index 56c9801..55ac6d4 100644
--- a/libkcal/incidence.cpp
+++ b/libkcal/incidence.cpp
@@ -529,71 +529,75 @@ bool Incidence::isAlarmEnabled() const
}
return false;
}
Recurrence *Incidence::recurrence() const
{
return mRecurrence;
}
void Incidence::setRecurrence( Recurrence * r)
{
delete mRecurrence;
mRecurrence = r;
}
void Incidence::setLocation(const QString &location)
{
if (mReadOnly) return;
mLocation = location;
updated();
}
QString Incidence::location() const
{
return mLocation;
}
ushort Incidence::doesRecur() const
{
if ( mRecurrence ) return mRecurrence->doesRecur();
else return Recurrence::rNone;
}
QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const
{
QDateTime incidenceStart = dt;
*ok = false;
if ( doesRecur() ) {
bool last;
recurrence()->getPreviousDateTime( incidenceStart , &last );
int count = 0;
if ( !last ) {
while ( !last ) {
++count;
incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last );
if ( recursOn( incidenceStart.date() ) ) {
last = true; // exit while llop
} else {
if ( last ) { // no alarm on last recurrence
return QDateTime ();
}
int year = incidenceStart.date().year();
// workaround for bug in recurrence
if ( count == 100 || year < 1980 || year > 5000 ) {
return QDateTime ();
}
incidenceStart = incidenceStart.addSecs( 1 );
}
}
} else {
return QDateTime ();
}
} else {
if ( hasStartDate () ) {
incidenceStart = dtStart();
-
- }
+ }
+ if ( type() =="Todo" ) {
+ if ( ((Todo*)this)->hasDueDate() )
+ incidenceStart = ((Todo*)this)->dtDue();
+
+ }
}
if ( incidenceStart > dt )
*ok = true;
return incidenceStart;
}