summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (show 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
@@ -3606,21 +3606,27 @@ 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() )
selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
else {
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");
if ( !addString.isEmpty() ) {
topLevelWidget()->setCaption( addString+", " + selDates );