summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 92fd59c..3a16fe6 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -3608,4 +3608,10 @@ void CalendarView::showDates(const DateList &selectedDates)
+ QDate date = selectedDates.first();
+ if ( ! date.isValid() ) {
+ topLevelWidget()->setCaption("");
+ return;
+ }
+
QString selDates;
- selDates = KGlobal::locale()->formatDate( selectedDates.first(), true);
+ selDates = KGlobal::locale()->formatDate( date, true);
if (selectedDates.first() < selectedDates.last() )
@@ -3614,11 +3620,11 @@ void CalendarView::showDates(const DateList &selectedDates)
QString addString;
- if ( selectedDates.first() == QDateTime::currentDateTime().date() )
+ if ( date == QDateTime::currentDateTime().date() )
addString = i18n("Today");
- else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) )
+ else if ( date == QDateTime::currentDateTime().date().addDays(1) )
addString = i18n("Tomorrow");
- else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) )
+ else if ( date == QDateTime::currentDateTime().date().addDays(-1) )
addString = i18n("Yesterday");
- else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) )
+ else if ( date == QDateTime::currentDateTime().date().addDays(-2) )
addString = i18n("Day before yesterday");
- else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) )
+ else if ( date == QDateTime::currentDateTime().date().addDays(2) )
addString = i18n("Day after tomorrow");