Changeset View
Changeset View
Standalone View
Standalone View
applet/contents/ui/Toolbar.qml
Show All 15 Lines | 1 | /* | |||
---|---|---|---|---|---|
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 QtQuick.Layouts 1.2 | ||
23 | import org.kde.plasma.components 2.0 as PlasmaComponents | 23 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
24 | import org.kde.plasma.components 3.0 as PlasmaComponents3 | ||||
24 | import org.kde.plasma.core 2.0 as PlasmaCore | 25 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
25 | import org.kde.plasma.networkmanagement 0.2 as PlasmaNM | 26 | import org.kde.plasma.networkmanagement 0.2 as PlasmaNM | ||
26 | import org.kde.kquickcontrolsaddons 2.0 | 27 | import org.kde.kquickcontrolsaddons 2.0 | ||
27 | 28 | | |||
28 | GridLayout { | 29 | GridLayout { | ||
29 | id: toolbar | 30 | id: toolbar | ||
30 | 31 | | |||
31 | function closeSearch() { | 32 | function closeSearch() { | ||
Show All 23 Lines | 55 | onWwanEnabledChanged: { | |||
55 | wwanSwitchButton.checked = wwanSwitchButton.enabled && enabled | 56 | wwanSwitchButton.checked = wwanSwitchButton.enabled && enabled | ||
56 | } | 57 | } | ||
57 | 58 | | |||
58 | onWwanHwEnabledChanged: { | 59 | onWwanHwEnabledChanged: { | ||
59 | wwanSwitchButton.enabled = enabled && availableDevices.modemDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled | 60 | wwanSwitchButton.enabled = enabled && availableDevices.modemDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled | ||
60 | } | 61 | } | ||
61 | } | 62 | } | ||
62 | 63 | | |||
64 | PlasmaNM.Configuration { | ||||
65 | id: configuration | ||||
66 | } | ||||
67 | | ||||
63 | Row { | 68 | Row { | ||
64 | Layout.fillWidth: true | 69 | Layout.fillWidth: true | ||
65 | 70 | | |||
66 | SwitchButton { | 71 | SwitchButton { | ||
67 | id: wifiSwitchButton | 72 | id: wifiSwitchButton | ||
68 | 73 | | |||
69 | checked: enabled && enabledConnections.wirelessEnabled | 74 | checked: enabled && enabledConnections.wirelessEnabled | ||
70 | enabled: enabledConnections.wirelessHwEnabled && availableDevices.wirelessDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled | 75 | enabled: enabledConnections.wirelessHwEnabled && availableDevices.wirelessDeviceAvailable && !planeModeSwitchButton.airplaneModeEnabled | ||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 122 | Component.onCompleted: { | |||
119 | initialized = true | 124 | initialized = true | ||
120 | } | 125 | } | ||
121 | } | 126 | } | ||
122 | } | 127 | } | ||
123 | 128 | | |||
124 | Row { | 129 | Row { | ||
125 | Layout.column: 1 | 130 | Layout.column: 1 | ||
126 | 131 | | |||
127 | PlasmaComponents.ToolButton { | 132 | | ||
133 | PlasmaComponents3.ToolButton { | ||||
134 | id: hotspotButton | ||||
apol: is it always prossible to create the hotspot? I'd expect it not to be possible at all sometimes… | |||||
See Component.onCompleted: { }. We make this visible based on handler.hotspotSupported, which checks NM version and whether there is available wifi card. It's done this way because it's a non-notifyable property. jgrulich: See Component.onCompleted: { }. We make this visible based on handler.hotspotSupported, which… | |||||
135 | | ||||
136 | icon { | ||||
137 | height: 16 | ||||
138 | width: 16 | ||||
139 | name: "network-wireless-on" | ||||
140 | } | ||||
141 | checkable: true | ||||
142 | text: i18n("Hotspot") | ||||
143 | visible: handler.hotspotSupported | ||||
144 | | ||||
145 | onClicked: { | ||||
146 | if (configuration.hotspotConnectionPath) { | ||||
147 | checked = false | ||||
148 | handler.stopHotspot() | ||||
149 | } else { | ||||
150 | checked = true | ||||
151 | handler.createHotspot() | ||||
152 | } | ||||
153 | } | ||||
154 | | ||||
155 | PlasmaComponents3.ToolTip { | ||||
156 | id: tooltip | ||||
157 | } | ||||
158 | | ||||
159 | Connections { | ||||
160 | target: handler | ||||
161 | onHotspotCreated: { | ||||
162 | hotspotButton.checked = true | ||||
163 | tooltip.text = i18n("Disable Hotspot") | ||||
164 | } | ||||
165 | | ||||
166 | onHotspotDisabled: { | ||||
167 | hotspotButton.checked = false | ||||
168 | tooltip.text = i18n("Create Hotspot") | ||||
169 | } | ||||
170 | } | ||||
171 | | ||||
172 | Component.onCompleted: { | ||||
173 | checked = configuration.hotspotConnectionPath | ||||
174 | tooltip.text = configuration.hotspotConnectionPath ? i18n("Disable Hotspot") : i18n("Create Hotspot") | ||||
175 | } | ||||
176 | } | ||||
177 | | ||||
178 | PlasmaComponents3.ToolButton { | ||||
128 | id: searchToggleButton | 179 | id: searchToggleButton | ||
129 | iconSource: "search" | 180 | icon { | ||
130 | tooltip: i18ndc("plasma-nm", "button tooltip", "Search the connections") | 181 | height: 16 | ||
182 | width: 16 | ||||
183 | name: "search" | ||||
184 | } | ||||
131 | checkable: true | 185 | checkable: true | ||
186 | | ||||
187 | PlasmaComponents3.ToolTip { | ||||
188 | text: i18ndc("plasma-nm", "button tooltip", "Search the connections") | ||||
189 | } | ||||
132 | } | 190 | } | ||
133 | 191 | | |||
134 | PlasmaComponents.ToolButton { | 192 | PlasmaComponents3.ToolButton { | ||
135 | id: openEditorButton | 193 | id: openEditorButton | ||
136 | iconSource: "configure" | 194 | icon { | ||
137 | tooltip: i18n("Configure network connections...") | 195 | height: 16 | ||
196 | width: 16 | ||||
197 | name: "configure" | ||||
198 | } | ||||
138 | visible: mainWindow.kcmAuthorized | 199 | visible: mainWindow.kcmAuthorized | ||
139 | 200 | | |||
201 | PlasmaComponents3.ToolTip { | ||||
202 | text: i18n("Configure network connections...") | ||||
203 | } | ||||
204 | | ||||
140 | onClicked: { | 205 | onClicked: { | ||
141 | KCMShell.open(mainWindow.kcm) | 206 | KCMShell.open(mainWindow.kcm) | ||
142 | } | 207 | } | ||
143 | } | 208 | } | ||
144 | } | 209 | } | ||
145 | 210 | | |||
146 | PlasmaComponents.TextField { | 211 | PlasmaComponents.TextField { | ||
147 | id: searchTextField | 212 | id: searchTextField | ||
Show All 32 Lines |
is it always prossible to create the hotspot? I'd expect it not to be possible at all sometimes (visible should be false then) and if the wifi is in use it might not be able to do it? (enabled false then).