summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp44
1 files changed, 32 insertions, 12 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 8f05276..038da54 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2185,9 +2185,9 @@ void CalendarView::updateUnmanagedViews()
2185 mDateNavigator->updateDayMatrix(); 2185 mDateNavigator->updateDayMatrix();
2186} 2186}
2187 2187
2188int CalendarView::msgItemDelete() 2188int CalendarView::msgItemDelete(const QString name)
2189{ 2189{
2190 return KMessageBox::warningContinueCancel(this, 2190 return KMessageBox::warningContinueCancel(this,name +"\n\n"+
2191 i18n("This item will be\npermanently deleted."), 2191 i18n("This item will be\npermanently deleted."),
2192 i18n("KO/Pi Confirmation"),i18n("Delete")); 2192 i18n("KO/Pi Confirmation"),i18n("Delete"));
2193} 2193}
@@ -2888,12 +2888,19 @@ void CalendarView::deleteTodo(Todo *todo)
2888 return; 2888 return;
2889 } 2889 }
2890 if (KOPrefs::instance()->mConfirm) { 2890 if (KOPrefs::instance()->mConfirm) {
2891 switch (msgItemDelete()) { 2891 QString text = todo->summary().left(20);
2892 if (!todo->relations().isEmpty()) {
2893 text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!");
2894
2895 }
2896 switch (msgItemDelete(text)) {
2892 case KMessageBox::Continue: // OK 2897 case KMessageBox::Continue: // OK
2898 bool deleteT = false;
2893 if (!todo->relations().isEmpty()) { 2899 if (!todo->relations().isEmpty()) {
2894 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."), 2900 deleteT = removeCompletedSubTodos( todo );
2895 i18n("Delete To-Do")); 2901 }
2896 } else { 2902 // deleteT == true: todo already deleted in removeCompletedSubTodos
2903 if ( !deleteT ) {
2897 checkExternalId( todo ); 2904 checkExternalId( todo );
2898 calendar()->deleteTodo(todo); 2905 calendar()->deleteTodo(todo);
2899 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2906 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
@@ -2902,16 +2909,12 @@ void CalendarView::deleteTodo(Todo *todo)
2902 break; 2909 break;
2903 } // switch 2910 } // switch
2904 } else { 2911 } else {
2905 if (!todo->relations().isEmpty()) {
2906 KMessageBox::sorry(this,i18n("Cannot delete To-Do\nwhich has children."),
2907 i18n("Delete To-Do"));
2908 } else {
2909 checkExternalId( todo ); 2912 checkExternalId( todo );
2910 mCalendar->deleteTodo(todo); 2913 mCalendar->deleteTodo(todo);
2911 changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); 2914 changeTodoDisplay( todo,KOGlobals::EVENTDELETED );
2912 updateView(); 2915 updateView();
2913 } 2916 }
2914 } 2917
2915 emit updateSearchDialog(); 2918 emit updateSearchDialog();
2916} 2919}
2917void CalendarView::deleteJournal(Journal *jour) 2920void CalendarView::deleteJournal(Journal *jour)
@@ -2921,7 +2924,7 @@ void CalendarView::deleteJournal(Journal *jour)
2921 return; 2924 return;
2922 } 2925 }
2923 if (KOPrefs::instance()->mConfirm) { 2926 if (KOPrefs::instance()->mConfirm) {
2924 switch (msgItemDelete()) { 2927 switch (msgItemDelete( jour->description().left(20))) {
2925 case KMessageBox::Continue: // OK 2928 case KMessageBox::Continue: // OK
2926 calendar()->deleteJournal(jour); 2929 calendar()->deleteJournal(jour);
2927 updateView(); 2930 updateView();
@@ -3483,6 +3486,23 @@ void CalendarView::showDates(const DateList &selectedDates)
3483 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true); 3486 selDates = KGlobal::locale()->formatDate( selectedDates.first(), true);
3484 if (selectedDates.first() < selectedDates.last() ) 3487 if (selectedDates.first() < selectedDates.last() )
3485 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true); 3488 selDates += " - " + KGlobal::locale()->formatDate( selectedDates.last(),true);
3489 else {
3490 QString addString;
3491 if ( selectedDates.first() == QDateTime::currentDateTime().date() )
3492 addString = i18n("Today");
3493 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(1) )
3494 addString = i18n("Tomorrow");
3495 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-1) )
3496 addString = i18n("Yesterday");
3497 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(-2) )
3498 addString = i18n("Day before yesterday");
3499 else if ( selectedDates.first() == QDateTime::currentDateTime().date().addDays(2) )
3500 addString = i18n("Day after tomorrow");
3501 if ( !addString.isEmpty() ) {
3502 topLevelWidget()->setCaption( addString+", " + selDates );
3503 return;
3504 }
3505 }
3486 topLevelWidget()->setCaption( i18n("Dates: ") + selDates ); 3506 topLevelWidget()->setCaption( i18n("Dates: ") + selDates );
3487 3507
3488} 3508}