[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Should <Menu> be a KActionMenu
From: Benjamin Meyer <icefox () mediaone ! net>
Date: 2002-01-31 15:06:43
[Download RAW message or body]
Someone please point the out if any of this is wrong. (see previous post on
needing more documentation in KAction, etc)
To have a menu that is partially static and partially dynamic ( my example
being in my im client there is a menu that lists away messages. Users can
add and remove away messages from this list as will is that dynamic part and
the static part is an action to add new messages. ) you can not layout this
menu using xmlui and KActions. Currently the only way to do it is to make an
action (that is a KActionMenu) and fill it in manually within the code of the
app.
I have been able to come up with 2 ways to get access to a menu and using the
ui.rc The first is a call to the guiFactory, which will return a KPopupMenu
for example: (KPopupMenu *)guiFactory()->container("away_menu", this); This
solution allows you to use the ui.rc file to manage the menu, but doesn't
allow you to add/remove KActions to the menu, only normal KPopupMenu stuff.
The second is to create a KActionMenu in place of the entire submenu in the
ui.rc file and within the code creat all of the KAction's (for that menu) and
manually enter them into said KActionMenu. You have control of where the
menu goes via the ui.rc file, but not control the placement of the items in
the menu in the ui.rc file.
From what I can gather when the ui.rc file is parsed it doesn't make
KActionMenu's, but in fact just makes KPopupMenu's where a <Menu> tag is
inserted.
<sidenote>
This is confusing coming from a developer point of view where you would
expect the opposite of that (i.e. having a KActionMenu generated that you can
access). Personally it took me forever to figure out how to set an icon for
a menu because I thought I was suppost to do it in the ActionProperties and
not in the Menu tag itself (<Menu name="foo" icon="bar">). It then took me
most of today to figure out that KActionMenu's weren't even being used.
</sidenote>
Am I wrong to think that we should have createGUI() use KActionMenu's and not
KPopupMenu's?
If this change was made either the createGUI() would dynamicly add
KActionMenu's to the actionCollection() or the developer would have to add
any KActionMenu's to the actionCollection() before calling createGUI() just
as they now add KAction's.
If everyone thinks that this is a bad idea we should at least put a note in
the KActionMenu stating that it is not what is used by the xmlui for <Menu>.
-Benjamin Meyer
P.S. Another thing that I thought of is that unless you have <Menu> be a
KActionMenu there is no way to disable the popupmenu.
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic