From kde-devel Sat Jul 07 00:21:04 2012 From: "Lamarque V. Souza" Date: Sat, 07 Jul 2012 00:21:04 +0000 To: kde-devel Subject: Re: Question about the shutdown dialog's reboot list implementation Message-Id: <201207062121.04130.lamarque () kde ! org> X-MARC-Message: https://marc.info/?l=kde-devel&m=134175477615659 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0817412145967881004==" --===============0817412145967881004== Content-Type: multipart/alternative; boundary="Boundary-01=_wD49P5r1E4rArz5" Content-Transfer-Encoding: 7bit --Boundary-01=_wD49P5r1E4rArz5 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Em Friday 06 July 2012, Konstantinos Smanis escreveu: > On Sat, Jul 7, 2012 at 1:02 AM, Lamarque V. Souza wrote: > > Em Friday 06 July 2012, Konstantinos Smanis escreveu: > >> Hi, > > > > Hi, > > > >> I am working on a patch for bug #297209 > >> > >> (https://bugs.kde.org/show_bug.cgi?id=297209) and couldn't help but > >> > >> notice that since the Shutdown Dialog was QMLified, the code that > >> > >> shows the reboot list (when long-clicking the Reboot button) has been > >> > >> moved in the QML code of the theme > >> > >> > >> (http://lxr.kde.org/source/kde/kde-workspace/ksmserver/themes/default/ma > >> in. > >> > >> qml#319), which means that every theme should duplicate this code. I > >> have a > >> > >> proper fix for the above mentioned bug written in C++ (generate a > >> > >> proper QMenu with submenus) which applies perfectly on the 4.8 branch > >> > >> (which is C++ only), so I was thinking maybe generate the menu in the > >> > >> C++ part of the code and pass it on to the QML theme? Being a total > >> > >> QML newbie I don't know if that's possible, plus after a quick search > >> > >> I can't figure out how to implement submenus for the context menu in > >> > >> QML (it uses a custom ContextMenu component). > >> > >> > >> > >> I wouldn't like to dig in QML just for this and I think it makes more > >> > >> sense if the list was centrally generated and not in every theme. > >> > >> Still, if the code should reside in the theme, I would appreciate any > >> > >> pointers as to how implement submenus in the context menu. > > > > I am the one that implemented the QML shutdown menu. I moved the code > > that creates the reboot menu to QML to give the possibility to create > > different QML themes that do not necessarily need to handle all the > > options ksmserver implements or to show the reboot entries using any QML > > component available (not necessarily a menu). > > > > > > > > It's not possible to use QMenu (or other QWidgets subclasses) in QML as > > far as I know. I think we can implement submenus in the default theme > > (in QML). For a quick fix you can try passing the correct grub index to > > the rebootOptions context variable (this must be done in > > shutdowndlg.cpp) and then assign it to variable itemData["itemIndex"] in > > main.qml. That should make it select the correct boot option. The menu > > will still be linear (without submenus), we can fix that later. > > > > > > > > -- > > > > Lamarque V. Souza > > > > KDE's Network Management maintainer > > > > http://planetkde.org/pt-br > > It already works fine without even touching the ksmserver stuff (my > only modifications are in kdm's parsing) but it looks quite ugly > without submenus: http://i50.tinypic.com/96bw35.png > In the screenshot above, the root menu should only contain 4 items, > the second of which should be a submenu. > > As I mentioned, I have already implemented the transformation from a > linear list to a menu with levels, but it is in C++ if that's going to > be of any help at all. > > PS: The 'nested test' submenu in the screenshot is in fact 'ne&sted > test' in the config file (for my testing purposes). I guess the > ampersand is erroneously treated as an accelerator while it shouldn't. > Needs to be fixed as well. Ok, so it's a GUI only problem now. I need to figure out how to create submenus with the custom contextmenu component or use the one from kde-runtime if it supports submenus. -- Lamarque V. Souza KDE's Network Management maintainer http://planetkde.org/pt-br --Boundary-01=_wD49P5r1E4rArz5 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 7bit

Em Friday 06 July 2012, Konstantinos Smanis escreveu:

> On Sat, Jul 7, 2012 at 1:02 AM, Lamarque V. Souza <lamarque@kde.org> wrote:

> > Em Friday 06 July 2012, Konstantinos Smanis escreveu:

> >> Hi,

> >

> > Hi,

> >

> >> I am working on a patch for bug #297209

> >>

> >> (https://bugs.kde.org/show_bug.cgi?id=297209) and couldn't help but

> >>

> >> notice that since the Shutdown Dialog was QMLified, the code that

> >>

> >> shows the reboot list (when long-clicking the Reboot button) has been

> >>

> >> moved in the QML code of the theme

> >>

> >>

> >> (http://lxr.kde.org/source/kde/kde-workspace/ksmserver/themes/default/ma

> >> in.

> >>

> >> qml#319), which means that every theme should duplicate this code. I

> >> have a

> >>

> >> proper fix for the above mentioned bug written in C++ (generate a

> >>

> >> proper QMenu with submenus) which applies perfectly on the 4.8 branch

> >>

> >> (which is C++ only), so I was thinking maybe generate the menu in the

> >>

> >> C++ part of the code and pass it on to the QML theme? Being a total

> >>

> >> QML newbie I don't know if that's possible, plus after a quick search

> >>

> >> I can't figure out how to implement submenus for the context menu in

> >>

> >> QML (it uses a custom ContextMenu component).

> >>

> >>

> >>

> >> I wouldn't like to dig in QML just for this and I think it makes more

> >>

> >> sense if the list was centrally generated and not in every theme.

> >>

> >> Still, if the code should reside in the theme, I would appreciate any

> >>

> >> pointers as to how implement submenus in the context menu.

> >

> > I am the one that implemented the QML shutdown menu. I moved the code

> > that creates the reboot menu to QML to give the possibility to create

> > different QML themes that do not necessarily need to handle all the

> > options ksmserver implements or to show the reboot entries using any QML

> > component available (not necessarily a menu).

> >

> >

> >

> > It's not possible to use QMenu (or other QWidgets subclasses) in QML as

> > far as I know. I think we can implement submenus in the default theme

> > (in QML). For a quick fix you can try passing the correct grub index to

> > the rebootOptions context variable (this must be done in

> > shutdowndlg.cpp) and then assign it to variable itemData["itemIndex"] in

> > main.qml. That should make it select the correct boot option. The menu

> > will still be linear (without submenus), we can fix that later.

> >

> >

> >

> > --

> >

> > Lamarque V. Souza

> >

> > KDE's Network Management maintainer

> >

> > http://planetkde.org/pt-br

>

> It already works fine without even touching the ksmserver stuff (my

> only modifications are in kdm's parsing) but it looks quite ugly

> without submenus: http://i50.tinypic.com/96bw35.png

> In the screenshot above, the root menu should only contain 4 items,

> the second of which should be a submenu.

>

> As I mentioned, I have already implemented the transformation from a

> linear list to a menu with levels, but it is in C++ if that's going to

> be of any help at all.

>

> PS: The 'nested test' submenu in the screenshot is in fact 'ne&sted

> test' in the config file (for my testing purposes). I guess the

> ampersand is erroneously treated as an accelerator while it shouldn't.

> Needs to be fixed as well.

 

Ok, so it's a GUI only problem now. I need to figure out how to create submenus with the custom contextmenu component or use the one from kde-runtime if it supports submenus.

 

--

Lamarque V. Souza

KDE's Network Management maintainer

http://planetkde.org/pt-br

--Boundary-01=_wD49P5r1E4rArz5-- --===============0817412145967881004== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --===============0817412145967881004==--