Changeset View
Changeset View
Standalone View
Standalone View
applets/taskmanager/package/contents/ui/GroupDialog.qml
Show First 20 Lines • Show All 119 Lines • ▼ Show 20 Line(s) | 119 | script: { | |||
---|---|---|---|---|---|
120 | if (groupRepeater.aboutToPopulate) { | 120 | if (groupRepeater.aboutToPopulate) { | ||
121 | focusActiveTaskTimer.restart(); | 121 | focusActiveTaskTimer.restart(); | ||
122 | groupRepeater.aboutToPopulate = false; | 122 | groupRepeater.aboutToPopulate = false; | ||
123 | } | 123 | } | ||
124 | } | 124 | } | ||
125 | } | 125 | } | ||
126 | } | 126 | } | ||
127 | 127 | | |||
128 | onAnimatingChanged: { | ||||
129 | if (!animating) { | ||||
130 | updateSize(); | ||||
131 | } | ||||
132 | } | ||||
133 | | ||||
128 | Repeater { | 134 | Repeater { | ||
129 | id: groupRepeater | 135 | id: groupRepeater | ||
130 | 136 | | |||
131 | property bool aboutToPopulate: false | 137 | property bool aboutToPopulate: false | ||
132 | 138 | | |||
broulik: Unused | |||||
133 | function currentIndex() { | 139 | function currentIndex() { | ||
134 | for (var i = 0; i < count; ++i) { | 140 | for (var i = 0; i < count; ++i) { | ||
135 | if (itemAt(i).activeFocus) { | 141 | if (itemAt(i).activeFocus) { | ||
136 | return i; | 142 | return i; | ||
137 | } | 143 | } | ||
138 | } | 144 | } | ||
139 | 145 | | |||
140 | return -1; | 146 | return -1; | ||
141 | } | 147 | } | ||
142 | 148 | | |||
143 | onCountChanged: updateSize(); | 149 | onItemAdded: updateSize() | ||
150 | | ||||
151 | onItemRemoved: { | ||||
152 | if (groupDialog.visible && index > 0 && index == count) { | ||||
count will already reflect the new count here? So essentially index == count means "the last item was removed"? broulik: `count` will already reflect the new count here? So essentially `index == count` means "the… | |||||
153 | updateSize(); | ||||
154 | } | ||||
155 | } | ||||
144 | } | 156 | } | ||
145 | } | 157 | } | ||
146 | } | 158 | } | ||
147 | 159 | | |||
148 | Keys.onUpPressed: { | 160 | Keys.onUpPressed: { | ||
149 | var currentIndex = groupRepeater.currentIndex(); | 161 | var currentIndex = groupRepeater.currentIndex(); | ||
150 | // In doubt focus the last item, so we start at the bottom when user | 162 | // In doubt focus the last item, so we start at the bottom when user | ||
151 | // initially presses up. | 163 | // initially presses up. | ||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | 251 | if (!visualParent) { | |||
241 | return; | 253 | return; | ||
242 | } | 254 | } | ||
243 | 255 | | |||
244 | if (!visualParent.childCount) { | 256 | if (!visualParent.childCount) { | ||
245 | visible = false; | 257 | visible = false; | ||
246 | // Setting VisualDataModel.rootIndex drops groupRepeater.count to 0 | 258 | // Setting VisualDataModel.rootIndex drops groupRepeater.count to 0 | ||
247 | // before the actual row count. updateSize is therefore invoked twice; | 259 | // before the actual row count. updateSize is therefore invoked twice; | ||
248 | // only update size once the repeater count matches the model role. | 260 | // only update size once the repeater count matches the model role. | ||
249 | } else if (visualParent.childCount == groupRepeater.count) { | 261 | } else if (!groupRepeater.aboutToPopulate || visualParent.childCount == groupRepeater.count) { | ||
250 | var task; | 262 | var task; | ||
251 | var maxWidth = 0; | 263 | var maxWidth = 0; | ||
252 | var maxHeight = 0; | 264 | var maxHeight = 0; | ||
253 | 265 | | |||
254 | backend.cancelHighlightWindows(); | 266 | backend.cancelHighlightWindows(); | ||
255 | 267 | | |||
256 | for (var i = 0; i < taskList.children.length - 1; ++i) { | 268 | for (var i = 0; i < taskList.children.length - 1; ++i) { | ||
257 | task = taskList.children[i]; | 269 | task = taskList.children[i]; | ||
Show All 26 Lines |
Unused