Handle unnamed printers

This commit is contained in:
Anton Thomasson 2020-01-02 22:10:58 +01:00
parent ba37531a84
commit 51ff40b691
6 changed files with 40 additions and 23 deletions

View file

@ -7,7 +7,8 @@ Dialog {
property string value property string value
property string ssid property string ssid
canAccept: printer_label.text != "" property var printerName: false
canAccept: printerName != false
Column { Column {
width: parent.width width: parent.width
@ -43,12 +44,12 @@ Dialog {
Label { Label {
id: found_label id: found_label
text: printer_label.text != "" ? qsTr("Found:") : qsTr("No printer found") text: printerName != false ? qsTr("Found:") : qsTr("No printer found")
} }
Label { Label {
id: printer_label id: printer_label
color: Theme.secondaryColor color: Theme.secondaryColor
text: "" text: printerName ? printerName : ""
} }
} }
IppPrinter { IppPrinter {
@ -56,11 +57,11 @@ Dialog {
url: valueField.text url: valueField.text
onAttrsChanged: { onAttrsChanged: {
if(printer.attrs["printer-name"]) { if(printer.attrs["printer-name"]) {
printer_label.text = printer.attrs["printer-name"].value printerName = printer.attrs["printer-name"].value == "" ? qsTr("Unknown") : printer.attrs["printer-name"].value
} }
else else
{ {
printer_label.text = "" printerName = false
} }
} }

View file

@ -32,7 +32,7 @@ Page {
} }
onSsidChanged: { onSsidChanged: {
discovery.reset() discovery.reset();
} }
} }
@ -87,7 +87,7 @@ Page {
visible: false visible: false
property string name: printer.attrs["printer-name"] ? printer.attrs["printer-name"].value : qsTr("Unknown") property string name: printer.attrs["printer-name"].value != "" ? printer.attrs["printer-name"].value : qsTr("Unknown")
property bool canPrint: Utils.can_print(printer, selectedFile) property bool canPrint: Utils.can_print(printer, selectedFile)
Connections { Connections {

View file

@ -78,6 +78,10 @@
<source>No printer found</source> <source>No printer found</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unknown</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChoiceSetting</name> <name>ChoiceSetting</name>
@ -167,10 +171,6 @@
<source>Remove printer</source> <source>Remove printer</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unknown</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Removing printer</source> <source>Removing printer</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -179,6 +179,10 @@
<source>About SeaPrint</source> <source>About SeaPrint</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unknown</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>JobsPage</name> <name>JobsPage</name>

View file

@ -78,6 +78,10 @@
<source>No printer found</source> <source>No printer found</source>
<translation>Aucune imprimante détectée</translation> <translation>Aucune imprimante détectée</translation>
</message> </message>
<message>
<source>Unknown</source>
<translation type="unfinished">Inconnu</translation>
</message>
</context> </context>
<context> <context>
<name>ChoiceSetting</name> <name>ChoiceSetting</name>
@ -167,10 +171,6 @@
<source>Remove printer</source> <source>Remove printer</source>
<translation>Supprimer l&apos;imprimante</translation> <translation>Supprimer l&apos;imprimante</translation>
</message> </message>
<message>
<source>Unknown</source>
<translation>Inconnu</translation>
</message>
<message> <message>
<source>Removing printer</source> <source>Removing printer</source>
<translation>Suppression de l&apos;imprimante</translation> <translation>Suppression de l&apos;imprimante</translation>
@ -179,6 +179,10 @@
<source>About SeaPrint</source> <source>About SeaPrint</source>
<translation>À propos de SeaPrint</translation> <translation>À propos de SeaPrint</translation>
</message> </message>
<message>
<source>Unknown</source>
<translation type="unfinished">Inconnu</translation>
</message>
</context> </context>
<context> <context>
<name>JobsPage</name> <name>JobsPage</name>

View file

@ -78,6 +78,10 @@
<source>No printer found</source> <source>No printer found</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>Unknown</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChoiceSetting</name> <name>ChoiceSetting</name>
@ -163,10 +167,6 @@
<source>About SeaPrint</source> <source>About SeaPrint</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unknown</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>View jobs</source> <source>View jobs</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -179,6 +179,10 @@
<source>Removing printer</source> <source>Removing printer</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unknown</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>JobsPage</name> <name>JobsPage</name>

View file

@ -78,6 +78,10 @@
<source>No printer found</source> <source>No printer found</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unknown</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ChoiceSetting</name> <name>ChoiceSetting</name>
@ -167,10 +171,6 @@
<source>Remove printer</source> <source>Remove printer</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unknown</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Removing printer</source> <source>Removing printer</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -179,6 +179,10 @@
<source>About SeaPrint</source> <source>About SeaPrint</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Unknown</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>JobsPage</name> <name>JobsPage</name>