[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Question about the shutdown dialog's reboot list implementation
From:       "Lamarque V. Souza" <lamarque () kde ! org>
Date:       2012-07-06 22:02:05
Message-ID: 201207061902.05811.lamarque () kde ! org
[Download RAW message or body]

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/main.
> 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

[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" \
"http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" \
content="1" /><style type="text/css"> p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Tahoma'; font-size:12pt; font-weight:400; \
font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Em Friday \
06 July 2012, Konstantinos Smanis escreveu:</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">&gt; Hi,</p> <p style="-qt-paragraph-type:empty; \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; ">&nbsp;</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">	Hi,</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;"> </p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">&gt; I am working on a patch for bug #297209</p> \
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; \
(https://bugs.kde.org/show_bug.cgi?id=297209) and couldn't help but</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; notice that since the \
Shutdown Dialog was QMLified, the code that</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">&gt; shows the reboot list (when long-clicking \
the Reboot button) has been</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">&gt; moved in the QML code of the theme</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; \
(http://lxr.kde.org/source/kde/kde-workspace/ksmserver/themes/default/main.</p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; qml#319), which means \
that every theme should duplicate this code. I have a</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">&gt; proper fix for the above mentioned bug \
written in C++ (generate a</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">&gt; proper QMenu with submenus) which applies perfectly on the \
4.8 branch</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; (which \
is C++ only), so I was thinking maybe generate the menu in the</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; C++ part of the code and \
pass it on to the QML theme? Being a total</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">&gt; QML newbie I don't know if that's possible, \
plus after a quick search</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">&gt; I can't figure out how to implement submenus for the context \
menu in</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; QML \
(it uses a custom ContextMenu component).</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">&gt; </p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">&gt; I wouldn't like to dig in QML just for this \
and I think it makes more</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">&gt; sense if the list was centrally generated and not in every \
theme.</p> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; Still, \
if the code should reside in the theme, I would appreciate any</p> <p style=" \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; -qt-user-state:0;">&gt; pointers as to how \
implement submenus in the context menu.</p> <p style="-qt-paragraph-type:empty; \
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; ">&nbsp;</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">	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).</p> <p style="-qt-paragraph-type:empty; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; ">&nbsp;</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">	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[&quot;itemIndex&quot;] 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.</p> <p style="-qt-paragraph-type:empty; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; ">&nbsp;</p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">-- </p> <p style=" margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">Lamarque V. Souza</p> <p style=" margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;">KDE's Network Management maintainer</p> <p \
style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; \
-qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;">http://planetkde.org/pt-br</p></body></html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic