Changeset View
Changeset View
Standalone View
Standalone View
lookandfeel/contents/runcommand/RunCommand.qml
Show All 26 Lines | 26 | ColumnLayout { | |||
---|---|---|---|---|---|
27 | id: root | 27 | id: root | ||
28 | property string query | 28 | property string query | ||
29 | property string runner | 29 | property string runner | ||
30 | property bool showHistory: false | 30 | property bool showHistory: false | ||
31 | 31 | | |||
32 | LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft | 32 | LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft | ||
33 | LayoutMirroring.childrenInherit: true | 33 | LayoutMirroring.childrenInherit: true | ||
34 | 34 | | |||
35 | onQueryChanged: { | 35 | function onQueryChanged() { | ||
36 | queryField.text = query; | 36 | queryField.text = query; | ||
37 | } | 37 | } | ||
38 | 38 | | |||
39 | Connections { | 39 | Connections { | ||
40 | target: runnerWindow | 40 | target: runnerWindow | ||
41 | onVisibleChanged: { | 41 | function onVisibleChanged() { | ||
42 | if (runnerWindow.visible) { | 42 | if (runnerWindow.visible) { | ||
43 | queryField.forceActiveFocus(); | 43 | queryField.forceActiveFocus(); | ||
44 | listView.currentIndex = -1 | 44 | listView.currentIndex = -1 | ||
45 | } else { | 45 | } else { | ||
46 | root.query = ""; | 46 | root.query = ""; | ||
47 | root.runner = "" | 47 | root.runner = "" | ||
48 | root.showHistory = false | 48 | root.showHistory = false | ||
49 | } | 49 | } | ||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 117 | if (length === 0) { | |||
118 | root.showHistory = true; | 118 | root.showHistory = true; | ||
119 | listView.forceActiveFocus(); | 119 | listView.forceActiveFocus(); | ||
120 | } else if (results.count > 0) { | 120 | } else if (results.count > 0) { | ||
121 | results.forceActiveFocus(); | 121 | results.forceActiveFocus(); | ||
122 | results.incrementCurrentIndex(); | 122 | results.incrementCurrentIndex(); | ||
123 | } | 123 | } | ||
124 | } | 124 | } | ||
125 | 125 | | |||
126 | onTextChanged: { | 126 | function onTextChanged() { | ||
127 | root.query = queryField.text | 127 | root.query = queryField.text | ||
128 | if (allowCompletion && length > 0) { | 128 | if (allowCompletion && length > 0) { | ||
129 | var history = runnerWindow.history | 129 | var history = runnerWindow.history | ||
130 | 130 | | |||
131 | // search the first item in the history rather than the shortest matching one | 131 | // search the first item in the history rather than the shortest matching one | ||
132 | // this way more recently used entries take precedence over older ones (Bug 358985) | 132 | // this way more recently used entries take precedence over older ones (Bug 358985) | ||
133 | for (var i = 0, j = history.length; i < j; ++i) { | 133 | for (var i = 0, j = history.length; i < j; ++i) { | ||
134 | var item = history[i] | 134 | var item = history[i] | ||
▲ Show 20 Lines • Show All 125 Lines • ▼ Show 20 Line(s) | 257 | delegate: Milou.ResultDelegate { | |||
260 | typeText: index === 0 ? i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Recent Queries") : "" | 260 | typeText: index === 0 ? i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Recent Queries") : "" | ||
261 | additionalActions: [{ | 261 | additionalActions: [{ | ||
262 | icon: "list-remove", | 262 | icon: "list-remove", | ||
263 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Remove") | 263 | text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Remove") | ||
264 | }] | 264 | }] | ||
265 | Accessible.description: i18n("in category recent queries") | 265 | Accessible.description: i18n("in category recent queries") | ||
266 | } | 266 | } | ||
267 | 267 | | |||
268 | onActiveFocusChanged: { | 268 | function onActiveFocusChanged() { | ||
269 | if (!activeFocus && currentIndex == listView.count-1) { | 269 | if (!activeFocus && currentIndex == listView.count-1) { | ||
270 | currentIndex = 0; | 270 | currentIndex = 0; | ||
271 | } | 271 | } | ||
272 | } | 272 | } | ||
273 | Keys.onReturnPressed: runCurrentIndex(event) | 273 | Keys.onReturnPressed: runCurrentIndex(event) | ||
274 | Keys.onEnterPressed: runCurrentIndex(event) | 274 | Keys.onEnterPressed: runCurrentIndex(event) | ||
275 | 275 | | |||
276 | Keys.onTabPressed: { | 276 | Keys.onTabPressed: { | ||
▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines |