diff options
| author | Felix Ernst <[email protected]> | 2024-05-11 17:16:35 +0000 |
|---|---|---|
| committer | Felix Ernst <[email protected]> | 2024-05-11 17:16:35 +0000 |
| commit | 6c60655ce246a91758f4b9035edf318cb1197a2c (patch) | |
| tree | f7b6ac7d13cbdc76a67af70765373f735ca56a27 /src/dolphinviewcontainer.h | |
| parent | 742566eb69e6bf46e7abb74e9ce9293c4b3ed7e8 (diff) | |
Add "Act as Administrator" toggle action
This commit adds an "Act as Administrator" toggle action to the
View menu if kio-admin is installed. The action allows switching
between acting as an admin with root-access or not.
This was already possible in Dolphin when kio-admin is installed by
editing the location bar directly. However this is somewhat
unintuitive and there are no warnings at all about the dangers of
acting as an administrator.
This commit adds a warning dialog when triggering the action. It is
somewhat explicit about the risks because this is in fact very
dangerous.
Furthermore, while acting on a view with administrative privileges,
a bar above the view shows up that contains a warning. The bar can
be closed to stop acting with elevated privileges.
The warning dialog can be disabled and re-enabled from the Dolphin
settings but only if the action is even available.
There is a lot more to be done to further improve this feature both
security-wise as well as when it comes to usability. But
considering that we are already encouraging users to use this
feature without any warnings at all, I feel like now is a good time
to merge this.
This work is part of a project funded through the NGI0 Entrust
Fund, a fund established by NLnet with financial support from the
European Commission's Next Generation Internet programme, under the
aegis of DG Communications Networks, Content and Technology. As
such, please contact me if you plan on doing related work so what
you are doing doesn't collide with work I am being funded to do.
Diffstat (limited to 'src/dolphinviewcontainer.h')
| -rw-r--r-- | src/dolphinviewcontainer.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h index 60c9b90d1..90df69c8e 100644 --- a/src/dolphinviewcontainer.h +++ b/src/dolphinviewcontainer.h @@ -20,6 +20,10 @@ #include <QPushButton> #include <QWidget> +namespace Admin +{ +class Bar; +} class FilterBar; class KMessageWidget; class QAction; @@ -331,6 +335,11 @@ private Q_SLOTS: */ void showItemInfo(const KFileItem &item); + /** + * Sets the Admin::Bar visible or invisible based on whether \a url is an admin url. + */ + void updateAdminBarVisibility(const QUrl &url); + void closeFilterBar(); /** @@ -447,6 +456,9 @@ private: DolphinSearchBox *m_searchBox; bool m_searchModeEnabled; + /// A bar shown at the top of the view to signify that the view is currently viewed and acted on with elevated privileges. + Admin::Bar *m_adminBar; + KMessageWidget *m_messageWidget; /// A bar shown at the top of the view to signify that selection mode is currently active. |
