[pim/korganizer/release/26.08] src/kontactplugin/korganizer: Revert "apptsummarywidget.cpp,todosummarywidget.cpp - improve menu for read-only"
Allen Winter <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 94765def1ce8c94e43ab674930eb8afd699d1a35 by Allen Winter.
Committed on 25/07/2026 at 18:53.
Pushed by winterz into branch 'release/26.08'.
Revert "apptsummarywidget.cpp,todosummarywidget.cpp - improve menu for read-only"
This reverts commit e4473348c984f4b8da4a1cfa360b8e2374786a66.
REASON: introduced new i18n strings past the string freeze.
M +8 -17 src/kontactplugin/korganizer/apptsummarywidget.cpp
M +10 -19 src/kontactplugin/korganizer/todosummarywidget.cpp
https://invent.kde.org/pim/korganizer/-/commit/94765def1ce8c94e43ab674930eb8afd699d1a35
diff --git a/src/kontactplugin/korganizer/apptsummarywidget.cpp b/src/kontactplugin/korganizer/apptsummarywidget.cpp
index bc92b1913..2e4654f45 100644
--- a/src/kontactplugin/korganizer/apptsummarywidget.cpp
+++ b/src/kontactplugin/korganizer/apptsummarywidget.cpp
@@ -232,26 +232,17 @@ void ApptSummaryWidget::removeEvent(const Akonadi::Item &item)
void ApptSummaryWidget::popupMenu(const QString &uid)
{
- const Akonadi::Item item = mCalendar->item(uid);
- if (!item.isValid()) {
- return;
- }
-
QMenu popup(this);
- QAction *editIt;
- const bool writeable = mCalendar->hasRight(item, Akonadi::Collection::CanDeleteItem);
- if (writeable) {
- editIt = popup.addAction(i18nc("@action:inmenu", "&Edit Appointment…"));
- editIt->setIcon(QIcon::fromTheme(QStringLiteral("document-edit")));
- } else {
- editIt = popup.addAction(i18nc("@action:inmenu", "&Show Appointment…"));
- editIt->setIcon(QIcon::fromTheme(QStringLiteral("document-preview")));
- }
-
- QAction *delIt = popup.addAction(i18nc("@action:inmenu", "&Delete Appointment"));
+ // FIXME: Should say "Show Appointment" if we don't have rights to edit
+ // Doesn't make sense to edit events from birthday resource for example
+ QAction *editIt = popup.addAction(i18n("&Edit Appointment…"));
+ editIt->setIcon(QIcon::fromTheme(QStringLiteral("document-edit")));
+ QAction *delIt = popup.addAction(i18n("&Delete Appointment"));
delIt->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
- delIt->setEnabled(writeable);
+
+ const Akonadi::Item item = mCalendar->item(uid);
+ delIt->setEnabled(mCalendar->hasRight(item, Akonadi::Collection::CanDeleteItem));
const QAction *selectedAction = popup.exec(QCursor::pos());
if (selectedAction == editIt) {
diff --git a/src/kontactplugin/korganizer/todosummarywidget.cpp b/src/kontactplugin/korganizer/todosummarywidget.cpp
index 169543c1a..fd8e67672 100644
--- a/src/kontactplugin/korganizer/todosummarywidget.cpp
+++ b/src/kontactplugin/korganizer/todosummarywidget.cpp
@@ -372,32 +372,23 @@ void TodoSummaryWidget::completeTodo(Akonadi::Item::Id id)
void TodoSummaryWidget::popupMenu(const QString &uid)
{
- const Akonadi::Item item = mCalendar->item(uid);
- if (!item.isValid()) {
+ KCalendarCore::Todo::Ptr const todo = mCalendar->todo(uid);
+ if (!todo) {
return;
}
-
+ Akonadi::Item const item = mCalendar->item(uid);
QMenu popup(this);
-
- QAction *editIt;
- const bool writeable = mCalendar->hasRight(item, Akonadi::Collection::CanDeleteItem);
- if (writeable) {
- editIt = popup.addAction(i18nc("@action:inmenu", "&Edit To-do…"));
- editIt->setIcon(QIcon::fromTheme(QStringLiteral("document-edit")));
- } else {
- editIt = popup.addAction(i18nc("@action:inmenu", "&Show To-do…"));
- editIt->setIcon(QIcon::fromTheme(QStringLiteral("document-preview")));
- }
-
- QAction *delIt = popup.addAction(i18nc("@action:inmenu", "&Delete To-do"));
+ QAction *editIt = popup.addAction(i18n("&Edit To-do…"));
+ editIt->setIcon(QIcon::fromTheme(QStringLiteral("document-edit")));
+ QAction *delIt = popup.addAction(i18n("&Delete To-do"));
delIt->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
- delIt->setEnabled(writeable);
+ delIt->setEnabled(mCalendar->hasRight(item, Akonadi::Collection::CanDeleteItem));
QAction *doneIt = nullptr;
- if (!mCalendar->todo(uid)->isCompleted()) {
- doneIt = popup.addAction(i18nc("@action:inmenu", "&Mark To-do Completed"));
+ if (!todo->isCompleted()) {
+ doneIt = popup.addAction(i18n("&Mark To-do Completed"));
doneIt->setIcon(QIcon::fromTheme(QStringLiteral("task-complete")));
- doneIt->setEnabled(writeable);
+ doneIt->setEnabled(mCalendar->hasRight(item, Akonadi::Collection::CanChangeItem));
}
const QAction *selectedAction = popup.exec(QCursor::pos());