modifying the drawer menus

Dirk Hohndel dirk at hohndel.org
Wed Jan 6 21:49:28 UTC 2016


On Wed, Jan 06, 2016 at 10:32:59PM +0100, Marco Martin wrote:
> > > so, if it depends from pages, you just define a different
> > > contextualactions list for every page definition...
> > 
> > Currently we have one page that has two different states. You view a dive
> > or you edit a dive. Depending on that state I want different context
> > menus. Maybe what you are saying is "no, that really should've two
> > different pages". Because then this would be easy and your answer shows
> > how to do that. The challenge is that right now we do both on the same
> > pageants simply change the visibility of some elements of the page
> > depending on state. But I can't change the context menu depending on state
> > 
> > Makes sense now?
> 
> ok, understood.
> having two different pages may indeed be a solution.. depends how much code 
> duplication this leads to (in general "modes" in an ui are discouraged, but of 
> course depends case by case).
> 
> or maybe you can do something on the lines:
> 
> Page {
> 
>     proeprty var viewActions: [
>          Action {}, Action{}...
>     ]
>     proeprty var editActions: [
>          Action {}, Action{}...
>     ]
> 
>     contextualActions: editMode ? editActions : viewActions
> }

That's very close to the code that I had and it didn't work, i.e. the
context drawer always showed the first list of actions assigned. Since my
syntax was a bit different from what you show here I'll try this, just to
make sure I didn't stumble about my lack of QML skill
(that, after all, was why I asked)

Thanks

/D


More information about the Plasma-devel mailing list