[pim/korganizer] src/kontactplugin/korganizer: apptsummarywidget.cpp,todosummarywidget.cpp - view slot: edit or show

Allen Winter <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit b523fbc08b27b4be4879db50d942df1920662b2d by Allen Winter.
Committed on 25/07/2026 at 18:42.
Pushed by winterz into branch 'master'.

apptsummarywidget.cpp,todosummarywidget.cpp - view slot: edit or show

When in the viewEvent() or viewTodo() slot, check for read-only
and then start either the editor or the displayer, as appropriate.

M  +7    -3    src/kontactplugin/korganizer/apptsummarywidget.cpp
M  +7    -4    src/kontactplugin/korganizer/todosummarywidget.cpp

https://invent.kde.org/pim/korganizer/-/commit/b523fbc08b27b4be4879db50d942df1920662b2d

diff --git a/src/kontactplugin/korganizer/apptsummarywidget.cpp b/src/kontactplugin/korganizer/apptsummarywidget.cpp
index 3e35e9a59..6feb7f5c0 100644
--- a/src/kontactplugin/korganizer/apptsummarywidget.cpp
+++ b/src/kontactplugin/korganizer/apptsummarywidget.cpp
@@ -212,12 +212,16 @@ void ApptSummaryWidget::updateView()
 
 void ApptSummaryWidget::viewEvent(const QString &uid)
 {
-    const Akonadi::Item::Id id = mCalendar->item(uid).id();
+    const Akonadi::Item item = mCalendar->item(uid);
 
-    if (id != -1) {
+    if (item.isValid()) {
         mPlugin->core()->selectPlugin(QStringLiteral("kontact_korganizerplugin")); // ensure loaded
         OrgKdeKorganizerKorganizerInterface korganizer(QStringLiteral("org.kde.korganizer"), QStringLiteral("/Korganizer"), QDBusConnection::sessionBus());
-        korganizer.editIncidence(QString::number(id));
+        if (mCalendar->hasRight(item, Akonadi::Collection::CanDeleteItem)) {
+            korganizer.editIncidence(QString::number(item.id()));
+        } else {
+            korganizer.showIncidence(QString::number(item.id()));
+        }
     }
 }
 
diff --git a/src/kontactplugin/korganizer/todosummarywidget.cpp b/src/kontactplugin/korganizer/todosummarywidget.cpp
index 20c35f279..733371734 100644
--- a/src/kontactplugin/korganizer/todosummarywidget.cpp
+++ b/src/kontactplugin/korganizer/todosummarywidget.cpp
@@ -341,13 +341,16 @@ void TodoSummaryWidget::updateView()
 
 void TodoSummaryWidget::viewTodo(const QString &uid)
 {
-    const Akonadi::Item::Id id = mCalendar->item(uid).id();
+    const Akonadi::Item item = mCalendar->item(uid);
 
-    if (id != -1) {
+    if (item.isValid()) {
         mPlugin->core()->selectPlugin(QStringLiteral("kontact_todoplugin")); // ensure loaded
         OrgKdeKorganizerKorganizerInterface korganizer(QStringLiteral("org.kde.korganizer"), QStringLiteral("/Korganizer"), QDBusConnection::sessionBus());
-
-        korganizer.editIncidence(QString::number(id));
+        if (mCalendar->hasRight(item, Akonadi::Collection::CanDeleteItem)) {
+            korganizer.editIncidence(QString::number(item.id()));
+        } else {
+            korganizer.showIncidence(QString::number(item.id()));
+        }
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.