Add printer location

This commit is contained in:
Anton Thomasson 2021-06-21 20:20:09 +02:00
parent d9c14241bf
commit 6ef84580f3
10 changed files with 53 additions and 0 deletions

View file

@ -37,6 +37,17 @@ Page {
text: Utils.unknownForEmptyString(printer.attrs["printer-make-and-model"].value)
}
SectionHeader {
text: qsTr("Location")
visible: Utils.existsAndNotEmpty("printer-location", printer)
}
Label {
text: printer.attrs["printer-location"].value
visible: Utils.existsAndNotEmpty("printer-location", printer)
}
SectionHeader {
text: qsTr("Printer status")
}

View file

@ -262,6 +262,7 @@ Page {
color: canPrint || selectedFile == "" ? Theme.primaryColor : Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall
text: Utils.unknownForEmptyString(printer.attrs["printer-make-and-model"].value)
+ (Utils.existsAndNotEmpty("printer-location", printer) ? " • "+printer.attrs["printer-location"].value : "")
}
Label {

View file

@ -403,6 +403,19 @@ function unknownForEmptyString(s)
}
}
function existsAndNotEmpty(attrName, printer)
{
if(printer.attrs.hasOwnProperty(attrName))
{
return printer.attrs[attrName].value != ""
}
else
{
return false
}
}
function basename(filewithpath)
{
return filewithpath.substring(filewithpath.lastIndexOf("/")+1);

View file

@ -220,6 +220,10 @@
<source>Supply status</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Location</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FirstPage</name>

View file

@ -220,6 +220,10 @@
<source>Supply status</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Location</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FirstPage</name>

View file

@ -220,6 +220,10 @@
<source>Supply status</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Location</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FirstPage</name>

View file

@ -220,6 +220,10 @@
<source>Supply status</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Location</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FirstPage</name>

View file

@ -220,6 +220,10 @@
<source>Supply status</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Location</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FirstPage</name>

View file

@ -220,6 +220,10 @@
<source>Supply status</source>
<translation></translation>
</message>
<message>
<source>Location</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FirstPage</name>

View file

@ -220,6 +220,10 @@
<source>Supply status</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Location</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FirstPage</name>