-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 @@ -3585,63 +3585,69 @@ void CalendarView::processIncidenceSelection( Incidence *incidence ) void CalendarView::checkClipboard() { #ifndef KORG_NODND if (ICalDrag::canDecode(QApplication::clipboard()->data())) { emit pasteEnabled(true); } else { emit pasteEnabled(false); } #endif } void CalendarView::showDates(const DateList &selectedDates) { // kdDebug() << "CalendarView::selectDates()" << endl; if ( !mBlockShowDates ) { if ( mViewManager->currentView() ) { updateView( selectedDates.first(), selectedDates.last() ); } else { 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; } } topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); } QPtrList<CalFilter> CalendarView::filters() { return mFilters; } void CalendarView::editFilters() { // kdDebug() << "CalendarView::editFilters()" << endl; CalFilter *filter = mFilters.first(); while(filter) { kdDebug() << " Filter: " << filter->name() << endl; filter = mFilters.next(); } |