Changeset View
Standalone View
applets/taskmanager/package/contents/ui/Task.qml
Context not available. | |||||
74 | } | 74 | } | ||
---|---|---|---|---|---|
75 | 75 | | |||
76 | onItemIndexChanged: { | 76 | onItemIndexChanged: { | ||
77 | toolTipLoader.needsReload = true; | ||||
hein: Plasma coding style: Terminate lines in procedural blocks with semicolae.
https://community. | |||||
78 | taskRepeater.delayedReloadToolTip(); | ||||
79 | | ||||
77 | if (!inPopup && !tasks.vertical | 80 | if (!inPopup && !tasks.vertical | ||
78 | && (LayoutManager.calculateStripes() > 1 || !plasmoid.configuration.separateLaunchers)) { | 81 | && (LayoutManager.calculateStripes() > 1 || !plasmoid.configuration.separateLaunchers)) { | ||
79 | tasks.requestLayout(); | 82 | tasks.requestLayout(); | ||
Context not available. | |||||
83 | onContainsMouseChanged: { | 86 | onContainsMouseChanged: { | ||
84 | if (containsMouse) { | 87 | if (containsMouse) { | ||
85 | if (inPopup) { | 88 | if (inPopup) { | ||
86 | forceActiveFocus() | 89 | forceActiveFocus(); | ||
87 | } | 90 | } | ||
88 | } else { | 91 | } else { | ||
89 | pressed = false; | 92 | pressed = false; | ||
Context not available. | |||||
92 | if (model.IsWindow === true) { | 95 | if (model.IsWindow === true) { | ||
93 | tasks.windowsHovered(model.LegacyWinIdList, containsMouse); | 96 | tasks.windowsHovered(model.LegacyWinIdList, containsMouse); | ||
94 | } | 97 | } | ||
98 | | ||||
95 | } | 99 | } | ||
96 | 100 | | |||
97 | onPressed: { | 101 | onPressed: { | ||
Context not available. | |||||
100 | pressX = mouse.x; | 104 | pressX = mouse.x; | ||
101 | pressY = mouse.y; | 105 | pressY = mouse.y; | ||
102 | } else if (mouse.button == Qt.RightButton) { | 106 | } else if (mouse.button == Qt.RightButton) { | ||
103 | if (plasmoid.configuration.showToolTips) { | 107 | 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 | } | 108 | } | ||
109 | } | 109 | } | ||
110 | 110 | | |||
Context not available. | |||||
121 | } else if (mouse.button == Qt.LeftButton) { | 121 | } else if (mouse.button == Qt.LeftButton) { | ||
122 | TaskTools.activateTask(modelIndex(), model, mouse.modifiers, task); | 122 | TaskTools.activateTask(modelIndex(), model, mouse.modifiers, task); | ||
123 | if (plasmoid.configuration.showToolTips) { | 123 | if (plasmoid.configuration.showToolTips) { | ||
124 | toolTip.hideToolTip(); | 124 | // Hide the tooltip, but on cursor movement in mousearea show it again (after cooldown). | ||
125 | toolTipLoader.needsReload = true; | ||||
126 | toolTipLoader.reload(); | ||||
125 | } | 127 | } | ||
126 | } | 128 | } | ||
127 | } | 129 | } | ||
Context not available. | |||||
219 | }); | 221 | }); | ||
220 | } | 222 | } | ||
221 | 223 | | |||
222 | PlasmaCore.ToolTipArea { | 224 | Loader { | ||
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. | |||||
223 | id: toolTip | 225 | id: toolTipLoader | ||
224 | 226 | sourceComponent: plasmoid.configuration.showToolTips ? toolTip : undefined | |||
225 | anchors.fill: parent | 227 | anchors.fill: parent | ||
226 | 228 | | |||
227 | active: !inPopup && !groupDialog.visible && plasmoid.configuration.showToolTips | 229 | // workaround, see: https://bugreports.qt.io/browse/QTBUG-47523 | ||
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… | |||||
228 | interactive: true | 230 | // https://bugreports.qt.io/browse/QTBUG-55864 | ||
229 | location: plasmoid.location | 231 | property bool needsReload: false | ||
230 | 232 | function reload() { | |||
231 | mainItem: toolTipDelegate | 233 | if (!needsReload) { | ||
232 | 234 | return; | |||
233 | onContainsMouseChanged: { | | |||
234 | if (containsMouse) { | | |||
235 | toolTipDelegate.parentIndex = itemIndex; | | |||
236 | | ||||
237 | toolTipDelegate.windows = Qt.binding(function() { | | |||
238 | return model.LegacyWinIdList; | | |||
239 | }); | | |||
240 | toolTipDelegate.mainText = Qt.binding(function() { | | |||
241 | return model.display; | | |||
242 | }); | | |||
243 | toolTipDelegate.icon = Qt.binding(function() { | | |||
244 | return model.decoration; | | |||
245 | }); | | |||
246 | toolTipDelegate.subText = Qt.binding(function() { | | |||
247 | return model.IsLauncher === true ? model.GenericName : toolTip.generateSubText(model); | | |||
248 | }); | | |||
249 | toolTipDelegate.launcherUrl = Qt.binding(function() { | | |||
250 | return model.LauncherUrlWithoutIcon; | | |||
251 | }); | | |||
252 | } | 235 | } | ||
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… | |||||
236 | sourceComponent = undefined; | ||||
237 | sourceComponent = toolTip; | ||||
238 | needsReload = false; | ||||
253 | } | 239 | } | ||
240 | Component.onCompleted: taskRepeater.reloadToolTips.connect(reload) | ||||
241 | // | ||||
242 | // | ||||
243 | } | ||||
254 | 244 | | |||
255 | function generateSubText(task) { | 245 | Component { | ||
256 | var subTextEntries = new Array(); | 246 | id: toolTip | ||
257 | 247 | | |||
258 | if (!plasmoid.configuration.showOnlyCurrentDesktop | 248 | PlasmaCore.ToolTipArea { | ||
259 | && virtualDesktopInfo.numberOfDesktops > 1 | 249 | anchors.fill: parent | ||
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 | 250 | | |||
266 | if (model.Activities == undefined) { | 251 | active: !inPopup && !groupDialog.visible && plasmoid.configuration.showToolTips | ||
267 | return subTextEntries.join("\n"); | 252 | interactive: true | ||
268 | } | 253 | location: plasmoid.location | ||
269 | 254 | | |||
270 | if (model.Activities.length == 0 && activityInfo.numberOfRunningActivities > 1) { | 255 | mainItem: ToolTipDelegate { | ||
271 | subTextEntries.push(i18nc("Which virtual desktop a window is currently on", | 256 | id: toolTipDelegate | ||
272 | "Available on all activities")); | 257 | parentTask: task | ||
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 | } | 258 | } | ||
298 | | ||||
299 | return subTextEntries.join("\n"); | | |||
300 | } | 259 | } | ||
301 | } | 260 | } | ||
302 | } | 261 | } | ||
Context not available. |
Plasma coding style: Terminate lines in procedural blocks with semicolae.
https://community.kde.org/Plasma/QMLStyle
Please fix throughout the patch.