WIP: Global Menu Applet
ClosedPublic

Authored by davidedmundson on Dec 16 2016, 1:33 PM.

Details

Summary

This restores the global menu applet which you can place in panel.

The applet provides two views namely Compact and Full View.
Views can be switched from applet's settings.

  • Compact View provides a single button for accessing the application's menu

  • Full View shows the full application menu in panel

ToDo
0> compact view's "Menu" button is a hack. should be a circular button with some icon...maybe ?
1> (in compact view) long pressing alt key should trigger the menu
2> (in full view) alt+key should open the relevant menu
3> the keyboard shortcut page in applet's setting is not functional
4> in compact view menu button should grey out when app menu is not available

See https://phabricator.kde.org/D3156

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
chinmoyr updated this revision to Diff 9083.Dec 16 2016, 1:33 PM
chinmoyr retitled this revision from to WIP: Global Menu Applet.
chinmoyr updated this object.
chinmoyr edited the test plan for this revision. (Show Details)
chinmoyr added reviewers: Plasma, broulik.
chinmoyr set the repository for this revision to R120 Plasma Workspace.
Restricted Application added a project: Plasma. · View Herald TranscriptDec 16 2016, 1:33 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik added inline comments.Dec 16 2016, 2:25 PM
applets/appmenu/lib/appmenuapplet.cpp
92

Somehow your indentation is a bit off?

applets/appmenu/package/contents/ui/configGeneral.qml
45

Not too happy with the naming here. The old applet just had a checkbox for "Use single button" for menu or something like that, that would also simplify the settings page a lot ;)

57

I *think* you can just in the ExclusiveGroup above bind to the "current" property:

Controls.ExclusiveGroup {
    id: representationGroup
    current: plasmoid.configuration.fullRepresentation ? fullRepresentationRadio : compactRepresentationRadio
}

or you could perhaps just bind "checked" in the RadioButtons

checked: plasmoid.configuration.fullRepresentation
applets/appmenu/package/contents/ui/main.qml
26

Can you perhaps look into making it a c++ applet rather than using a private import – we somewhat try to get away from this

38–39

Perhaps base that on font size (or just units.gridUnit)

43

I don't think this needs to be wrapped in Component

44

Also, I find it pretty cool that you just use compact and full rep for that :) I would not have thought of that

68–74
var idx = Math.max(0, Math.min(buttonRepeater.count - 1, index))

(too bad there's no qBound in QML)

78

You could just do button.clicked() which will end up executing the onClicked below instead of duplicating the logic here

89

buttonData is pretty generic of a name

Bugs from running it:

The menu doesn't immediately disappear when I focus from a window with a shared menu, to a window without. Interacting with menu still crashes.

The config option for "compact and full" is a bit unusual. The Plasma style, is to try and magically guess based on size.
What's the intended use?

Keybaord navigation left/right, doesn't move between opened menus (i.e I can't get from file to edit) in Kate

Custom applet keyboard activation doesn't do anything.

The alt+letter key activation doesn't work

Ping me on IRC, and I can take on some of those.

applets/appmenu/lib/appmenuapplet.cpp
142

It's more normal to do the bounding to the right value before you emit a signal, rather than in the signal handler in QML

Otherwise your passing bad data around, which is the sort of thing that breaks later.

160

it shouldn't do, the panel will take the event, and re-emit a new one in the applet position

applets/appmenu/package/contents/ui/main.qml
26

we somewhat try to get away from this

Why?

applets/appmenu/plugin/appmenumodel.cpp
86

If you return here you have an unmatching begin/remove

109

atoms can be cached in the ctor

applets/appmenu/plugin/appmenumodel.cpp
86

Turns out this is what was causing that kate->konsole crash.
I should have trusted my reviewing instead of spending some time in valgrind...

The UI is left without updating, but we've cleared m_activeMenu.
The model has the actions stored in this casted pointer, but because QQmlEngine doesn't know it's a QObject doesn't reset it. ::trigger uses the action object with now a dangling pointer.

Just remove this if statement, the for loop with no actions will do nothing anyway, so we're not saving any processing.

90

We can't do this!
For one thing, every 32 bit system will pad the first half of this copy with garbage.

We can either register QAction as an uncreatable QML type; or just box in QVariant<QObject*> and pass QVariant as arguments to ::trigger

chinmoyr updated this revision to Diff 9257.EditedDec 21 2016, 1:57 PM
chinmoyr updated this object.
chinmoyr marked 8 inline comments as done.

Addressed some of Kai's comments and some of David's comments.

davidedmundson commandeered this revision.Jan 5 2017, 4:36 PM
davidedmundson added a reviewer: chinmoyr.
davidedmundson added inline comments.
applets/appmenu/package/contents/ui/main.qml
52

We can go back to your previous (quite clever) use of compact/full representation, I fixed the bug we were having.

Fix compilation

Tidy appmenu representations and sizes

settingspage
it look a bit "boring" you can select single button for app menu but when I didn't select it what happens than? I would prefer instead of the checkbox all different styles and radio button to select the style the user want.

compact view
it look a bit out of place. where does the compact view and full view was shown? in the panel next to the application icon? in the window decoration? maybe have the app icon or the menu icon and than menu would be more intuitive.

  • i18n
  • Merge branch 'master' of git://anongit.kde.org/plasma-workspace
  • Change config to two exlusive radio buttons
  • don't set compact representation checked

it look a bit "boring" you can select single button for app menu but when I didn't select it what happens than? I would prefer instead of the checkbox all different styles and radio button to select the style the user want.

That's a good idea,simply because it explains what not checking it will do.

Done in the last commit (plus some other cleanups)

This revision was automatically updated to reflect the committed changes.