~ken-vandine/ubuntu-system-settings/1_3_deprecations

« back to all changes in this revision

Viewing changes to plugins/hotspot/HotspotSetup.qml

  • Committer: Ken VanDine
  • Date: 2015-08-21 14:03:29 UTC
  • mfrom: (1496.3.4 ubuntu-system-settings)
  • Revision ID: ken.vandine@canonical.com-20150821140329-o0b6eco9cwe9zfio
merged trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
                    target: confirmButton
133
133
                    enabled: false
134
134
                }
 
135
                PropertyChanges {
 
136
                    target: enableWifiCaption
 
137
                    visible: false
 
138
                }
135
139
            }
136
140
        ]
137
141
 
208
212
                }
209
213
            }
210
214
 
 
215
            ListItem.Caption {
 
216
                id: enableWifiCaption
 
217
                anchors {
 
218
                    left: parent.left
 
219
                    right: parent.right
 
220
                }
 
221
                text: i18n.tr("In order to create a hotspot, you need to turn Wi-Fi on.")
 
222
                visible: !Connectivity.wifiEnabled && !hotspotSetupDialog.stored
 
223
            }
 
224
 
211
225
            Row {
212
226
 
213
227
                anchors {
230
244
                    objectName: "confirmButton"
231
245
                    width: (parent.width / 2) - units.gu(1)
232
246
                    text: hotspotSetupDialog.stored ? i18n.tr("Change") :
233
 
                        i18n.tr("Enable")
 
247
                        i18n.tr("Start")
234
248
                    enabled: settingsValid()
235
249
                    activeFocusOnPress: false
236
250
                    onClicked: {
237
 
                        if (hotspotSetupDialog.stored) {
 
251
                        if (!Connectivity.wifiEnabled &&
 
252
                                !hotspotSetupDialog.stored) {
 
253
                            enableWifiAction.trigger();
 
254
                        } else if (hotspotSetupDialog.stored) {
238
255
                            changeAction.trigger()
239
256
                        } else {
240
257
                            enableAction.trigger();
259
276
                        height: parent.height - units.gu(1.5)
260
277
                    }
261
278
                }
262
 
 
263
 
                Button {
264
 
                    visible: showAllUI
265
 
                    // TRANSLATORS: This string is hidden.
266
 
                    text: i18n.tr("Start")
 
279
            }
 
280
        }
 
281
 
 
282
        Action {
 
283
            id: enableWifiAction
 
284
            onTriggered: {
 
285
                hotspotSetupDialog.state = "STARTING";
 
286
 
 
287
                // As soon as Wi-Fi has been turned on, trigger enableAction.
 
288
                function wifiUpdated (updated) {
 
289
                    Connectivity.wifiEnabledUpdated.disconnect(wifiUpdated);
 
290
                    enableAction.trigger();
267
291
                }
 
292
 
 
293
                Connectivity.wifiEnabledUpdated.connect(wifiUpdated);
 
294
                Connectivity.wifiEnabled = true;
268
295
            }
269
296
        }
270
297