summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-07 21:06:04 (UTC)
committer zautrix <zautrix>2005-02-07 21:06:04 (UTC)
commitedaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e (patch) (side-by-side diff)
tree7653e521f003a0c4e316530d38c09f3190c4edaf
parentda5e47069d88fa9aa656423ce4c60bf505728e1c (diff)
downloadkdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.zip
kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.tar.gz
kdepimpi-edaad9a9d7ede1b4bc50b9e758eaf32a5fbb547e.tar.bz2
recurrence fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp23
-rw-r--r--libkcal/kincidenceformatter.cpp24
-rw-r--r--libkcal/recurrence.cpp2
-rw-r--r--microkde/kdeui/ktoolbar.cpp2
-rw-r--r--microkde/kdeui/ktoolbar.h2
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 )
}
if (event->recurrence()->doesRecur()) {
QString recurText = event->recurrence()->recurrenceText();
addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
- 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("<b>Next recurrence is on:</b>") );
- 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("<b>Last recurrence was on:</b>") );
- addTag("p", KGlobal::locale()->formatDate( next, shortDate ));
+ bool last;
+ QDate nextd;
+ nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
+ if ( last ) {
+ addTag("p",i18n("<b>Last recurrence was on:</b>") );
+ 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
@@ -101,23 +101,29 @@ void KIncidenceFormatter::setEvent(Event *event)
}
if (event->recurrence()->doesRecur()) {
QString recurText = event->recurrence()->recurrenceText();
addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>");
- 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("<b>Next recurrence is on:</b>") );
+ addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate ));
+
} else {
- addTag("p",i18n("<b>Last recurrence was on:</b>") );
- addTag("p", KGlobal::locale()->formatDate( next, shortDate ));
+ bool last;
+ QDate nextd;
+ nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last );
+ if ( last ) {
+ addTag("p",i18n("<b>Last recurrence was on:</b>") );
+ addTag("p", KGlobal::locale()->formatDate( nextd, shortDate ));
+ }
}
}
if (event->isAlarmEnabled()) {
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
case rWeekly:
case rMonthlyPos:
case rMonthlyDay:
case rYearlyMonth:
case rYearlyDay:
case rYearlyPos:
+ qDebug("Recurrence::getNextDate: MAY BE BROKEN ");
return getNextDateNoTime(preDate, last);
default:
return QDate();
}
}
@@ -1163,12 +1164,13 @@ bool Recurrence::recursYearlyByDay(const QDate &qd) const
* If 'last' is non-null, '*last' is set to true if the next recurrence is the
* last recurrence, else false.
* Reply = date of next recurrence, or invalid date if none.
*/
QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const
{
+
if (last)
*last = false;
QDate dStart = mRecurStart.date();
if (preDate < dStart)
return dStart;
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)
return;
//US mainWindow()->moveDockWindow( this, (Dock)bpos );
mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos );
}
-KToolBar::BarPosition KToolBar::barPos() const
+const KToolBar::BarPosition KToolBar::barPos()
{
if ( !(QMainWindow*)mainWindow() )
return KToolBar::Top;
//US Dock dock;
QMainWindow::ToolBarDock dock;
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:
*/
void setBarPos (BarPosition bpos);
/**
* Returns position of toolbar.
*/
- BarPosition barPos() const;
+ const BarPosition barPos();
/**
* @deprecated
* Show, hide, or toggle toolbar.
*
* This method is provided for compatibility only,