From 19fdc5b67990bb75009a1fc511619bd449d559d7 Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Sat, 13 Jul 2024 15:37:31 +0000 Subject: Stop acting as admin when the authorization expires Previously, the authorization just silently expired without any visible change. The surprise only came when the user tried to do any action, which immediately would show a password prompt. We don't want users to randomly type passwords into password prompts unexpectedly showing up. This commit avoids that. With this change, the view container visibly de-escalates privileges and shows a message explaining what happened. A method was implemented in kio-admin to make this possible. See: https://commits.kde.org/kio-admin/a2da29289d12ef845e2c1da17ed04c59f1c47762 This commit also improves some logic around the responsibility of hiding bars and activating view containers. This is also part of my project funded by the European Commission. --- src/admin/workerintegration.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/admin/workerintegration.h') diff --git a/src/admin/workerintegration.h b/src/admin/workerintegration.h index 0c87c2ecf..19cc5c172 100644 --- a/src/admin/workerintegration.h +++ b/src/admin/workerintegration.h @@ -57,11 +57,6 @@ public: */ static void createActAsAdminAction(KActionCollection *actionCollection, DolphinMainWindow *dolphinMainWindow); - /** - * Triggers the m_actAsAdminAction only if it is currently checked. - */ - static void exitAdminMode(); - private: WorkerIntegration(DolphinMainWindow *parent, QAction *actAsAdminAction); @@ -74,9 +69,14 @@ private: /** Updates the toggled/checked state of the action depending on the state of the currently active view. */ static void updateActAsAdminAction(); + /** Used by the friend class Bar to show the m_actAsAdminAction to users. */ + static QAction *actAsAdminAction(); + private: /** @see createActAsAdminAction() */ QAction *const m_actAsAdminAction = nullptr; + + friend class Bar; // Allows the bar to access the actAsAdminAction, so users can use the bar to change who they are acting as. }; } -- cgit v1.3