[RFC] Context-Menu Handling in KDevelop4

Andreas Pakulat apaku at gmx.de
Tue May 8 16:03:54 UTC 2007


On 08.05.07 10:17:50, Matt Rogers wrote:
> I still prefer the use of the actionCollection to hold plugin  
> actions, because we're not dealing with a menu, we're dealing with a  
> set of actions that could be represents in many ways for a GUI. We'd  
> still have a context, of course, because some actions just won't  
> apply in some cases. So, now for some very high level psuedo-code:
> 
> for all the currently loaded plugins
>    call actionCollection( const Context& context ) to retrieve an  
> action collection
>    merge just returned action collection into main action collection
> for loop done

The only thing that I can't see at the moment is how to call this from a
plugins view. But I can sort that out once I'm at that point :)

Out of the top of my head I think the above code would be in
plugincontroller or mainwindow and be triggered like so:

pluginA (the one where the right-click occured):
create context with necessary information (for example filename, editor
postion and so on)
call plugincontroller/mainwindow function with the context which gathers the
information and creates the action collection
create the menu on the ac and show it (as you already said).

> Is this approach feasible?

Yes.

Andreas

-- 
Caution: Keep out of reach of children.




More information about the KDevelop-devel mailing list