-rw-r--r-- | korganizer/calendarview.cpp | 18 |
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 @@ -3605,23 +3605,29 @@ void CalendarView::showDates(const DateList &selectedDates) mViewManager->showAgendaView(); } } + 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 ); return; |