From 9b4f46d1f415f76637147cf7fdb0d3e8fad87fa0 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Tue, 10 Sep 2019 12:34:52 +0200 Subject: [PATCH] Can start offline and work with cache. Related to #5 --- qml/harbour-currencyconverter.qml | 10 ++++++++-- qml/pages/FrontPage.qml | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/qml/harbour-currencyconverter.qml b/qml/harbour-currencyconverter.qml index b92040f..5c006cb 100644 --- a/qml/harbour-currencyconverter.qml +++ b/qml/harbour-currencyconverter.qml @@ -138,6 +138,12 @@ ApplicationWindow { workOffline = settings.value('workOffline', false) if(!workOffline) { waitForNetwork.start() + } else { + // NOTE: Duplicate code from onIsOnlineChanged + allCurrenciesFetcher.request({}) + provider.getAvailable(toCode) + // Start timer to monitor when Currencies data is ready. + kickOff.start() } } @@ -146,8 +152,7 @@ ApplicationWindow { interval: 3000 repeat: false onTriggered: { - if(!Env.isOnline) { - console.log('App.waitForNetwork triggered') + if(!Env.isOnline && !workOffline) { networkIFace.openConnection() } } @@ -316,6 +321,7 @@ ApplicationWindow { //Currencies.available = available } onError: { + notifier.notify(error, message) console.log('App.provider.onError:', error, message) Env.setBusy(false) } diff --git a/qml/pages/FrontPage.qml b/qml/pages/FrontPage.qml index 5ab96b7..6088756 100644 --- a/qml/pages/FrontPage.qml +++ b/qml/pages/FrontPage.qml @@ -153,7 +153,7 @@ Page { enabled: isEnabled currentCurrencyCode: fromCode onActivated: { - console.log('FrontPage.fromCombo.onActivated:', JSON.stringify(currency)) + console.log('FrontPage.fromCombo.onActivated:') fromCode = currency.code fromSymbol = currency.symbol ? currency.symbol : currency.code if(fromCode !== toCode && !Env.isBusy && Env.isReady) { app.getRate() }