From bcfa1981add751472f3a17dc83e39fd2ebc84814 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Tue, 20 May 2025 16:00:15 +0000 Subject: [PATCH] [PATCH] applets/notifications: Don't set a parent for WidgetsAskUserActionHandler The notification popup gets destroyed as soon as the user clicked the menu item, so the handler is destroyed (curiously still leaving the KMessageDialog up) and askUserDeleteResult is never emitted. BUG: 504385 (cherry picked from commit f81dd70a3501f1011d73128277c4aba87014c481) Co-authored-by: Kai Uwe Broulik (cherry picked from commit 7dff2f025da66873911eb1a66fbdded080c7b473) Co-authored-by: Kai Uwe Broulik Gbp-Pq: Name upstream_41a554e6_applets-notifications-Don-t-set-a-parent-for-WidgetsAskUserActionHandler.patch --- applets/notifications/filemenu.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/applets/notifications/filemenu.cpp b/applets/notifications/filemenu.cpp index 4bc06cb4..26b9c670 100644 --- a/applets/notifications/filemenu.cpp +++ b/applets/notifications/filemenu.cpp @@ -151,7 +151,8 @@ void FileMenu::open(int x, int y) const bool canTrash = itemProperties.isLocal() && itemProperties.supportsMoving(); if (canTrash) { auto moveToTrashLambda = [this] { - auto handler = new KIO::WidgetsAskUserActionHandler(this); + // No parent since the FileMenu will be destroyed as soon as the user clicked the menu item. + auto handler = new KIO::WidgetsAskUserActionHandler(); connect(handler, &KIO::WidgetsAskUserActionHandler::askUserDeleteResult, [handler](bool allow, const QList &urls) { if (allow) { auto job = KIO::trash(urls); @@ -172,7 +173,8 @@ void FileMenu::open(int x, int y) if (itemProperties.supportsDeleting() && (!canTrash || showDeleteCommand)) { auto deleteLambda = [this] { - auto handler = new KIO::WidgetsAskUserActionHandler(this); + // No parent since the FileMenu will be destroyed as soon as the user clicked the menu item. + auto handler = new KIO::WidgetsAskUserActionHandler(); connect(handler, &KIO::WidgetsAskUserActionHandler::askUserDeleteResult, [handler](bool allow, const QList &urls) { if (allow) { auto job = KIO::del(urls); -- 2.30.2