-rw-r--r-- | korganizer/calendarview.cpp | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 8f05276..038da54 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -2182,15 +2182,15 @@ void CalendarView::updateView() void CalendarView::updateUnmanagedViews() { mDateNavigator->updateDayMatrix(); } -int CalendarView::msgItemDelete() +int CalendarView::msgItemDelete(const QString name) { - return KMessageBox::warningContinueCancel(this, + return KMessageBox::warningContinueCancel(this,name +"\n\n"+ i18n("This item will be\npermanently deleted."), i18n("KO/Pi Confirmation"),i18n("Delete")); } void CalendarView::edit_cut() @@ -2885,46 +2885,49 @@ void CalendarView::deleteTodo(Todo *todo) { if (!todo) { KNotifyClient::beep(); return; } if (KOPrefs::instance()->mConfirm) { - switch (msgItemDelete()) { + QString text = todo->summary().left(20); + if (!todo->relations().isEmpty()) { + text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); + + } + switch (msgItemDelete(text)) { case KMessageBox::Continue: // OK + bool deleteT = false; if (!todo->relations().isEmpty()) { - KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), - i18n("Delete To-Do")); - } else { + deleteT = removeCompletedSubTodos( todo ); + } + // deleteT == true: todo already deleted in removeCompletedSubTodos + if ( !deleteT ) { checkExternalId( todo ); calendar()->deleteTodo(todo); changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); updateView(); } break; } // switch } else { - if (!todo->relations().isEmpty()) { - KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), - i18n("Delete To-Do")); - } else { - checkExternalId( todo ); - mCalendar->deleteTodo(todo); - changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); - updateView(); - } + checkExternalId( todo ); + mCalendar->deleteTodo(todo); + changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); + updateView(); } + emit updateSearchDialog(); } void CalendarView::deleteJournal(Journal *jour) { if (!jour) { KNotifyClient::beep(); return; } if (KOPrefs::instance()->mConfirm) { - switch (msgItemDelete()) { + switch (msgItemDelete( jour->description().left(20))) { case KMessageBox::Continue: // OK calendar()->deleteJournal(jour); updateView(); break; } // switch } else { @@ -3480,12 +3483,29 @@ void CalendarView::showDates(const DateList &selectedDates) } QString selDates; selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); if (selectedDates.first() < selectedDates.last() ) selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); + else { + QString addString; + if ( selectedDates.first() == QDateTime::currentDateTime().date() ) + addString = i18n("Today"); + else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) ) + addString = i18n("Tomorrow"); + else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) ) + addString = i18n("Yesterday"); + else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) ) + addString = i18n("Day before yesterday"); + else if ( selectedDates.first() == 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() { |