Changeset View
Changeset View
Standalone View
Standalone View
applets/taskmanager/package/contents/ui/Task.qml
Show All 25 Lines | |||||
26 | import org.kde.plasma.private.taskmanager 0.1 as TaskManagerApplet | 26 | import org.kde.plasma.private.taskmanager 0.1 as TaskManagerApplet | ||
27 | 27 | | |||
28 | import "../code/layout.js" as LayoutManager | 28 | import "../code/layout.js" as LayoutManager | ||
29 | import "../code/tools.js" as TaskTools | 29 | import "../code/tools.js" as TaskTools | ||
30 | 30 | | |||
31 | MouseArea { | 31 | MouseArea { | ||
32 | id: task | 32 | id: task | ||
33 | 33 | | |||
34 | width: groupDialog.mainItem.width | 34 | width: groupDialog.contentWidth | ||
35 | height: Math.max(theme.mSize(theme.defaultFont).height, units.iconSizes.medium) + LayoutManager.verticalMargins() | 35 | height: Math.max(theme.mSize(theme.defaultFont).height, units.iconSizes.medium) + LayoutManager.verticalMargins() | ||
36 | 36 | | |||
37 | visible: false | 37 | visible: false | ||
38 | 38 | | |||
39 | LayoutMirroring.enabled: (Qt.application.layoutDirection == Qt.RightToLeft) | 39 | LayoutMirroring.enabled: (Qt.application.layoutDirection == Qt.RightToLeft) | ||
40 | LayoutMirroring.childrenInherit: (Qt.application.layoutDirection == Qt.RightToLeft) | 40 | LayoutMirroring.childrenInherit: (Qt.application.layoutDirection == Qt.RightToLeft) | ||
41 | 41 | | |||
42 | readonly property var m: model | 42 | readonly property var m: model | ||
43 | 43 | | |||
44 | property int itemIndex: index | 44 | property int itemIndex: index | ||
45 | property bool inPopup: false | 45 | property bool inPopup: false | ||
46 | property bool isWindow: model.IsWindow === true | 46 | property bool isWindow: model.IsWindow === true | ||
47 | property int childCount: model.ChildCount != undefined ? model.ChildCount : 0 | 47 | property int childCount: model.ChildCount != undefined ? model.ChildCount : 0 | ||
48 | property int previousChildCount: 0 | 48 | property int previousChildCount: 0 | ||
49 | property alias textWidth: label.implicitWidth | 49 | property alias labelText: label.text | ||
50 | property bool pressed: false | 50 | property bool pressed: false | ||
51 | property int pressX: -1 | 51 | property int pressX: -1 | ||
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 | || (task.contextMenu && task.contextMenu.status === PlasmaComponents.DialogStatus.Open) | 59 | || (task.contextMenu && task.contextMenu.status === PlasmaComponents.DialogStatus.Open) | ||
60 | || (groupDialog.visible && groupDialog.visualParent === task) | 60 | || (groupDialog.visible && groupDialog.visualParent === task) | ||
61 | 61 | | |||
62 | acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MidButton | 62 | acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MidButton | ||
63 | 63 | | |||
64 | onIsWindowChanged: { | 64 | onIsWindowChanged: { | ||
65 | if (isWindow) { | 65 | if (isWindow) { | ||
66 | taskInitComponent.createObject(task); | 66 | taskInitComponent.createObject(task); | ||
67 | } | 67 | } | ||
68 | } | 68 | } | ||
69 | 69 | | |||
70 | onChildCountChanged: { | 70 | onChildCountChanged: { | ||
71 | if (containsMouse) { | ||||
72 | groupDialog.activeTask = null; | ||||
73 | } | ||||
74 | | ||||
71 | if (childCount > previousChildCount) { | 75 | if (childCount > previousChildCount) { | ||
72 | tasksModel.requestPublishDelegateGeometry(modelIndex(), backend.globalRect(task), task); | 76 | tasksModel.requestPublishDelegateGeometry(modelIndex(), backend.globalRect(task), task); | ||
73 | } | 77 | } | ||
74 | 78 | | |||
75 | previousChildCount = childCount; | 79 | previousChildCount = childCount; | ||
76 | } | 80 | } | ||
77 | 81 | | |||
78 | onItemIndexChanged: { | 82 | onItemIndexChanged: { | ||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | 142 | if (pressX != -1 && mouse.buttons == Qt.LeftButton && dragHelper.isDrag(pressX, pressY, mouse.x, mouse.y)) { | |||
142 | pressX = -1; | 146 | pressX = -1; | ||
143 | pressY = -1; | 147 | pressY = -1; | ||
144 | 148 | | |||
145 | return; | 149 | return; | ||
146 | } | 150 | } | ||
147 | } | 151 | } | ||
148 | 152 | | |||
149 | onWheel: { | 153 | onWheel: { | ||
150 | if (plasmoid.configuration.wheelEnabled) { | 154 | if (plasmoid.configuration.wheelEnabled && (!inPopup || !groupDialog.overflowing)) { | ||
151 | wheelDelta = TaskTools.wheelActivateNextPrevTask(task, wheelDelta, wheel.angleDelta.y); | 155 | wheelDelta = TaskTools.wheelActivateNextPrevTask(task, wheelDelta, wheel.angleDelta.y); | ||
152 | } else { | 156 | } else { | ||
153 | wheel.accepted = false; | 157 | wheel.accepted = false; | ||
154 | } | 158 | } | ||
155 | } | 159 | } | ||
156 | 160 | | |||
157 | onSmartLauncherEnabledChanged: { | 161 | onSmartLauncherEnabledChanged: { | ||
158 | if (smartLauncherEnabled && !smartLauncherItem) { | 162 | if (smartLauncherEnabled && !smartLauncherItem) { | ||
▲ Show 20 Lines • Show All 324 Lines • Show Last 20 Lines |