summaryrefslogtreecommitdiffabout
path: root/libkcal
authorzautrix <zautrix>2005-02-07 21:06:04 (UTC)
committer zautrix <zautrix>2005-02-07 21:06:04 (UTC)
commitedaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e (patch) (unidiff)
tree7653e521f003a0c4e316530d38c09f3190c4edaf /libkcal
parentda5e47069d88fa9aa656423ce4c60bf505728e1c (diff)
downloadkdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.zip
kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.tar.gz
kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.tar.bz2
recurrence fixes
Diffstat (limited to 'libkcal') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/kincidenceformatter.cpp24
-rw-r--r--libkcal/recurrence.cpp2
2 files changed, 17 insertions, 9 deletions
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp
index 6d07d4c..0d9c3f4 100644
--- a/libkcal/kincidenceformatter.cpp
+++ b/libkcal/kincidenceformatter.cpp
@@ -105,15 +105,21 @@ void KIncidenceFormatter::setEvent(Event *event)
105 QString recurText = event->recurrence()->recurrenceText(); 105 QString recurText = event->recurrence()->recurrenceText();
106 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); 106 addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
107 bool last; 107
108 bool ok;
108 QDate start = QDate::currentDate(); 109 QDate start = QDate::currentDate();
109 QDate next; 110 QDateTime next;
110 next = event->recurrence()->getPreviousDate( start , &last ); 111 next = event->getNextOccurence( QDateTime::currentDateTime() , &ok );
111 if ( !last ) { 112 if ( ok ) {
112 next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); 113 addTag("p",i18n("<b>Next recurrence is on:</b>") );
113 addTag("p",i18n("Next recurrence is on: ")+ KGlobal::locale()->formatDate( next, shortDate ) ); 114 addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
114 //addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 115
115 } else { 116 } else {
116 addTag("p",i18n("<b>Last recurrence was on:</b>") ); 117 bool last;
117 addTag("p", KGlobal::locale()->formatDate( next, shortDate )); 118 QDate nextd;
119 nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
120 if ( last ) {
121 addTag("p",i18n("<b>Last recurrence was on:</b>") );
122 addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
123 }
118 } 124 }
119 } 125 }
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp
index e84f672..5181eaf 100644
--- a/libkcal/recurrence.cpp
+++ b/libkcal/recurrence.cpp
@@ -880,4 +880,5 @@ QDate Recurrence::getNextDate(const QDate &preDate, bool *last) const
880 case rYearlyDay: 880 case rYearlyDay:
881 case rYearlyPos: 881 case rYearlyPos:
882 qDebug("Recurrence::getNextDate: MAY BE BROKEN ");
882 return getNextDateNoTime(preDate, last); 883 return getNextDateNoTime(preDate, last);
883 default: 884 default:
@@ -1167,4 +1168,5 @@ bool Recurrence::recursYearlyByDay(const QDate &qd) const
1167QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const 1168QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const
1168{ 1169{
1170
1169 if (last) 1171 if (last)
1170 *last = false; 1172 *last = false;