[RFC] Context-Menu Handling in KDevelop4

Andreas Pakulat apaku at gmx.de
Tue May 8 08:20:42 UTC 2007


On 08.05.07 15:18:58, dukju ahn wrote:
> 2007/5/8, Andreas Pakulat <apaku at gmx.de>:
> > On 07.05.07 14:20:19, dukju ahn wrote:
> > > 2007/4/3, Andreas Pakulat <apaku at gmx.de>:
> > > > 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.
> > >
> > > Yes. In addition, signal approach allows more dynamic contextmenu fillout.
> >
> > Its not really about signal or non-signal. Its about not handing the
> > KMenu* to the plugins, only allowing them to give a list of actions that
> > should be inserted into the menu.
> >
> > I'm not sure yet how to trigger this, but ideally I'd like to get a
> > QList<QAction*> from each plugin and eventually a QString. Then the
> > context menu will have an entry with the QString that has as a submenu
> > the list of actions.
> 
> OK. The KMenu is not handed. Anyway I think the signal approach is
> conveninent to fetch QList<QAction*>

Uhm, well not really. Having something like

Context c = ...
<add view-specific context menu, for example for projectmanagerview>
emit(c, list);

And then suddenly the list is changed is a bit too much magic for my
taste.

> I have question -- if the plugins provide just QString, how does the actions
> can be excuted? For example, ProjectManager fetched a string "commit".
> Then how ProjectManager can connect it to IBasicVC::commit() ?
> I guess providing QAction is reasonable.

You misunderstood. The QString will create a new menu entry, the same
way the subversion menu is shown in KDev3.4. Then within this new menu
entry the list of qactions of that plugin will be shown. And the
qactions need to be connected to slots of the plugin of course.

Andreas

-- 
Do something unusual today.  Pay a bill.




More information about the KDevelop-devel mailing list