Changeset View
Changeset View
Standalone View
Standalone View
applets/kicker/package/contents/ui/ItemListView.qml
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | 58 | Timer { | |||
---|---|---|---|---|---|
64 | repeat: false | 64 | repeat: false | ||
65 | 65 | | |||
66 | onTriggered: { | 66 | onTriggered: { | ||
67 | if (!plasmoid.expanded || model == undefined || currentIndex == -1) { | 67 | if (!plasmoid.expanded || model == undefined || currentIndex == -1) { | ||
68 | return; | 68 | return; | ||
69 | } | 69 | } | ||
70 | 70 | | |||
71 | if (childDialog != null) { | 71 | if (childDialog != null) { | ||
72 | childDialog.visible = false; | | |||
73 | childDialog.delayedDestroy(); | 72 | childDialog.delayedDestroy(); | ||
74 | } | 73 | } | ||
75 | 74 | | |||
76 | windowSystem.monitorWindowFocus(itemList); | 75 | // Gets reenabled after the dialog spawn causes a focus-in on the dialog window. | ||
77 | | ||||
78 | // Gets reenabled after the dialog spawn causes a focus out on this window. | | |||
79 | // This avoids Kicker closing due to unreliable timing making Dialog::focusOutEvent() | | |||
80 | // unable to tell focus moved to a child window. | | |||
81 | plasmoid.hideOnWindowDeactivate = false; | 76 | plasmoid.hideOnWindowDeactivate = false; | ||
82 | 77 | | |||
83 | childDialog = itemListDialogComponent.createObject(itemList); | 78 | childDialog = itemListDialogComponent.createObject(itemList); | ||
84 | childDialog.focusParent = itemList; | 79 | childDialog.focusParent = itemList; | ||
85 | childDialog.visualParent = listView.currentItem; | 80 | childDialog.visualParent = listView.currentItem; | ||
86 | childDialog.model = model.modelForRow(listView.currentIndex); | 81 | childDialog.model = model.modelForRow(listView.currentIndex); | ||
87 | childDialog.visible = true; | 82 | childDialog.visible = true; | ||
88 | 83 | | |||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Line(s) | 157 | onCurrentIndexChanged: { | |||
163 | if (currentIndex != -1) { | 158 | if (currentIndex != -1) { | ||
164 | itemList.forceActiveFocus(); | 159 | itemList.forceActiveFocus(); | ||
165 | 160 | | |||
166 | if (childDialog) { | 161 | if (childDialog) { | ||
167 | if (currentItem && currentItem.hasChildren) { | 162 | if (currentItem && currentItem.hasChildren) { | ||
168 | childDialog.model = model.modelForRow(currentIndex); | 163 | childDialog.model = model.modelForRow(currentIndex); | ||
169 | childDialog.visualParent = listView.currentItem; | 164 | childDialog.visualParent = listView.currentItem; | ||
170 | } else { | 165 | } else { | ||
171 | childDialog.visible = false; | | |||
172 | childDialog.delayedDestroy(); | 166 | childDialog.delayedDestroy(); | ||
173 | } | 167 | } | ||
174 | 168 | | |||
175 | return; | 169 | return; | ||
176 | } | 170 | } | ||
177 | 171 | | |||
178 | if (currentItem == null || !currentItem.hasChildren || !plasmoid.expanded) { | 172 | if (currentItem == null || !currentItem.hasChildren || !plasmoid.expanded) { | ||
179 | dialogSpawnTimer.stop(); | 173 | dialogSpawnTimer.stop(); | ||
180 | 174 | | |||
181 | return; | 175 | return; | ||
182 | } | 176 | } | ||
183 | 177 | | |||
184 | if (showChildDialogs) { | 178 | if (showChildDialogs) { | ||
185 | dialogSpawnTimer.focusOnSpawn = false; | 179 | dialogSpawnTimer.focusOnSpawn = false; | ||
186 | dialogSpawnTimer.restart(); | 180 | dialogSpawnTimer.restart(); | ||
187 | } | 181 | } | ||
188 | } else if (childDialog != null) { | 182 | } else if (childDialog != null) { | ||
189 | childDialog.visible = false; | | |||
190 | childDialog.delayedDestroy(); | 183 | childDialog.delayedDestroy(); | ||
191 | childDialog = null; | 184 | childDialog = null; | ||
192 | } | 185 | } | ||
193 | } | 186 | } | ||
194 | 187 | | |||
195 | onCurrentItemChanged: { | 188 | onCurrentItemChanged: { | ||
196 | if (currentItem) { | 189 | if (currentItem) { | ||
197 | currentItem.menu.closed.connect(resetIndexTimer.restart); | 190 | currentItem.menu.closed.connect(resetIndexTimer.restart); | ||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 243 | } else if (event.text != "") { | |||
251 | appendSearchText(event.text); | 244 | appendSearchText(event.text); | ||
252 | } | 245 | } | ||
253 | } | 246 | } | ||
254 | } | 247 | } | ||
255 | } | 248 | } | ||
256 | } | 249 | } | ||
257 | 250 | | |||
258 | Component.onCompleted: { | 251 | Component.onCompleted: { | ||
252 | windowSystem.monitorWindowFocus(itemList); | ||||
253 | | ||||
259 | if (dialog == null) { | 254 | if (dialog == null) { | ||
260 | appendSearchText.connect(root.appendSearchText); | 255 | appendSearchText.connect(root.appendSearchText); | ||
261 | } | 256 | } | ||
262 | } | 257 | } | ||
263 | } | 258 | } |