Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/Toolbar.qml
Show First 20 Lines • Show All 217 Lines • ▼ Show 20 Line(s) | 211 | PlasmaComponents.TextField { | |||
---|---|---|---|---|---|
218 | Layout.rightMargin: units.smallSpacing | 218 | Layout.rightMargin: units.smallSpacing | ||
219 | Layout.bottomMargin: units.smallSpacing | 219 | Layout.bottomMargin: units.smallSpacing | ||
220 | 220 | | |||
221 | focus: true | 221 | focus: true | ||
222 | clearButtonShown: true | 222 | clearButtonShown: true | ||
223 | placeholderText: i18ndc("plasma-nm", "text field placeholder text", "Search...") | 223 | placeholderText: i18ndc("plasma-nm", "text field placeholder text", "Search...") | ||
224 | 224 | | |||
225 | visible: searchToggleButton.checked | 225 | visible: searchToggleButton.checked | ||
226 | onVisibleChanged: if (!visible) text = "" | 226 | onVisibleChanged: { | ||
227 | if (visible) { | ||||
228 | searchTextField.forceActiveFocus() | ||||
229 | } else { | ||||
230 | text = "" | ||||
231 | } | ||||
232 | } | ||||
227 | Keys.onEscapePressed: { | 233 | Keys.onEscapePressed: { | ||
228 | //Check if the searchbar is actually visible before accepting the escape key. Otherwise, the escape key cannot dismiss the applet until one interacts with some other element. | 234 | //Check if the searchbar is actually visible before accepting the escape key. Otherwise, the escape key cannot dismiss the applet until one interacts with some other element. | ||
229 | if (searchToggleButton.checked) { | 235 | if (searchToggleButton.checked) { | ||
230 | searchToggleButton.checked = false; | 236 | searchToggleButton.checked = false; | ||
231 | } else { | 237 | } else { | ||
232 | event.accepted = false; | 238 | event.accepted = false; | ||
233 | } | 239 | } | ||
234 | } | 240 | } | ||
Show All 10 Lines |