on xenial help sign in
Merge pull request #62 from ubports/xenial_-_wizard-skipped-twice

Don't just skip if we are not connected and dont skip twice if not supported

commit6cb544c8c9806d18eb420ecc62189b6447da6a2b authorMarius Gripsgard <marius@ubports.com> dateWed 15 Aug 2018, 23:53 (8 years ago) parente4ced8e9636604
2 files changed+19−8
plugins/Wizard/System.cpp+4 qml/Wizard/Pages/78-firmware-update.qml+15−8
plugins/Wizard/System.cpp+4
@@ -115,6 +115,10 @@ void System::setWizardEnabled(bool enabled)
115115 if (QFile::exists(wizardEnabledPath())) {
116116 QFile::remove(wizardEnabledPath());
117117 }
118+ // For special cases check if wizardEnabledPath is a folder
119+ if (QDir(wizardEnabledPath()).exists()) {
120+ QDir(wizardEnabledPath()).removeRecursively();
121+ }
118122 QFile::copy(currentFrameworkPath(), wizardEnabledPath());
119123 m_fsWatcher.addPath(wizardEnabledPath());
120124 Q_EMIT wizardEnabledChanged();
qml/Wizard/Pages/78-firmware-update.qml+15−8
@@ -31,7 +31,7 @@ LocalComponents.Page {
3131 title: i18n.tr("Firmware Update")
3232 forwardButtonSourceComponent: forwardButton
3333
34− skip: !SystemImage.supportsFirmwareUpdate() || !online
34+ skip: !SystemImage.supportsFirmwareUpdate()
3535
3636 property bool online: NetworkingStatus.online
3737 property bool hasUpdate: false
@@ -41,7 +41,7 @@ LocalComponents.Page {
4141
4242 function check() {
4343 if (!SystemImage.supportsFirmwareUpdate())
44− return pageStack.next();
44+ return;
4545 systemUpdatePage.isChecking = true
4646 SystemImage.checkForFirmwareUpdate()
4747 }
@@ -100,12 +100,14 @@ LocalComponents.Page {
100100 }
101101
102102 Label {
103+ visible: !systemUpdatePage.isChecking
103104 anchors.horizontalCenter: parent.horizontalCenter
104105 font.weight: Font.Light
105106 wrapMode: Text.Wrap
106107 textSize: Label.Medium
107108 text: systemUpdatePage.hasUpdate ? i18n.tr("There is a firmware update available!")
108− : i18n.tr("Firmware is up to date!")
109+ : online ? i18n.tr("Firmware is up to date!")
110+ : i18n.tr("Please connect to the Internet to check for updates.")
109111
110112 }
111113
@@ -209,18 +211,23 @@ LocalComponents.Page {
209211 visible: systemUpdatePage.isChecking
210212 }
211213
212− Component.onCompleted: systemUpdatePage.check()
213−
214+ Component.onCompleted: {
215+ if (online)
216+ systemUpdatePage.check();
217+ else
218+ systemUpdatePage.isChecking = false;
219+ }
214220 }
215221
216222 Connections {
217223 target: NetworkingStatus
218224 onOnlineChanged: {
219− if (online) {
220− systemUpdatePage.check()
225+ if (online)
226+ systemUpdatePage.check();
227+ else
228+ systemUpdatePage.isChecking = false;
221229 }
222230 }
223− }
224231
225232 Component {
226233 id: forwardButton