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

List:       kde-devel
Subject:    Re: KStdActions. How to  add to...
From:       Kurt Granroth <granroth () suse ! com>
Date:       2001-10-11 21:27:06
[Download RAW message or body]

On Thursday 11 October 2001 01:46 pm, John Gluck wrote:
> However I see no way to add / replace an item to a dropdown menu. For
> example, if in the File menu I want to add somefthing Munch so that I would
> click File->Munch to do something specail to a file.
> It appears that all the standard stuff is kind of hard coded.

Okay, quick explanation of XML-GUI and standards:

Before the XML-GUI code starts building your menus and toolbars, it
searches for all the necessary XML resource (rc) files.  In the case of
non-Kparts apps, there are two that it looks for: the global one and your
local one.

The global rc file implements the KDE Style Guide.  It has place-holders
for every standard action.  If a standard action isn't instantiated, then
it's placeholder is simply ignored.

The XML-GUI code will take this global file and MERGE it with your local
one.  It's not an append or replace.. it's a merge.  So if your local rc
file has additional actions, it will merge them into the global tree
dynamically.

The global file can be found in $KDEDIR/share/config/ui/ui_standards.rc.
If you look in it, you'll see that the standard File menu is called "file"
(logically enough).  If you want your Munch action to appear in this
menu, you simply have to create your local XML rc file to look something
like this:

<MenuBar>
  <Menu name="file">
    <Action name="my_munch_action" />
  </Menu>
</MenuBar>

The XML-GUI code will take care of merging this into the global tree.

-- 
Kurt Granroth            | http://www.granroth.org
KDE Developer/Evangelist | SuSE Labs Open Source Developer
granroth@kde.org         | granroth@suse.com
            KDE -- Conquer Your Desktop 
 
>> 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