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

List:       kde-devel
Subject:    Re: Renaming XML-GUI menus on the fly?
From:       Jeroen Wijnhout <Jeroen.Wijnhout () kdemail ! net>
Date:       2004-02-29 12:25:31
Message-ID: 200402291325.32396.Jeroen.Wijnhout () kdemail ! net
[Download RAW message or body]

On Sunday 29 February 2004 13:02, Ben Burton wrote:
> Hi.  So I'm wondering: is there any way of renaming an XML-GUI menu on
> the fly?
>
> In the .rc file, the menu has a fairly generic name and is filled with
> some fairly generic actions.  Throughout the lifetime of hte program,
> the menu has more specific actions plugged and unplugged that depend on
> context, and I'd like to be able to rename the menu to something more
> specific when it happens (mainly to alert the user to the fact that some
> more context-specific options have become available).
>
> However, I can't find any way of doing this.  All I have to go on is the
> menu name, as in <Menu name="foo">.  The furthest I got was using
> menuBar->child(name) to get a handle on the KPopupMenu, but I still
> can't seem to rename it - I appear to need the popup menu's ID in the
> parent menubar, which I can't get directly from the KPopupMenu*.

I use something like this to get the menu-ID:
	int id;
	for (uint i=0; i < menuBar()->count(); i++)
	{
		id = menuBar()->idAt(i);
		text = menuBar()->text(id);
		if ( text == i18n("MenuName") )
		{
			//found!
		}
	}

If you know a better way, let me know.

best,
Jeroen

-- 
Kile - an Integrated LaTeX Environment for KDE
http://kile.sourceforge.net
 
>> 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