Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/Toolbar.qml
Show All 13 Lines | 1 | /* | |||
---|---|---|---|---|---|
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | Lesser General Public License for more details. | 15 | Lesser General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU Lesser General Public | 17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | import QtQuick 2.2 | 21 | import QtQuick 2.2 | ||
22 | import QtQuick.Layouts 1.2 | ||||
22 | import org.kde.plasma.components 2.0 as PlasmaComponents | 23 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
23 | import org.kde.plasma.core 2.0 as PlasmaCore | 24 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
24 | import org.kde.plasma.networkmanagement 0.2 as PlasmaNM | 25 | import org.kde.plasma.networkmanagement 0.2 as PlasmaNM | ||
25 | import org.kde.kquickcontrolsaddons 2.0 | 26 | import org.kde.kquickcontrolsaddons 2.0 | ||
26 | 27 | | |||
27 | Item { | 28 | GridLayout { | ||
28 | id: toolbar | 29 | id: toolbar | ||
29 | 30 | | |||
30 | height: wifiSwitchButton.height | 31 | function closeSearch() { | ||
32 | searchToggleButton.checked = false | ||||
33 | } | ||||
34 | | ||||
35 | rows: 2 | ||||
36 | columns: 2 | ||||
31 | 37 | | |||
32 | PlasmaCore.Svg { | 38 | PlasmaCore.Svg { | ||
33 | id: lineSvg | 39 | id: lineSvg | ||
34 | imagePath: "widgets/line" | 40 | imagePath: "widgets/line" | ||
35 | } | 41 | } | ||
36 | 42 | | |||
37 | PlasmaNM.EnabledConnections { | 43 | PlasmaNM.EnabledConnections { | ||
38 | id: enabledConnections | 44 | id: enabledConnections | ||
Show All 11 Lines | |||||
50 | } | 56 | } | ||
51 | 57 | | |||
52 | onWwanHwEnabledChanged: { | 58 | onWwanHwEnabledChanged: { | ||
53 | wwanSwitchButton.enabled = enabled && availableDevices.modemDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled | 59 | wwanSwitchButton.enabled = enabled && availableDevices.modemDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled | ||
54 | } | 60 | } | ||
55 | } | 61 | } | ||
56 | 62 | | |||
57 | Row { | 63 | Row { | ||
58 | anchors { | 64 | Layout.fillWidth: true | ||
59 | bottom: parent.bottom | | |||
60 | left: parent.left | | |||
61 | top: parent.top | | |||
62 | } | | |||
63 | 65 | | |||
64 | SwitchButton { | 66 | SwitchButton { | ||
65 | id: wifiSwitchButton | 67 | id: wifiSwitchButton | ||
66 | 68 | | |||
67 | checked: enabled && enabledConnections.wirelessEnabled | 69 | checked: enabled && enabledConnections.wirelessEnabled | ||
68 | enabled: enabledConnections.wirelessHwEnabled && availableDevices.wirelessDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled | 70 | enabled: enabledConnections.wirelessHwEnabled && availableDevices.wirelessDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled | ||
69 | tooltip: i18n("Enable wireless") | 71 | tooltip: i18n("Enable wireless") | ||
70 | icon: enabled ? "network-wireless-on" : "network-wireless-off" | 72 | icon: enabled ? "network-wireless-on" : "network-wireless-off" | ||
Show All 35 Lines | 94 | SwitchButton { | |||
106 | Binding { | 108 | Binding { | ||
107 | target: connectionIconProvider | 109 | target: connectionIconProvider | ||
108 | property: "airplaneMode" | 110 | property: "airplaneMode" | ||
109 | value: planeModeSwitchButton.airplaneModeEnabled | 111 | value: planeModeSwitchButton.airplaneModeEnabled | ||
110 | } | 112 | } | ||
111 | } | 113 | } | ||
112 | } | 114 | } | ||
113 | 115 | | |||
114 | PlasmaComponents.ToolButton { | 116 | Row { | ||
115 | id: openEditorButton | 117 | Layout.column: 1 | ||
116 | 118 | | |||
117 | anchors { | 119 | PlasmaComponents.ToolButton { | ||
118 | right: parent.right | 120 | id: searchToggleButton | ||
119 | rightMargin: Math.round(units.gridUnit / 2) | 121 | iconSource: "search" | ||
120 | verticalCenter: parent.verticalCenter | 122 | tooltip: i18ndc("plasma-nm", "button tooltip", "Search the connections") | ||
123 | checkable: true | ||||
121 | } | 124 | } | ||
122 | 125 | | |||
126 | PlasmaComponents.ToolButton { | ||||
127 | id: openEditorButton | ||||
123 | iconSource: "configure" | 128 | iconSource: "configure" | ||
124 | tooltip: i18n("Configure network connections...") | 129 | tooltip: i18n("Configure network connections...") | ||
125 | visible: mainWindow.kcmAuthorized | 130 | visible: mainWindow.kcmAuthorized | ||
126 | 131 | | |||
127 | onClicked: { | 132 | onClicked: { | ||
128 | KCMShell.open(mainWindow.kcm) | 133 | KCMShell.open(mainWindow.kcm) | ||
129 | } | 134 | } | ||
130 | } | 135 | } | ||
131 | } | 136 | } | ||
137 | | ||||
138 | PlasmaComponents.TextField { | ||||
139 | id: searchTextField | ||||
140 | | ||||
141 | Layout.row: 1 | ||||
142 | Layout.columnSpan: 2 | ||||
143 | Layout.fillWidth: true | ||||
144 | Layout.leftMargin: units.smallSpacing | ||||
145 | Layout.rightMargin: units.smallSpacing | ||||
146 | Layout.bottomMargin: units.smallSpacing | ||||
147 | | ||||
148 | focus: true | ||||
149 | clearButtonShown: true | ||||
150 | placeholderText: i18ndc("plasma-nm", "text field placeholder text", "Search...") | ||||
151 | | ||||
152 | visible: searchToggleButton.checked | ||||
153 | onVisibleChanged: if (!visible) text = "" | ||||
154 | Keys.onEscapePressed: searchToggleButton.checked = false | ||||
155 | | ||||
156 | onTextChanged: { | ||||
157 | // Show search field when starting to type directly | ||||
158 | if (text.length && !searchToggleButton.checked) { | ||||
159 | searchToggleButton.checked = true | ||||
160 | } | ||||
161 | appletProxyModel.setFilterRegExp(text) | ||||
162 | } | ||||
163 | } | ||||
164 | } |