~osomon/ubuntu-ui-toolkit/downloadmanager

« back to all changes in this revision

Viewing changes to modules/Ubuntu/Components/ActionItem.qml

Do not trigger a ToolbarButton that is not enabled. Fixes: https://bugs.launchpad.net/bugs/1202245.

Approved by PS Jenkins bot, Christian Dywan.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
    /*!
60
60
      Called when the actionItem is triggered.
61
61
     */
62
 
    signal triggered(var caller)
 
62
    signal triggered(var value)
63
63
 
64
64
    /*!
65
 
      If \l action is set, this will call action.trigger(caller).
 
65
      If \l action is set, this will trigger it.
66
66
    */
67
 
    onTriggered: if (action) action.triggered(caller)
 
67
    onTriggered: if (action) action.trigger(value)
 
68
 
 
69
    /*!
 
70
      Trigger this action item if it is enabled.
 
71
     */
 
72
    function trigger(value) {
 
73
        var passingValue = value ? value : null
 
74
        if (actionItem.enabled) actionItem.triggered(passingValue);
 
75
    }
68
76
}