Changeset View
Changeset View
Standalone View
Standalone View
applets/systemtray/package/contents/ui/items/StatusNotifierItem.qml
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 23 | AbstractItem { | |||
---|---|---|---|---|---|
72 | onContextMenu: { | 72 | onContextMenu: { | ||
73 | openContextMenu(plasmoid.nativeInterface.popupPosition(taskIcon, mouse.x, mouse.y)) | 73 | openContextMenu(plasmoid.nativeInterface.popupPosition(taskIcon, mouse.x, mouse.y)) | ||
74 | } | 74 | } | ||
75 | 75 | | |||
76 | onClicked: { | 76 | onClicked: { | ||
77 | var pos = plasmoid.nativeInterface.popupPosition(taskIcon, mouse.x, mouse.y); | 77 | var pos = plasmoid.nativeInterface.popupPosition(taskIcon, mouse.x, mouse.y); | ||
78 | 78 | | |||
79 | switch (mouse.button) { | 79 | switch (mouse.button) { | ||
80 | case Qt.LeftButton: { | 80 | case Qt.LeftButton: | ||
81 | var service = statusNotifierSource.serviceForSource(DataEngineSource); | 81 | var service = statusNotifierSource.serviceForSource(DataEngineSource); | ||
82 | var operation = service.operationDescription("Activate"); | 82 | var operation = service.operationDescription("Activate"); | ||
83 | operation.x = pos.x; | 83 | operation.x = pos.x; | ||
84 | operation.y = pos.y; | 84 | operation.y = pos.y; | ||
85 | var job = service.startOperationCall(operation); | 85 | var job = service.startOperationCall(operation); | ||
86 | job.finished.connect(function () { | 86 | job.finished.connect(function () { | ||
87 | if (!job.result) { | 87 | if (!job.result) { | ||
88 | // On error try to invoke the context menu. | 88 | // On error try to invoke the context menu. | ||
89 | // Workaround primarily for apps using libappindicator. | 89 | // Workaround primarily for apps using libappindicator. | ||
90 | openContextMenu(pos); | 90 | openContextMenu(pos); | ||
91 | } | 91 | } | ||
92 | }); | 92 | }); | ||
93 | taskIcon.activated() | 93 | taskIcon.activated() | ||
94 | break; | 94 | break; | ||
95 | } | | |||
96 | case Qt.RightButton: | 95 | case Qt.RightButton: | ||
97 | openContextMenu(pos); | 96 | openContextMenu(pos); | ||
98 | break; | 97 | break; | ||
99 | 98 | | |||
100 | case Qt.MiddleButton: | 99 | case Qt.MiddleButton: | ||
101 | var service = statusNotifierSource.serviceForSource(DataEngineSource); | 100 | var service = statusNotifierSource.serviceForSource(DataEngineSource); | ||
102 | var operation = service.operationDescription("SecondaryActivate"); | 101 | var operation = service.operationDescription("SecondaryActivate"); | ||
103 | operation.x = pos.x; | 102 | operation.x = pos.x; | ||
Show All 38 Lines |