Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/Toolbar.qml
Context not available. | |||||
26 | import org.kde.plasma.networkmanagement 0.2 as PlasmaNM | 26 | import org.kde.plasma.networkmanagement 0.2 as PlasmaNM | ||
---|---|---|---|---|---|
27 | import org.kde.kquickcontrolsaddons 2.0 | 27 | import org.kde.kquickcontrolsaddons 2.0 | ||
28 | 28 | | |||
29 | GridLayout { | 29 | ColumnLayout { | ||
30 | id: toolbar | 30 | | ||
31 | property var displayWifiMessage: !wifiSwitchButton.checked && wifiSwitchButton.visible | ||||
32 | property var displayWwanMessage: !wwanSwitchButton.checked && wwanSwitchButton.visible | ||||
33 | property var displayplaneModeMessage: planeModeSwitchButton.checked && planeModeSwitchButton.visible | ||||
34 | | ||||
35 | spacing: units.smallSpacing | ||||
31 | 36 | | |||
32 | function closeSearch() { | 37 | function closeSearch() { | ||
33 | searchToggleButton.checked = false | 38 | searchToggleButton.checked = false | ||
34 | } | 39 | } | ||
35 | 40 | | |||
36 | rows: 2 | 41 | PlasmaCore.Svg { | ||
37 | columns: 2 | 42 | id: lineSvg | ||
43 | imagePath: "widgets/line" | ||||
44 | } | ||||
38 | 45 | | |||
39 | PlasmaNM.EnabledConnections { | 46 | PlasmaNM.EnabledConnections { | ||
40 | id: enabledConnections | 47 | id: enabledConnections | ||
Context not available. | |||||
60 | id: configuration | 67 | id: configuration | ||
61 | } | 68 | } | ||
62 | 69 | | |||
63 | Row { | 70 | PlasmaComponents.TextField { | ||
71 | id: searchTextField | ||||
72 | | ||||
64 | Layout.fillWidth: true | 73 | Layout.fillWidth: true | ||
74 | Layout.leftMargin: units.smallSpacing | ||||
75 | Layout.rightMargin: units.smallSpacing | ||||
76 | Layout.bottomMargin: units.smallSpacing | ||||
77 | Layout.topMargin: units.smallSpacing | ||||
78 | | ||||
79 | focus: true | ||||
80 | clearButtonShown: true | ||||
81 | placeholderText: i18ndc("plasma-nm", "text field placeholder text", "Search...") | ||||
82 | | ||||
83 | visible: searchToggleButton.checked | ||||
84 | onVisibleChanged: { | ||||
85 | if (visible) { | ||||
86 | searchTextField.forceActiveFocus() | ||||
87 | } else { | ||||
88 | text = "" | ||||
89 | } | ||||
90 | } | ||||
91 | Keys.onEscapePressed: { | ||||
92 | //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. | ||||
93 | if (searchToggleButton.checked) { | ||||
94 | searchToggleButton.checked = false; | ||||
95 | } else { | ||||
96 | event.accepted = false; | ||||
97 | } | ||||
98 | } | ||||
99 | | ||||
100 | onTextChanged: { | ||||
101 | // Show search field when starting to type directly | ||||
102 | if (text.length && !searchToggleButton.checked) { | ||||
103 | searchToggleButton.checked = true | ||||
104 | } | ||||
105 | appletProxyModel.setFilterRegExp(text) | ||||
106 | } | ||||
107 | } | ||||
108 | | ||||
109 | PlasmaCore.SvgItem { | ||||
110 | id: devicesLine | ||||
111 | | ||||
112 | Layout.fillWidth: true | ||||
113 | elementId: "horizontal-line" | ||||
114 | Layout.leftMargin: - units.smallSpacing * 1.5 | ||||
115 | Layout.rightMargin: - units.smallSpacing * 1.5 | ||||
116 | svg: lineSvg | ||||
117 | } | ||||
118 | | ||||
119 | RowLayout { | ||||
65 | 120 | | |||
66 | SwitchButton { | 121 | SwitchButton { | ||
67 | id: wifiSwitchButton | 122 | id: wifiSwitchButton | ||
Context not available. | |||||
119 | initialized = true | 174 | initialized = true | ||
120 | } | 175 | } | ||
121 | } | 176 | } | ||
122 | } | | |||
123 | | ||||
124 | Row { | | |||
125 | Layout.column: 1 | | |||
126 | 177 | | |||
178 | Item { | ||||
179 | Layout.fillWidth: true | ||||
180 | } | ||||
127 | 181 | | |||
128 | PlasmaComponents3.ToolButton { | 182 | PlasmaComponents3.ToolButton { | ||
129 | id: hotspotButton | 183 | id: hotspotButton | ||
Context not available. | |||||
203 | } | 257 | } | ||
204 | } | 258 | } | ||
205 | 259 | | |||
206 | PlasmaComponents.TextField { | | |||
207 | id: searchTextField | | |||
208 | 260 | | |||
209 | Layout.row: 1 | | |||
210 | Layout.columnSpan: 2 | | |||
211 | Layout.fillWidth: true | | |||
212 | Layout.leftMargin: units.smallSpacing | | |||
213 | Layout.rightMargin: units.smallSpacing | | |||
214 | Layout.bottomMargin: units.smallSpacing | | |||
215 | | ||||
216 | focus: true | | |||
217 | clearButtonShown: true | | |||
218 | placeholderText: i18ndc("plasma-nm", "text field placeholder text", "Search...") | | |||
219 | | ||||
220 | visible: searchToggleButton.checked | | |||
221 | onVisibleChanged: { | | |||
222 | if (visible) { | | |||
223 | searchTextField.forceActiveFocus() | | |||
224 | } else { | | |||
225 | text = "" | | |||
226 | } | | |||
227 | } | | |||
228 | Keys.onEscapePressed: { | | |||
229 | //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. | | |||
230 | if (searchToggleButton.checked) { | | |||
231 | searchToggleButton.checked = false; | | |||
232 | } else { | | |||
233 | event.accepted = false; | | |||
234 | } | | |||
235 | } | | |||
236 | | ||||
237 | onTextChanged: { | | |||
238 | // Show search field when starting to type directly | | |||
239 | if (text.length && !searchToggleButton.checked) { | | |||
240 | searchToggleButton.checked = true | | |||
241 | } | | |||
242 | appletProxyModel.setFilterRegExp(text) | | |||
243 | } | | |||
244 | } | | |||
245 | } | 261 | } | ||
Context not available. |