Pop AddPrinterDialog if wifi is lost

This commit is contained in:
Anton Thomasson 2021-02-15 18:03:35 +01:00
parent 2d766345fe
commit 61eaad3fb3
9 changed files with 12 additions and 32 deletions

View file

@ -11,6 +11,14 @@ Dialog {
property var printerName: false property var printerName: false
canAccept: printerName != false canAccept: printerName != false
Connections {
target: wifi
onConnectedChanged: {
if(!wifi.connected) {
dialog.reject()
}
}
}
Component.onCompleted: { Component.onCompleted: {
valueField.forceActiveFocus() valueField.forceActiveFocus()
@ -57,7 +65,7 @@ Dialog {
Label { Label {
id: ssid_label id: ssid_label
color: Theme.secondaryColor color: Theme.secondaryColor
text: ssid text: wifi.ssid
} }
} }
Row { Row {
@ -102,6 +110,7 @@ Dialog {
onDone: { onDone: {
if (result == DialogResult.Accepted) { if (result == DialogResult.Accepted) {
value = valueField.text value = valueField.text
ssid = wifi.ssid
} }
} }

View file

@ -102,12 +102,11 @@ Page {
text: qsTr("Add by URL") text: qsTr("Add by URL")
enabled: wifi.connected enabled: wifi.connected
onClicked: { onClicked: {
var dialog = pageStack.push(Qt.resolvedUrl("AddPrinterDialog.qml"), var dialog = pageStack.push(Qt.resolvedUrl("AddPrinterDialog.qml"));
{ssid: wifi.ssid, title: qsTr("URL")});
dialog.accepted.connect(function() { dialog.accepted.connect(function() {
console.log("add", wifi.ssid, dialog.value); console.log("add", wifi.ssid, dialog.value);
db.addFavourite(wifi.ssid, dialog.value); db.addFavourite(wifi.ssid, dialog.value);
IppDiscovery.favourites = db.getFavourites(wifi.ssid); IppDiscovery.favourites = db.getFavourites(dialog.ssid);
}) })
} }
} }

View file

@ -223,10 +223,6 @@
<source>Add by URL</source> <source>Add by URL</source>
<translation>Mit URL hinzufügen</translation> <translation>Mit URL hinzufügen</translation>
</message> </message>
<message>
<source>URL</source>
<translation>URL</translation>
</message>
<message> <message>
<source>Refresh</source> <source>Refresh</source>
<translation>Aktualisieren</translation> <translation>Aktualisieren</translation>

View file

@ -223,10 +223,6 @@
<source>Add by URL</source> <source>Add by URL</source>
<translation>Añadir por URL</translation> <translation>Añadir por URL</translation>
</message> </message>
<message>
<source>URL</source>
<translation>URL</translation>
</message>
<message> <message>
<source>Refresh</source> <source>Refresh</source>
<translation>Actualizar</translation> <translation>Actualizar</translation>

View file

@ -223,10 +223,6 @@
<source>Add by URL</source> <source>Add by URL</source>
<translation>Ajouter par URL</translation> <translation>Ajouter par URL</translation>
</message> </message>
<message>
<source>URL</source>
<translation>URL</translation>
</message>
<message> <message>
<source>Refresh</source> <source>Refresh</source>
<translation>Actualiser</translation> <translation>Actualiser</translation>

View file

@ -223,10 +223,6 @@
<source>Add by URL</source> <source>Add by URL</source>
<translation>Toevoegen via URL</translation> <translation>Toevoegen via URL</translation>
</message> </message>
<message>
<source>URL</source>
<translation>URL</translation>
</message>
<message> <message>
<source>Refresh</source> <source>Refresh</source>
<translation>Ververs</translation> <translation>Ververs</translation>

View file

@ -223,10 +223,6 @@
<source>Add by URL</source> <source>Add by URL</source>
<translation>Dodaj za pomocą URL</translation> <translation>Dodaj za pomocą URL</translation>
</message> </message>
<message>
<source>URL</source>
<translation>URL</translation>
</message>
<message> <message>
<source>Refresh</source> <source>Refresh</source>
<translation>Odśwież</translation> <translation>Odśwież</translation>

View file

@ -223,10 +223,6 @@
<source>Add by URL</source> <source>Add by URL</source>
<translation>URL添加</translation> <translation>URL添加</translation>
</message> </message>
<message>
<source>URL</source>
<translation>URL</translation>
</message>
<message> <message>
<source>Refresh</source> <source>Refresh</source>
<translation></translation> <translation></translation>

View file

@ -223,10 +223,6 @@
<source>Add by URL</source> <source>Add by URL</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>URL</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Refresh</source> <source>Refresh</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>