From 675e35d7179941931c15e06de3ad3f7df3877183 Mon Sep 17 00:00:00 2001 From: Jacob Brydolf Date: Sat, 29 Oct 2016 14:07:55 +0200 Subject: [PATCH] wizard: skip language page if only 1 language is availible --- wizard/WizardWelcome.qml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/wizard/WizardWelcome.qml b/wizard/WizardWelcome.qml index ef97f984..3553a6a5 100644 --- a/wizard/WizardWelcome.qml +++ b/wizard/WizardWelcome.qml @@ -45,13 +45,18 @@ Item { onOpacityChanged: visible = opacity !== 0 - - function onPageClosed(settingsObject) { + + // set default language to first item if none selected + if(gridView.currentIndex === -1) { + gridView.currentIndex = 0 + } + var lang = languagesModel.get(gridView.currentIndex); settingsObject['language'] = lang.display_name; settingsObject['wallet_language'] = lang.wallet_language; settingsObject['locale'] = lang.locale; + console.log("Language chosen: ",lang.display_name) return true } @@ -108,7 +113,15 @@ Item { // and set current language accordingly XmlRole { name: "isCurrent"; query: "@enabled/string()" } - + onStatusChanged: { + if(status === XmlListModel.Ready){ + console.log("languages availible: ",count); + if(count === 1){ + console.log("Skipping language page until more languages are availible") + wizard.switchPage(true); + } + } + } } // Flags view