From 6946f6ab0ee6eeafee0c8ff5d33fffc0826c7452 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sat, 22 Jan 2005 10:18:16 +0000 Subject: some small fixes --- (limited to 'korganizer') 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() 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")); } @@ -2888,12 +2888,19 @@ void CalendarView::deleteTodo(Todo *todo) 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 ); @@ -2902,16 +2909,12 @@ void CalendarView::deleteTodo(Todo *todo) 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) @@ -2921,7 +2924,7 @@ void CalendarView::deleteJournal(Journal *jour) return; } if (KOPrefs::instance()->mConfirm) { - switch (msgItemDelete()) { + switch (msgItemDelete( jour->description().left(20))) { case KMessageBox::Continue: // OK calendar()->deleteJournal(jour); updateView(); @@ -3483,6 +3486,23 @@ void CalendarView::showDates(const DateList &selectedDates) 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 ); } diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index e27da9a..c8d6bdd 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -485,7 +485,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void schedule(Scheduler::Method, Incidence *incidence = 0); // returns KMsgBox::OKCandel() - int msgItemDelete(); + int msgItemDelete(const QString name); void showEventEditor(); void showTodoEditor(); void writeLocale(); diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 94e1f4c..b4fe965 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp @@ -283,6 +283,20 @@ void KOEditorGeneral::pickAlarmProgram() } +QString KOEditorGeneral::getFittingPath( const QString s ) +{ + int maxlen = 50; + if ( QApplication::desktop()->width() < 640 ) { + if ( QApplication::desktop()->width() < 320 ) + maxlen = 22; + else + maxlen = 35; + } + if ( s.length() > maxlen ) { + return "..."+s.right(maxlen -3); + } + return s; +} void KOEditorGeneral::enableAlarmEdit(bool enable) { @@ -297,12 +311,12 @@ void KOEditorGeneral::enableAlarmEdit(bool enable) } } if (mAlarmProgramButton->isOn()) - ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + mAlarmProgram ); + ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Proc.Al.: ") + getFittingPath(mAlarmProgram) ); if (!mAlarmSound.isEmpty() && mAlarmSoundButton->isOn()) - ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Sound.Al.: ") + mAlarmSound ); + ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Audio Al.: ") + getFittingPath(mAlarmSound) ); } else { - ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Alarm disabled")); + ((QWidget*)parent())->topLevelWidget()->setCaption(i18n("Alarm disabled for this item")); } mAlarmTimeEdit->setEnabled(enable); diff --git a/korganizer/koeditorgeneral.h b/korganizer/koeditorgeneral.h index c58335e..de8edaf 100644 --- a/korganizer/koeditorgeneral.h +++ b/korganizer/koeditorgeneral.h @@ -105,6 +105,7 @@ class KOEditorGeneral : public QObject QLabel *mCategoriesLabel; private: + QString getFittingPath( const QString ) ; QString mAlarmSound; QString mAlarmProgram; }; diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 97b4a03..30adb06 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -818,12 +818,7 @@ void KOTodoView::showTodo() void KOTodoView::deleteTodo() { if (mActiveItem) { - if (mActiveItem->childCount()) { - KMessageBox::sorry(this,i18n("Cannot delete To-Do which has children."), - i18n("Delete To-Do")); - } else { emit deleteTodoSignal(mActiveItem->todo()); - } } } diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 151b55b..7b07a2e 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -1704,7 +1704,16 @@ void MainWindow::setCaptionToDates() QString selDates; selDates = KGlobal::locale()->formatDate(mView->startDate(), true); if (mView->startDate() < mView->endDate() ) - selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); + selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); + else { + QString addString; + if ( mView->startDate() == QDateTime::currentDateTime().date() ) + addString = i18n("Today"); + else if ( mView->startDate() == QDateTime::currentDateTime().date().addDays(1) ) + addString = i18n("Tomorrow"); + if ( !addString.isEmpty() ) + selDates = addString+", "+selDates ; + } setCaption( i18n("Dates: ") + selDates ); } -- cgit v0.9.0.2