Changeset View
Standalone View
applets/taskmanager/package/contents/ui/Task.qml
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 31 | MouseArea { | |||
---|---|---|---|---|---|
52 | property int pressY: -1 | 52 | property int pressY: -1 | ||
53 | property QtObject contextMenu: null | 53 | property QtObject contextMenu: null | ||
54 | property int wheelDelta: 0 | 54 | property int wheelDelta: 0 | ||
55 | readonly property bool smartLauncherEnabled: plasmoid.configuration.smartLaunchersEnabled && !inPopup && model.IsStartup !== true | 55 | readonly property bool smartLauncherEnabled: plasmoid.configuration.smartLaunchersEnabled && !inPopup && model.IsStartup !== true | ||
56 | property QtObject smartLauncherItem: null | 56 | property QtObject smartLauncherItem: null | ||
57 | 57 | | |||
58 | readonly property bool highlighted: (inPopup && activeFocus) || (!inPopup && containsMouse) | 58 | readonly property bool highlighted: (inPopup && activeFocus) || (!inPopup && containsMouse) | ||
59 | 59 | | |||
60 | function hideToolTipTemporarily() { | ||||
61 | toolTipArea.hideToolTip(); | ||||
62 | } | ||||
63 | | ||||
60 | acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MidButton | 64 | acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MidButton | ||
61 | 65 | | |||
62 | onIsWindowChanged: { | 66 | onIsWindowChanged: { | ||
63 | if (isWindow) { | 67 | if (isWindow) { | ||
64 | taskInitComponent.createObject(task); | 68 | taskInitComponent.createObject(task); | ||
65 | } | 69 | } | ||
66 | } | 70 | } | ||
67 | 71 | | |||
68 | onChildCountChanged: { | 72 | onChildCountChanged: { | ||
69 | if (childCount > previousChildCount) { | 73 | if (childCount > previousChildCount) { | ||
70 | tasksModel.requestPublishDelegateGeometry(modelIndex(), backend.globalRect(task), task); | 74 | tasksModel.requestPublishDelegateGeometry(modelIndex(), backend.globalRect(task), task); | ||
71 | } | 75 | } | ||
72 | 76 | | |||
73 | previousChildCount = childCount; | 77 | previousChildCount = childCount; | ||
hein: Plasma coding style: Terminate lines in procedural blocks with semicolae.
https://community. | |||||
74 | } | 78 | } | ||
75 | 79 | | |||
76 | onItemIndexChanged: { | 80 | onItemIndexChanged: { | ||
81 | hideToolTipTemporarily(); | ||||
82 | | ||||
77 | if (!inPopup && !tasks.vertical | 83 | if (!inPopup && !tasks.vertical | ||
78 | && (LayoutManager.calculateStripes() > 1 || !plasmoid.configuration.separateLaunchers)) { | 84 | && (LayoutManager.calculateStripes() > 1 || !plasmoid.configuration.separateLaunchers)) { | ||
79 | tasks.requestLayout(); | 85 | tasks.requestLayout(); | ||
80 | } | 86 | } | ||
81 | } | 87 | } | ||
82 | 88 | | |||
83 | onContainsMouseChanged: { | 89 | onContainsMouseChanged: { | ||
84 | if (containsMouse) { | 90 | if (containsMouse) { | ||
85 | if (inPopup) { | 91 | if (inPopup) { | ||
86 | forceActiveFocus() | 92 | forceActiveFocus(); | ||
87 | } | 93 | } | ||
88 | } else { | 94 | } else { | ||
89 | pressed = false; | 95 | pressed = false; | ||
90 | } | 96 | } | ||
91 | 97 | | |||
92 | if (model.IsWindow === true) { | 98 | if (model.IsWindow === true) { | ||
93 | tasks.windowsHovered(model.LegacyWinIdList, containsMouse); | 99 | tasks.windowsHovered(model.LegacyWinIdList, containsMouse); | ||
94 | } | 100 | } | ||
101 | | ||||
95 | } | 102 | } | ||
96 | 103 | | |||
97 | onPressed: { | 104 | onPressed: { | ||
98 | if (mouse.button == Qt.LeftButton || mouse.button == Qt.MidButton) { | 105 | if (mouse.button == Qt.LeftButton || mouse.button == Qt.MidButton) { | ||
99 | pressed = true; | 106 | pressed = true; | ||
100 | pressX = mouse.x; | 107 | pressX = mouse.x; | ||
101 | pressY = mouse.y; | 108 | pressY = mouse.y; | ||
102 | } else if (mouse.button == Qt.RightButton) { | 109 | } else if (mouse.button == Qt.RightButton) { | ||
103 | if (plasmoid.configuration.showToolTips) { | 110 | tasks.createContextMenu(task, modelIndex()).show(); | ||
Why did you remove the tooltip hiding? See also https://phabricator.kde.org/D3916 btw hein: Why did you remove the tooltip hiding?
See also https://phabricator.kde.org/D3916 btw | |||||
When the context menu is opened, it requests focus and the tooltip area loses mouse over, which results anyway in hiding the tooltip. The hideToolTip() call is unnecessary therefore. D3916 only concerns left click. Since it was created after I created this diff, it wasn't yet integrated. romangg: When the context menu is opened, it requests focus and the tooltip area loses mouse over, which… | |||||
104 | toolTip.hideToolTip(); | | |||
105 | } | | |||
106 | | ||||
107 | tasks.createContextMenu(task).show(); | | |||
108 | } | 111 | } | ||
109 | } | 112 | } | ||
110 | 113 | | |||
111 | onReleased: { | 114 | onReleased: { | ||
112 | if (pressed) { | 115 | if (pressed) { | ||
113 | if (mouse.button == Qt.MidButton) { | 116 | if (mouse.button == Qt.MidButton) { | ||
114 | if (plasmoid.configuration.middleClickAction == TaskManagerApplet.Backend.NewInstance) { | 117 | if (plasmoid.configuration.middleClickAction == TaskManagerApplet.Backend.NewInstance) { | ||
115 | tasksModel.requestNewInstance(modelIndex()); | 118 | tasksModel.requestNewInstance(modelIndex()); | ||
116 | } else if (plasmoid.configuration.middleClickAction == TaskManagerApplet.Backend.Close) { | 119 | } else if (plasmoid.configuration.middleClickAction == TaskManagerApplet.Backend.Close) { | ||
117 | tasksModel.requestClose(modelIndex()); | 120 | tasksModel.requestClose(modelIndex()); | ||
118 | } else if (plasmoid.configuration.middleClickAction == TaskManagerApplet.Backend.ToggleMinimized) { | 121 | } else if (plasmoid.configuration.middleClickAction == TaskManagerApplet.Backend.ToggleMinimized) { | ||
119 | tasksModel.requestToggleMinimized(modelIndex()); | 122 | tasksModel.requestToggleMinimized(modelIndex()); | ||
120 | } | 123 | } | ||
121 | } else if (mouse.button == Qt.LeftButton) { | 124 | } else if (mouse.button == Qt.LeftButton) { | ||
122 | TaskTools.activateTask(modelIndex(), model, mouse.modifiers, task); | 125 | TaskTools.activateTask(modelIndex(), model, mouse.modifiers, task); | ||
123 | if (plasmoid.configuration.showToolTips) { | 126 | if (plasmoid.configuration.showToolTips) { | ||
124 | toolTip.hideToolTip(); | 127 | hideToolTipTemporarily(); | ||
125 | } | 128 | } | ||
126 | } | 129 | } | ||
127 | } | 130 | } | ||
128 | 131 | | |||
129 | pressed = false; | 132 | pressed = false; | ||
130 | pressX = -1; | 133 | pressX = -1; | ||
131 | pressY = -1; | 134 | pressY = -1; | ||
132 | } | 135 | } | ||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | 202 | PlasmaCore.FrameSvgItem { | |||
213 | prefix: TaskTools.taskPrefix(basePrefix) | 216 | prefix: TaskTools.taskPrefix(basePrefix) | ||
214 | onRepaintNeeded: updatePrefix() | 217 | onRepaintNeeded: updatePrefix() | ||
215 | 218 | | |||
216 | function updatePrefix() { | 219 | function updatePrefix() { | ||
217 | prefix = Qt.binding(function() { | 220 | prefix = Qt.binding(function() { | ||
218 | return TaskTools.taskPrefix(basePrefix); | 221 | return TaskTools.taskPrefix(basePrefix); | ||
219 | }); | 222 | }); | ||
220 | } | 223 | } | ||
221 | 224 | | |||
I know we talked about this, but this approach strikes me as weird. A component is something to be instanciated; reloading the sourceComponent value seems wrong since that's not about a particular instance, and any problem you may have with the index would be related to a particular instance. You may want to reinstanciate the component, but why reset the component? hein: I know we talked about this, but this approach strikes me as weird. A component is something to… | |||||
How would reinstating look in contrast to undefining the sourceComponent and then setting it back to the component? romangg: How would reinstating look in contrast to undefining the sourceComponent and then setting it… | |||||
hein: Cycling the 'active' prop. | |||||
225 | | ||||
222 | PlasmaCore.ToolTipArea { | 226 | PlasmaCore.ToolTipArea { | ||
223 | id: toolTip | 227 | id: toolTipArea | ||
224 | 228 | | |||
225 | anchors.fill: parent | 229 | anchors.fill: parent | ||
Can you flesh this out a bit more and explain exactly what situation (as it pertains specifically to our UI) breaks without the workaround? This at the very least needs to be cleaned up / fixed at a later date if it can't be now, and whoever does this will need a testcase description so they know their changed code satisfies the requirements. hein: Can you flesh this out a bit more and explain exactly what situation (as it pertains… | |||||
230 | location: plasmoid.location | ||||
226 | 231 | | |||
227 | active: !inPopup && !groupDialog.visible && plasmoid.configuration.showToolTips | 232 | active: !inPopup && !groupDialog.visible && plasmoid.configuration.showToolTips | ||
228 | interactive: true | 233 | interactive: true | ||
229 | location: plasmoid.location | | |||
230 | 234 | | |||
231 | mainItem: toolTipDelegate | 235 | mainItem: toolTipDelegate | ||
Bad coding style / bad coupling: Referencing a non-generic name outside the delegate ... now this delegate only works right if there's a taskRepeater outside somewhere. hein: Bad coding style / bad coupling: Referencing a non-generic name outside the delegate ... now… | |||||
This is also part of the workaround hack and therefore hopefully only temporary until the Qt bug is fixed. romangg: This is also part of the workaround hack and therefore hopefully only temporary until the Qt… | |||||
232 | 236 | | |||
233 | onContainsMouseChanged: { | 237 | onContainsMouseChanged: { | ||
234 | if (containsMouse) { | 238 | if (containsMouse) { | ||
239 | toolTipDelegate.parentTask = task; | ||||
235 | toolTipDelegate.parentIndex = itemIndex; | 240 | toolTipDelegate.parentIndex = itemIndex; | ||
236 | 241 | | |||
242 | toolTipDelegate.appName = Qt.binding(function() { | ||||
243 | return model.AppName; | ||||
244 | }); | ||||
245 | toolTipDelegate.pidParent = Qt.binding(function() { | ||||
246 | return model.AppPid; | ||||
247 | }); | ||||
237 | toolTipDelegate.windows = Qt.binding(function() { | 248 | toolTipDelegate.windows = Qt.binding(function() { | ||
238 | return model.LegacyWinIdList; | 249 | return model.LegacyWinIdList; | ||
239 | }); | 250 | }); | ||
240 | toolTipDelegate.mainText = Qt.binding(function() { | 251 | toolTipDelegate.isGroup = Qt.binding(function() { | ||
241 | return model.display; | 252 | return model.IsGroupParent == true; | ||
242 | }); | 253 | }); | ||
243 | toolTipDelegate.icon = Qt.binding(function() { | 254 | toolTipDelegate.icon = Qt.binding(function() { | ||
244 | return model.decoration; | 255 | return model.decoration; | ||
245 | }); | 256 | }); | ||
246 | toolTipDelegate.subText = Qt.binding(function() { | | |||
247 | return model.IsLauncher === true ? model.GenericName : toolTip.generateSubText(model); | | |||
248 | }); | | |||
249 | toolTipDelegate.launcherUrl = Qt.binding(function() { | 257 | toolTipDelegate.launcherUrl = Qt.binding(function() { | ||
250 | return model.LauncherUrlWithoutIcon; | 258 | return model.LauncherUrlWithoutIcon; | ||
251 | }); | 259 | }); | ||
260 | toolTipDelegate.isLauncher = Qt.binding(function() { | ||||
261 | return model.IsLauncher == true; | ||||
262 | }); | ||||
263 | toolTipDelegate.isMinimizedParent = Qt.binding(function() { | ||||
264 | return model.IsMinimized == true; | ||||
265 | }); | ||||
266 | toolTipDelegate.displayParent = Qt.binding(function() { | ||||
267 | return model.display; | ||||
268 | }); | ||||
269 | toolTipDelegate.genericName = Qt.binding(function() { | ||||
270 | return model.GenericName; | ||||
271 | }); | ||||
272 | toolTipDelegate.virtualDesktopParent = Qt.binding(function() { | ||||
273 | return model.VirtualDesktop != undefined ? model.VirtualDesktop : 0; | ||||
274 | }); | ||||
275 | toolTipDelegate.isOnAllVirtualDesktopsParent = Qt.binding(function() { | ||||
276 | return model.IsOnAllVirtualDesktops == true; | ||||
277 | }); | ||||
278 | toolTipDelegate.activitiesParent = Qt.binding(function() { | ||||
279 | return model.Activities; | ||||
280 | }); | ||||
252 | } | 281 | } | ||
253 | } | 282 | } | ||
254 | | ||||
255 | function generateSubText(task) { | | |||
256 | var subTextEntries = new Array(); | | |||
257 | | ||||
258 | if (!plasmoid.configuration.showOnlyCurrentDesktop | | |||
259 | && virtualDesktopInfo.numberOfDesktops > 1 | | |||
260 | && model.IsOnAllVirtualDesktops !== true | | |||
261 | && model.VirtualDesktop != -1 | | |||
262 | && model.VirtualDesktop != undefined) { | | |||
263 | subTextEntries.push(i18n("On %1", virtualDesktopInfo.desktopNames[model.VirtualDesktop - 1])); | | |||
264 | } | | |||
265 | | ||||
266 | if (model.Activities == undefined) { | | |||
267 | return subTextEntries.join("\n"); | | |||
268 | } | | |||
269 | | ||||
270 | if (model.Activities.length == 0 && activityInfo.numberOfRunningActivities > 1) { | | |||
271 | subTextEntries.push(i18nc("Which virtual desktop a window is currently on", | | |||
272 | "Available on all activities")); | | |||
273 | } else if (model.Activities.length > 0) { | | |||
274 | var activityNames = new Array(); | | |||
275 | | ||||
276 | for (var i = 0; i < model.Activities.length; i++) { | | |||
277 | var activity = model.Activities[i]; | | |||
278 | | ||||
279 | if (plasmoid.configuration.showOnlyCurrentActivity) { | | |||
280 | if (activity != activityInfo.currentActivity) { | | |||
281 | activityNames.push(activityInfo.activityName(model.Activities[i])); | | |||
282 | } | | |||
283 | } else if (activity != activityInfo.currentActivity) { | | |||
284 | activityNames.push(activityInfo.activityName(model.Activities[i])); | | |||
285 | } | | |||
286 | } | | |||
287 | | ||||
288 | if (plasmoid.configuration.showOnlyCurrentActivity) { | | |||
289 | if (activityNames.length > 0) { | | |||
290 | subTextEntries.push(i18nc("Activities a window is currently on (apart from the current one)", | | |||
291 | "Also available on %1", activityNames.join(", "))); | | |||
292 | } | | |||
293 | } else if (activityNames.length > 0) { | | |||
294 | subTextEntries.push(i18nc("Which activities a window is currently on", | | |||
295 | "Available on %1", activityNames.join(", "))); | | |||
296 | } | | |||
297 | } | | |||
298 | | ||||
299 | return subTextEntries.join("\n"); | | |||
300 | } | | |||
301 | } | 283 | } | ||
302 | } | 284 | } | ||
303 | 285 | | |||
304 | Loader { | 286 | Loader { | ||
305 | anchors.fill: frame | 287 | anchors.fill: frame | ||
306 | asynchronous: true | 288 | asynchronous: true | ||
307 | source: "TaskProgressOverlay.qml" | 289 | source: "TaskProgressOverlay.qml" | ||
308 | active: plasmoid.configuration.smartLaunchersEnabled && task.smartLauncherItem && task.smartLauncherItem.progressVisible | 290 | active: plasmoid.configuration.smartLaunchersEnabled && task.smartLauncherItem && task.smartLauncherItem.progressVisible | ||
▲ Show 20 Lines • Show All 172 Lines • Show Last 20 Lines |
Plasma coding style: Terminate lines in procedural blocks with semicolae.
https://community.kde.org/Plasma/QMLStyle
Please fix throughout the patch.