author | zautrix <zautrix> | 2005-02-07 21:06:04 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-07 21:06:04 (UTC) |
commit | edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e (patch) (unidiff) | |
tree | 7653e521f003a0c4e316530d38c09f3190c4edaf | |
parent | da5e47069d88fa9aa656423ce4c60bf505728e1c (diff) | |
download | kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.zip kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.tar.gz kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.tar.bz2 |
recurrence fixes
-rw-r--r-- | korganizer/koeventviewer.cpp | 23 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 24 | ||||
-rw-r--r-- | libkcal/recurrence.cpp | 2 | ||||
-rw-r--r-- | microkde/kdeui/ktoolbar.cpp | 2 | ||||
-rw-r--r-- | microkde/kdeui/ktoolbar.h | 2 |
5 files changed, 32 insertions, 21 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index de11c13..39921a0 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -300,26 +300,29 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
300 | } | 300 | } |
301 | 301 | ||
302 | if (event->recurrence()->doesRecur()) { | 302 | if (event->recurrence()->doesRecur()) { |
303 | 303 | ||
304 | QString recurText = event->recurrence()->recurrenceText(); | 304 | QString recurText = event->recurrence()->recurrenceText(); |
305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 305 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
306 | bool last; | 306 | bool ok; |
307 | QDate start = QDate::currentDate(); | 307 | QDate start = QDate::currentDate(); |
308 | QDate next; | 308 | QDateTime next; |
309 | next = event->recurrence()->getPreviousDate( start , &last ); | 309 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
310 | if ( !last ) { | 310 | if ( ok ) { |
311 | next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); | ||
312 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 311 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
313 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 312 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
314 | QDateTime nextdt = QDateTime( next, event->dtStart().time()); | 313 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); |
315 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); | ||
316 | 314 | ||
317 | } else { | 315 | } else { |
318 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 316 | bool last; |
319 | addTag("p", KGlobal::locale()->formatDate( next, shortDate )); | 317 | QDate nextd; |
318 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | ||
319 | if ( last ) { | ||
320 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | ||
321 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | ||
322 | } | ||
320 | } | 323 | } |
321 | } else { | 324 | } else { |
322 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 325 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
323 | 326 | ||
324 | } | 327 | } |
325 | 328 | ||
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 6d07d4c..0d9c3f4 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -101,23 +101,29 @@ void KIncidenceFormatter::setEvent(Event *event) | |||
101 | } | 101 | } |
102 | 102 | ||
103 | if (event->recurrence()->doesRecur()) { | 103 | if (event->recurrence()->doesRecur()) { |
104 | 104 | ||
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 | } |
120 | 126 | ||
121 | 127 | ||
122 | if (event->isAlarmEnabled()) { | 128 | if (event->isAlarmEnabled()) { |
123 | Alarm *alarm =event->alarms().first() ; | 129 | Alarm *alarm =event->alarms().first() ; |
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp index e84f672..5181eaf 100644 --- a/libkcal/recurrence.cpp +++ b/libkcal/recurrence.cpp | |||
@@ -876,12 +876,13 @@ QDate Recurrence::getNextDate(const QDate &preDate, bool *last) const | |||
876 | case rWeekly: | 876 | case rWeekly: |
877 | case rMonthlyPos: | 877 | case rMonthlyPos: |
878 | case rMonthlyDay: | 878 | case rMonthlyDay: |
879 | case rYearlyMonth: | 879 | case rYearlyMonth: |
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: |
884 | return QDate(); | 885 | return QDate(); |
885 | } | 886 | } |
886 | } | 887 | } |
887 | 888 | ||
@@ -1163,12 +1164,13 @@ bool Recurrence::recursYearlyByDay(const QDate &qd) const | |||
1163 | * If 'last' is non-null, '*last' is set to true if the next recurrence is the | 1164 | * If 'last' is non-null, '*last' is set to true if the next recurrence is the |
1164 | * last recurrence, else false. | 1165 | * last recurrence, else false. |
1165 | * Reply = date of next recurrence, or invalid date if none. | 1166 | * Reply = date of next recurrence, or invalid date if none. |
1166 | */ | 1167 | */ |
1167 | QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const | 1168 | QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const |
1168 | { | 1169 | { |
1170 | |||
1169 | if (last) | 1171 | if (last) |
1170 | *last = false; | 1172 | *last = false; |
1171 | QDate dStart = mRecurStart.date(); | 1173 | QDate dStart = mRecurStart.date(); |
1172 | if (preDate < dStart) | 1174 | if (preDate < dStart) |
1173 | return dStart; | 1175 | return dStart; |
1174 | QDate earliestDate = preDate.addDays(1); | 1176 | QDate earliestDate = preDate.addDays(1); |
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 | |||
@@ -875,13 +875,13 @@ void KToolBar::setBarPos (BarPosition bpos) | |||
875 | return; | 875 | return; |
876 | //US mainWindow()->moveDockWindow( this, (Dock)bpos ); | 876 | //US mainWindow()->moveDockWindow( this, (Dock)bpos ); |
877 | mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos ); | 877 | mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos ); |
878 | } | 878 | } |
879 | 879 | ||
880 | 880 | ||
881 | KToolBar::BarPosition KToolBar::barPos() const | 881 | const KToolBar::BarPosition KToolBar::barPos() |
882 | { | 882 | { |
883 | if ( !(QMainWindow*)mainWindow() ) | 883 | if ( !(QMainWindow*)mainWindow() ) |
884 | return KToolBar::Top; | 884 | return KToolBar::Top; |
885 | //US Dock dock; | 885 | //US Dock dock; |
886 | QMainWindow::ToolBarDock dock; | 886 | QMainWindow::ToolBarDock dock; |
887 | int dm1, dm2; | 887 | int dm1, dm2; |
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 | |||
@@ -743,13 +743,13 @@ public: | |||
743 | */ | 743 | */ |
744 | void setBarPos (BarPosition bpos); | 744 | void setBarPos (BarPosition bpos); |
745 | 745 | ||
746 | /** | 746 | /** |
747 | * Returns position of toolbar. | 747 | * Returns position of toolbar. |
748 | */ | 748 | */ |
749 | BarPosition barPos() const; | 749 | const BarPosition barPos(); |
750 | 750 | ||
751 | /** | 751 | /** |
752 | * @deprecated | 752 | * @deprecated |
753 | * Show, hide, or toggle toolbar. | 753 | * Show, hide, or toggle toolbar. |
754 | * | 754 | * |
755 | * This method is provided for compatibility only, | 755 | * This method is provided for compatibility only, |