From c745d6121b225f3f58d951f4fa6b74dc0516992e Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Sun, 14 Feb 2021 14:38:35 +0100 Subject: [PATCH] Pop PrinterPage if wifi is lost --- qml/harbour-seaprint.qml | 5 +++++ qml/pages/FirstPage.qml | 14 ++++++-------- qml/pages/PrinterPage.qml | 10 ++++++++-- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/qml/harbour-seaprint.qml b/qml/harbour-seaprint.qml index aa72210..eaa4bdf 100644 --- a/qml/harbour-seaprint.qml +++ b/qml/harbour-seaprint.qml @@ -4,6 +4,7 @@ import QtQuick.LocalStorage 2.0 import Nemo.Notifications 1.0 import Nemo.Configuration 1.0 import "pages" +import "components" ApplicationWindow { @@ -16,6 +17,10 @@ ApplicationWindow property string busyMessage: "" property string progress: "" + WifiChecker { + id: wifi + } + Item { id: db property var db_conn diff --git a/qml/pages/FirstPage.qml b/qml/pages/FirstPage.qml index f7b347c..62f0b75 100644 --- a/qml/pages/FirstPage.qml +++ b/qml/pages/FirstPage.qml @@ -6,8 +6,6 @@ import seaprint.convertchecker 1.0 import seaprint.ippprinter 1.0 import seaprint.mimer 1.0 import "utils.js" as Utils -import "../components" -import Nemo.DBus 2.0 Page { id: page @@ -16,12 +14,12 @@ Page { property string selectedFile: "" property string selectedFileType - WifiChecker { - id: wifi + Connections { + target: wifi onConnectedChanged: { - console.log("conn", connected, ssid) - if(connected) { - var favourites = db.getFavourites(ssid); + console.log("conn", wifi.connected, wifi.ssid) + if(wifi.connected) { + var favourites = db.getFavourites(wifi.ssid); console.log(favourites); IppDiscovery.favourites = favourites; } @@ -34,7 +32,7 @@ Page { property bool initialSSIDchange: true onSsidChanged: { - console.log("ssid changed", ssid); + console.log("ssid changed", wifi.ssid); if(!initialSSIDchange) { IppDiscovery.reset(); diff --git a/qml/pages/PrinterPage.qml b/qml/pages/PrinterPage.qml index ebb3e0a..8b54c42 100644 --- a/qml/pages/PrinterPage.qml +++ b/qml/pages/PrinterPage.qml @@ -14,8 +14,14 @@ Page { property var jobParams: new Object(); property string selectedFile - Component.onCompleted: { - console.log(JSON.stringify(printer.attrs)) + + Connections { + target: wifi + onConnectedChanged: { + if(!wifi.connected) { + pageStack.pop() + } + } } function choiceMade(name, tag, choice)