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) 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 { SectionHeader {
text: qsTr("Printer status") text: qsTr("Printer status")
} }

View file

@ -262,6 +262,7 @@ Page {
color: canPrint || selectedFile == "" ? Theme.primaryColor : Theme.secondaryColor color: canPrint || selectedFile == "" ? Theme.primaryColor : Theme.secondaryColor
font.pixelSize: Theme.fontSizeExtraSmall font.pixelSize: Theme.fontSizeExtraSmall
text: Utils.unknownForEmptyString(printer.attrs["printer-make-and-model"].value) text: Utils.unknownForEmptyString(printer.attrs["printer-make-and-model"].value)
+ (Utils.existsAndNotEmpty("printer-location", printer) ? " • "+printer.attrs["printer-location"].value : "")
} }
Label { 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) function basename(filewithpath)
{ {
return filewithpath.substring(filewithpath.lastIndexOf("/")+1); return filewithpath.substring(filewithpath.lastIndexOf("/")+1);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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