Contour/Active global context menus

Marco Martin notmart at gmail.com
Wed May 25 00:12:55 CEST 2011


Hi all,

from the mock up in contour of context menus specific to a certain type of 
resource, we are using this design to have context menus anywhere whe show 
items linked to any nepomuk resource.

the goal is:
* having everywhere, in any Plasma widget the same delegate for resources, so 
the exact same representation, dependent to the type of the resource.

* is possible to do a set of actions on each resource, some actions common to 
every resource, some dependent from the resource type

* a common context menu, that is the same when invoked from any applet, and 
shows the exact same set of actions everywhere

what can the actions be?
some common could be
* rate
* add tag
* (dis)associate to the current activity

others can depend from share-like-connect

so, we did  two similar plugin systems, that both for the resource delegates 
and for the menu items themselves can load qml files which path can depend 
from the resource type (and from the action name, for menu actions, since the 
rate widget will have to be different from a simple text entry)

now, from where the actions come?
right now there is an hardcoded qml ListModel for each resource type that 
lists them, but this isn't an optimal solution for sure.

the actions come from dataengine services, so what is needed for an action is:
* the localized display name of the action
* which dataengine is from
* which source is the service
* which service operation is

if the service operation parameters are different than the simple resource 
url, i didn't find other solutions than having to provide a different item 
specific for the action that calls the service with the proper parameters
(see plasma-mobile/bindings/mobilecomponents/menuitems/rateItem.qml)

the dataengines that would support those kind of actions would be basically 2:
metadata (and derivatives) and what will be share-like-connect

so, instead of an hardcoded model, i am thinking to show the list of actions 
as a data source of metadata (and slc when it will exist),
so we would have:
ActionsForResource:(nepomuk url), with keys like
   * "rate"  hash(name->i18n("rate"), operation->"rate")
   * "addToCurrentActivity" hash(name->i18n("add to the current activity"), 
operation->"addToCurrentActivity")

the context menu would show those actions coming from the two dataengines, as 
possible operations get added to the dataengines they will all get available 
everywhere

a part that i would really need feedback, is how to generate that action list, 
a way can be from the dataengines as described, but i feel there can be still 
room for improvement.
suggestions? comments?

Cheers, 
Marco Martin


More information about the Active mailing list