Enforce options_show_toolbar for QToolBar toggleViewAction
AbandonedPublic

Authored by broulik on May 19 2016, 6:15 PM.

Details

Reviewers
mart
Group Reviewers
Plasma
Summary

While KXmlGui makes sure to prevent the user from hiding toolbars when not allowed,
when right-clicking an empty space in a QMainWindow, such as the menu bar, will yield
a menu created by Qt, which knows nothing about Kiosk restrictions, listing all toolbar
toggle actions of this window.

Test Plan

I can no longer hide the main toolbar in Dolphin or Gwenview.

See comment in the code for an explanation what it actually does :)
In principle we could also think of enforcing other KAuthorized stuff here but both KXmlGui and KActionCollection take care of most of it.

How can I simulate the KAuthorized stuff for an autotest? Is there a KConfig kdeglobals test mode or something like that?

Diff Detail

Repository
R135 Integration for Qt applications in Plasma
Lint
Lint Skipped
Unit
Unit Tests Skipped
broulik updated this revision to Diff 3893.May 19 2016, 6:15 PM
broulik retitled this revision from to Enforce options_show_toolbar for QToolBar toggleViewAction.
broulik updated this object.
broulik edited the test plan for this revision. (Show Details)
broulik added a reviewer: Plasma.
broulik set the repository for this revision to R135 Integration for Qt applications in Plasma.
Restricted Application added a project: Plasma. · View Herald TranscriptMay 19 2016, 6:15 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik updated this revision to Diff 3894.May 19 2016, 6:33 PM
mart accepted this revision.May 19 2016, 8:28 PM
mart added a reviewer: mart.
This revision is now accepted and ready to land.May 19 2016, 8:28 PM

Seems messy when we we can just do:

toggleViewAction()->setEnabled(KAuthorized...)
in the KToolBar constructor

It'd fix all the cases which we're trying to fix as KIOSK only affects KDE apps.

How can I simulate the KAuthorized stuff for an autotest? Is there a KConfig kdeglobals test mode or something like that?

You don't need it in kdeglobals.
See what I did in https://git.reviewboard.kde.org/r/127948/

Note that if you have it immutable in /etc/kde5rc that will block the writeEntry. I lost half an hour trying to figure that one out.

broulik abandoned this revision.May 19 2016, 9:23 PM

Was a fancy little thing but patching KToolBar is significantly less invasive and will work for most of our apps.