Make printer detection not focus on name
This commit is contained in:
parent
2f1e1bf7a5
commit
1f947096f3
1 changed files with 7 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
import seaprint.ippprinter 1.0
|
import seaprint.ippprinter 1.0
|
||||||
|
import "utils.js" as Utils
|
||||||
|
|
||||||
Dialog {
|
Dialog {
|
||||||
id: dialog
|
id: dialog
|
||||||
|
@ -9,7 +10,7 @@ Dialog {
|
||||||
property string value
|
property string value
|
||||||
property string ssid
|
property string ssid
|
||||||
property var printerName: false
|
property var printerName: false
|
||||||
canAccept: printerName != false
|
canAccept: Object.keys(printer.attrs).length != 0
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: wifi
|
target: wifi
|
||||||
|
@ -28,12 +29,12 @@ Dialog {
|
||||||
id: printer
|
id: printer
|
||||||
url: valueField.text
|
url: valueField.text
|
||||||
onAttrsChanged: {
|
onAttrsChanged: {
|
||||||
if(printer.attrs["printer-name"]) {
|
if(printer.attrs.hasOwnProperty("printer-name")) {
|
||||||
printerName = printer.attrs["printer-name"].value == "" ? qsTr("Unknown") : printer.attrs["printer-name"].value
|
printerName = Utils.unknownForEmptyString(printer.attrs["printer-name"].value)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printerName = false
|
printerName = qsTr("Unknown")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -74,12 +75,12 @@ Dialog {
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
id: found_label
|
id: found_label
|
||||||
text: printerName != false ? qsTr("Found:") : qsTr("No printer found")
|
text: canAccept ? qsTr("Found:") : qsTr("No printer found")
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
id: printer_label
|
id: printer_label
|
||||||
color: Theme.secondaryColor
|
color: Theme.secondaryColor
|
||||||
text: printerName ? printerName : ""
|
text: canAccept ? printerName : ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue