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

List:       kde-devel
Subject:    Re: KActionMenu and XMLGUI
From:       munehiro <munehiro () ferrara ! linux ! it>
Date:       2002-11-07 21:01:25
[Download RAW message or body]

On Thu, Nov 07, 2002 at 11:15:36AM +0100, Björn Sahlström wrote:
> <MenuBar>
> 	<Menu noMerge="1" name="file">
> 		<text>&amp;File</text>
> 		<Menu name="sub_menu">
> 			<Action name="action1"/>
> 		</Menu>
> 	</Menu>
> </MenuBar>
> 
> I think you need to create the KActionMenu "sub_menu" in the same way as all 
> your other actions., but the insertion is automated.

nope. i don't want to create a KActionMenu sub_menu. i want the standard
file_new action become a submenu with actions in it, actions that i want to plug
from xml.

an extract from ui_standards.rc

    <Action name="file_new"/>
    <Action name="file_open"/>
    <Action name="file_open_recent"/>
    <MergeLocal name="new_merge"/>

my file menu should have "file_new" stdaction and "file_open" stdaction.
Since i can create with new a lot of things, New must have a subpopup
with the items i could create.

First solution: i accept your suggestion, drop every attempt to handle
the standard action file_new, place an append="new_merge" and thus obtain,
in my file menu, first the Open action, then the New action, implemented as
sub_menu. This is what i don't want.
Second solution: i use the standard action file_new, trick and move it
to a menu instead of a simple KAction.

here are what i tried before:

code

    KStdAction::openNew(0L, 0L, actionCollection());
    new KAction("action_a",0,this,SLOT(slotActionA()),actionCollection(),"new_action_a");

xml

<!DOCTYPE kpartgui>
<kpartgui>
 <MenuBar>
  <Menu name="file">
   <Menu name="file_new"><text>&New</text>
    <Action name="new_action_a" />
   </Menu>
  </Menu>
 </MenuBar>
</kpartgui>

result: The new icon is plugged in the file menu and in the toolbar. Pressing it does
nothing. Follow the open, save, saveas, close action and then an option which produces
a submenu named "New" with "action_a" in it.

------

code:

    KActionMenu *m = new KActionMenu("New","filenew",actionCollection(),"file_new");
    m->insert(new KAction("new_action_a",0,this,SLOT(slotActionA()),actionCollection(),"new_action_a"));

xml:

none

result: _exactly_ what i need: an icon with the white paper, in the right place (just over
the open stdaction) which has a subpopup with new_action_a in it. Also, the toolbar has the same
icon which, once clicked, pops up the same option.

problem: i don't want to plug the action new_action_a by hand with m->insert().
i want to do it using the xml file.

thanks
 
>> 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