Changeset View
Standalone View
applets/taskmanager/package/contents/ui/Task.qml
Context not available. | |||||
74 | } | 74 | } | ||
---|---|---|---|---|---|
75 | 75 | | |||
76 | onItemIndexChanged: { | 76 | onItemIndexChanged: { | ||
77 | // Part of the workaround described in toolTipLoader. When removed | ||||
hein: Plasma coding style: Terminate lines in procedural blocks with semicolae.
https://community. | |||||
78 | // we need to call toolTipLoader.hideToolTipTemporarily() instead. | ||||
79 | // Otherwise the tooltip won't hide when manually reordering tasks. | ||||
80 | toolTipLoader.needsReload = true; | ||||
81 | taskRepeater.delayedReloadToolTip(); | ||||
82 | // | ||||
83 | // | ||||
84 | | ||||
77 | if (!inPopup && !tasks.vertical | 85 | if (!inPopup && !tasks.vertical | ||
78 | && (LayoutManager.calculateStripes() > 1 || !plasmoid.configuration.separateLaunchers)) { | 86 | && (LayoutManager.calculateStripes() > 1 || !plasmoid.configuration.separateLaunchers)) { | ||
79 | tasks.requestLayout(); | 87 | tasks.requestLayout(); | ||
Context not available. | |||||
83 | onContainsMouseChanged: { | 91 | onContainsMouseChanged: { | ||
84 | if (containsMouse) { | 92 | if (containsMouse) { | ||
85 | if (inPopup) { | 93 | if (inPopup) { | ||
86 | forceActiveFocus() | 94 | forceActiveFocus(); | ||
87 | } | 95 | } | ||
88 | } else { | 96 | } else { | ||
89 | pressed = false; | 97 | pressed = false; | ||
Context not available. | |||||
92 | if (model.IsWindow === true) { | 100 | if (model.IsWindow === true) { | ||
93 | tasks.windowsHovered(model.LegacyWinIdList, containsMouse); | 101 | tasks.windowsHovered(model.LegacyWinIdList, containsMouse); | ||
94 | } | 102 | } | ||
103 | | ||||
95 | } | 104 | } | ||
96 | 105 | | |||
97 | onPressed: { | 106 | onPressed: { | ||
Context not available. | |||||
100 | pressX = mouse.x; | 109 | pressX = mouse.x; | ||
101 | pressY = mouse.y; | 110 | pressY = mouse.y; | ||
102 | } else if (mouse.button == Qt.RightButton) { | 111 | } else if (mouse.button == Qt.RightButton) { | ||
103 | if (plasmoid.configuration.showToolTips) { | 112 | 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 | } | 113 | } | ||
109 | } | 114 | } | ||
110 | 115 | | |||
Context not available. | |||||
121 | } else if (mouse.button == Qt.LeftButton) { | 126 | } else if (mouse.button == Qt.LeftButton) { | ||
122 | TaskTools.activateTask(modelIndex(), model, mouse.modifiers, task); | 127 | TaskTools.activateTask(modelIndex(), model, mouse.modifiers, task); | ||
123 | if (plasmoid.configuration.showToolTips) { | 128 | if (plasmoid.configuration.showToolTips) { | ||
124 | toolTip.hideToolTip(); | 129 | // Hide the tooltip, but on cursor movement in mousearea show it again (with cooldown). | ||
130 | toolTipLoader.hideToolTipTemporarily(); | ||||
125 | } | 131 | } | ||
126 | } | 132 | } | ||
127 | } | 133 | } | ||
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. | |||||
Context not available. | |||||
219 | }); | 225 | }); | ||
220 | } | 226 | } | ||
221 | 227 | | |||
222 | PlasmaCore.ToolTipArea { | 228 | Loader { | ||
223 | id: toolTip | 229 | id: toolTipLoader | ||
224 | 230 | sourceComponent: plasmoid.configuration.showToolTips ? toolTip : undefined | |||
225 | anchors.fill: parent | 231 | anchors.fill: parent | ||
226 | 232 | | |||
227 | active: !inPopup && !groupDialog.visible && plasmoid.configuration.showToolTips | 233 | function hideToolTipTemporarily() { | ||
228 | interactive: true | 234 | active = false; | ||
229 | location: plasmoid.location | 235 | active = true; | ||
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… | |||||
230 | 236 | } | |||
231 | mainItem: toolTipDelegate | 237 | | ||
232 | 238 | // Workaround, see: https://bugreports.qt.io/browse/QTBUG-47523 | |||
233 | onContainsMouseChanged: { | 239 | // https://bugreports.qt.io/browse/QTBUG-55864 | ||
234 | if (containsMouse) { | 240 | // | ||
235 | toolTipDelegate.parentIndex = itemIndex; | 241 | // In DelegateModel the submodel index is currently not updating | ||
236 | 242 | // correctly, when the parent index is changed, which means that | |||
237 | toolTipDelegate.windows = Qt.binding(function() { | 243 | // on reordering of the root tasks grouped tasks might show the | ||
238 | return model.LegacyWinIdList; | 244 | // content of the tasks, which were previously listed under this | ||
239 | }); | 245 | // parent index. | ||
240 | toolTipDelegate.mainText = Qt.binding(function() { | 246 | // In order to solve this issue until DelegateModel is fixed | ||
241 | return model.display; | 247 | // upstream, we reinstinate every (also without group, since they | ||
242 | }); | 248 | // can get a group and would crash then) tooltip with a slight | ||
243 | toolTipDelegate.icon = Qt.binding(function() { | 249 | // delay (see taskRepeater.delayedReloadToolTip()) if its parent | ||
244 | return model.decoration; | 250 | // index was changed. | ||
245 | }); | 251 | // | ||
246 | toolTipDelegate.subText = Qt.binding(function() { | 252 | property bool needsReload: false | ||
247 | return model.IsLauncher === true ? model.GenericName : toolTip.generateSubText(model); | 253 | function reload() { | ||
248 | }); | 254 | if (!needsReload) { | ||
249 | toolTipDelegate.launcherUrl = Qt.binding(function() { | 255 | needsReload = false; | ||
250 | return model.LauncherUrlWithoutIcon; | 256 | return; | ||
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… | |||||
251 | }); | | |||
252 | } | 257 | } | ||
258 | active = false; | ||||
259 | active = true; | ||||
260 | needsReload = false; | ||||
253 | } | 261 | } | ||
262 | Component.onCompleted: taskRepeater.reloadToolTips.connect(reload) | ||||
263 | // | ||||
264 | // | ||||
265 | } | ||||
254 | 266 | | |||
255 | function generateSubText(task) { | 267 | Component { | ||
256 | var subTextEntries = new Array(); | 268 | id: toolTip | ||
257 | 269 | | |||
258 | if (!plasmoid.configuration.showOnlyCurrentDesktop | 270 | PlasmaCore.ToolTipArea { | ||
259 | && virtualDesktopInfo.numberOfDesktops > 1 | 271 | 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 | 272 | | |||
266 | if (model.Activities == undefined) { | 273 | active: !inPopup && !groupDialog.visible && plasmoid.configuration.showToolTips | ||
267 | return subTextEntries.join("\n"); | 274 | interactive: true | ||
268 | } | 275 | location: plasmoid.location | ||
269 | 276 | | |||
270 | if (model.Activities.length == 0 && activityInfo.numberOfRunningActivities > 1) { | 277 | mainItem: ToolTipDelegate { | ||
271 | subTextEntries.push(i18nc("Which virtual desktop a window is currently on", | 278 | id: toolTipDelegate | ||
272 | "Available on all activities")); | 279 | 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 | } | 280 | } | ||
298 | | ||||
299 | return subTextEntries.join("\n"); | | |||
300 | } | 281 | } | ||
301 | } | 282 | } | ||
302 | } | 283 | } | ||
Context not available. |
Plasma coding style: Terminate lines in procedural blocks with semicolae.
https://community.kde.org/Plasma/QMLStyle
Please fix throughout the patch.