From edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 07 Feb 2005 21:06:04 +0000 Subject: recurrence fixes --- diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index de11c13..39921a0 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -303,20 +303,23 @@ void KOEventViewer::appendEvent(Event *event, int mode ) QString recurText = event->recurrence()->recurrenceText(); addTag("p","" + i18n("This is a %1 recurring event.").arg(recurText ) + ""); - bool last; + bool ok; QDate start = QDate::currentDate(); - QDate next; - next = event->recurrence()->getPreviousDate( start , &last ); - if ( !last ) { - next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); + QDateTime next; + next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); + if ( ok ) { addTag("p",i18n("Next recurrence is on:") ); - addTag("p", KGlobal::locale()->formatDate( next, shortDate )); - QDateTime nextdt = QDateTime( next, event->dtStart().time()); - mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); + addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); + mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); } else { - addTag("p",i18n("Last recurrence was on:") ); - addTag("p", KGlobal::locale()->formatDate( next, shortDate )); + bool last; + QDate nextd; + nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); + if ( last ) { + addTag("p",i18n("Last recurrence was on:") ); + addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); + } } } else { mMailSubject += i18n(" - " )+event->dtStartStr( true ); diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 6d07d4c..0d9c3f4 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp @@ -104,17 +104,23 @@ void KIncidenceFormatter::setEvent(Event *event) QString recurText = event->recurrence()->recurrenceText(); addTag("p","" + i18n("This is a %1 recurring event.").arg(recurText ) + ""); - bool last; + + bool ok; QDate start = QDate::currentDate(); - QDate next; - next = event->recurrence()->getPreviousDate( start , &last ); - if ( !last ) { - next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); - addTag("p",i18n("Next recurrence is on: ")+ KGlobal::locale()->formatDate( next, shortDate ) ); - //addTag("p", KGlobal::locale()->formatDate( next, shortDate )); + QDateTime next; + next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); + if ( ok ) { + addTag("p",i18n("Next recurrence is on:") ); + addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); + } else { - addTag("p",i18n("Last recurrence was on:") ); - addTag("p", KGlobal::locale()->formatDate( next, shortDate )); + bool last; + QDate nextd; + nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); + if ( last ) { + addTag("p",i18n("Last recurrence was on:") ); + addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); + } } } diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp index e84f672..5181eaf 100644 --- a/libkcal/recurrence.cpp +++ b/libkcal/recurrence.cpp @@ -879,6 +879,7 @@ QDate Recurrence::getNextDate(const QDate &preDate, bool *last) const case rYearlyMonth: case rYearlyDay: case rYearlyPos: + qDebug("Recurrence::getNextDate: MAY BE BROKEN "); return getNextDateNoTime(preDate, last); default: return QDate(); @@ -1166,6 +1167,7 @@ bool Recurrence::recursYearlyByDay(const QDate &qd) const */ QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const { + if (last) *last = false; QDate dStart = mRecurStart.date(); diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp index 09ad0c8..35d4916 100644 --- a/microkde/kdeui/ktoolbar.cpp +++ b/microkde/kdeui/ktoolbar.cpp @@ -878,7 +878,7 @@ void KToolBar::setBarPos (BarPosition bpos) } -KToolBar::BarPosition KToolBar::barPos() const +const KToolBar::BarPosition KToolBar::barPos() { if ( !(QMainWindow*)mainWindow() ) return KToolBar::Top; diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h index 49ff856..7a5c114 100644 --- a/microkde/kdeui/ktoolbar.h +++ b/microkde/kdeui/ktoolbar.h @@ -746,7 +746,7 @@ public: /** * Returns position of toolbar. */ - BarPosition barPos() const; + const BarPosition barPos(); /** * @deprecated -- cgit v0.9.0.2