modifying the drawer menus

Marco Martin notmart at gmail.com
Wed Jan 6 21:32:59 UTC 2016


On Wednesday 06 January 2016, Dirk Hohndel wrote:
> > On Jan 6, 2016, at 12:47, Marco Martin <notmart at gmail.com> wrote:
> > 
> > On Wednesday 06 January 2016, Tomaz Canabrava wrote:
> >>> hmm, not sure it answers much yet.. who is mainDisplay?
> >> 
> >> Its one of the Pages in an AplicationWindow, like the initialPage.
> >> the "current" one should give the Actions for the contextDrawer.
> > 
> > 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
}

-- 
Marco Martin


More information about the Plasma-devel mailing list