Display warning icon
...and account for that there can be multiple reasons
This commit is contained in:
parent
0da94cc3b3
commit
ded0d4a2cb
4 changed files with 29 additions and 3 deletions
|
@ -44,8 +44,12 @@ Page {
|
|||
text: Utils.ippName("printer-state", printer.attrs["printer-state"].value)
|
||||
}
|
||||
|
||||
Repeater
|
||||
{
|
||||
model: printer.attrs["printer-state-reasons"].value
|
||||
Label {
|
||||
text: Utils.ippName("printer-state-reasons", printer.attrs["printer-state-reasons"].value)
|
||||
text: Utils.ippName("printer-state-reasons", printer.attrs["printer-state-reasons"].value[index])
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
|
|
|
@ -202,6 +202,14 @@ Page {
|
|||
|
||||
}
|
||||
|
||||
Image {
|
||||
id: warningIcon
|
||||
source: "image://theme/icon-lock-warning"
|
||||
anchors.bottom: icon.bottom
|
||||
anchors.right: icon.right
|
||||
visible: Utils.isWaringState(printer)
|
||||
}
|
||||
|
||||
Column {
|
||||
id: column
|
||||
anchors.left: icon.right
|
||||
|
|
|
@ -318,6 +318,19 @@ function selectIcon(icons)
|
|||
return icons[0];
|
||||
}
|
||||
|
||||
function isWaringState(printer)
|
||||
{
|
||||
if(printer.attrs["printer-state"].value > 4)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if(!has(printer.attrs["printer-state-reasons"].value, "none"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
var media =
|
||||
{"asme_f_28x40in": "28 x 40″",
|
||||
"choice_iso_a4_210x297mm_na_letter_8.5x11in": "A4 or US Letter",
|
||||
|
|
|
@ -276,7 +276,8 @@ QString IppMsg::consume_attribute(QJsonObject& attrs, Bytestream& data)
|
|||
bool forceArray = (!noList && (name.startsWith("marker-")
|
||||
|| name.startsWith("printer-firmware")
|
||||
|| name.endsWith("-supported")
|
||||
|| name == "printer-icons"));
|
||||
|| name == "printer-icons"
|
||||
|| name.endsWith("-reasons")));
|
||||
|
||||
if(!unnamed.empty() || forceArray)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue