[RFC] Context-Menu Handling in KDevelop4

Andreas Pakulat apaku at gmx.de
Tue Apr 3 22:55:23 UTC 2007


On 03.04.07 16:56:57, Matt Rogers wrote:
> On Apr 3, 2007, at 2:15 PM, Andreas Pakulat wrote:
> > so I finally came around to ask Adam what he meant with the comment on
> > KDevelop::MainWindow::fillContextMenu().
> >
> > His response was:
> > ,----
> > | Well, kdevelop has this notion of global context's such as 'file  
> > context'
> > |
> > | If a plugin wished to add an action to the context menu shown  
> > whenever a file
> > | is selected it would just call:
> > |
> > |         'KActionCollection *ICore::actionCollection 
> > (ICore::FileContext)'
> > |
> > | or something and retrieve the action collection for that context  
> > as denoted by
> > | some enum.  The plugin could then plug it's actions into it or  
> > something.
> > |
> > | Hadn't really thought it out.
> > `----
> 
> I prefer the actionCollection way as well. Do you have a proposed  
> patch for how it would work when writing code to use it?

No, I didn't even think about it too long. However having done so now I
see a problem here: 

A plugin can't just add actions for a Context, it needs to know the
actual url of the file (in case of a FileContext) to add the right
actions. So we'd end up with a signal again, in which case I don't see
the benefit from using the actionCollection, except that we don't allow
plugins to remove from the menu, only add new actions. 

Andreas

-- 
It's lucky you're going so slowly, because you're going in the wrong direction.




More information about the KDevelop-devel mailing list