From 3a5b5cdf59043f610294271e68f52a0fe823cd53 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Sun, 16 Feb 2020 14:15:48 +0100 Subject: [PATCH] Actually consider PDF support in printer-info --- qml/pages/FirstPage.qml | 7 +++++++ qml/pages/utils.js | 11 +++-------- rpm/harbour-seaprint.spec | 2 +- rpm/harbour-seaprint.yaml | 2 +- translations/harbour-seaprint-de.ts | 8 ++++---- translations/harbour-seaprint-es.ts | 8 ++++---- translations/harbour-seaprint-fr.ts | 8 ++++---- translations/harbour-seaprint-zh_CN.ts | 8 ++++---- translations/harbour-seaprint.ts | 8 ++++---- 9 files changed, 32 insertions(+), 30 deletions(-) diff --git a/qml/pages/FirstPage.qml b/qml/pages/FirstPage.qml index 295988a..320029a 100644 --- a/qml/pages/FirstPage.qml +++ b/qml/pages/FirstPage.qml @@ -210,6 +210,13 @@ Page { Row { spacing: Theme.paddingMedium + Label { + id: format_unsupported_label + visible: format_label.text == "" && maybe_format_label.text == "" + color: "red" + font.pixelSize: Theme.fontSizeExtraSmall + text: qsTr("No compatible formats supported") + } Label { id: format_label color: canPrint ? Theme.primaryColor : "red" diff --git a/qml/pages/utils.js b/qml/pages/utils.js index 92393cd..cf5a413 100644 --- a/qml/pages/utils.js +++ b/qml/pages/utils.js @@ -14,20 +14,15 @@ function supported_formats(printer) supported.push("JPEG"); } - if(supported.length == 0) - { - supported.push(qsTr("No compatible formats supported")) - } - - //var info = "MFG:Hewlett-Packard;CMD:PJL,BIDI-ECP,PJL,POSTSCRIPT,PDF,PCLXL,PCL;MDL:HP LaserJet P3010 Series;CLS:PRINTER;DES:Hewlett-Packard ".split(";"); var maybe = [] - var info = printer.attrs["printer-info"].value.split(";"); + var info = printer.attrs["printer-info"] ? printer.attrs["printer-info"].value.split(";") : []; + for(var i in info) { if(info[i].split(":")[0] == "CMD") { - if(has(info[i].split(":")[1].split(","), "PDF")) + if(!has(supported, "PDF") && has(info[i].split(":")[1].split(","), "PDF")) { mimetypes.push("application/pdf"); maybe.push("PDF"); diff --git a/rpm/harbour-seaprint.spec b/rpm/harbour-seaprint.spec index 459a79f..b35427a 100644 --- a/rpm/harbour-seaprint.spec +++ b/rpm/harbour-seaprint.spec @@ -9,7 +9,7 @@ Name: harbour-seaprint # << macros Summary: SeaPrint -Version: 0.4.1 +Version: 0.4.2 Release: 1 Group: Qt/Qt License: LICENSE diff --git a/rpm/harbour-seaprint.yaml b/rpm/harbour-seaprint.yaml index b765339..54b8576 100644 --- a/rpm/harbour-seaprint.yaml +++ b/rpm/harbour-seaprint.yaml @@ -1,6 +1,6 @@ Name: harbour-seaprint Summary: SeaPrint -Version: 0.4.1 +Version: 0.4.2 Release: 1 # The contents of the Group field should be one of the groups listed here: # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS diff --git a/translations/harbour-seaprint-de.ts b/translations/harbour-seaprint-de.ts index 23f38dc..7486638 100644 --- a/translations/harbour-seaprint-de.ts +++ b/translations/harbour-seaprint-de.ts @@ -140,6 +140,10 @@ Unknown + + No compatible formats supported + + JobsPage @@ -281,9 +285,5 @@ dots/cm - - No compatible formats supported - - diff --git a/translations/harbour-seaprint-es.ts b/translations/harbour-seaprint-es.ts index 4ea77af..94bf9ec 100644 --- a/translations/harbour-seaprint-es.ts +++ b/translations/harbour-seaprint-es.ts @@ -140,6 +140,10 @@ Unknown Desconocido + + No compatible formats supported + No hay formatos compatibles + JobsPage @@ -281,9 +285,5 @@ dots/cm ppp - - No compatible formats supported - No hay formatos compatibles - diff --git a/translations/harbour-seaprint-fr.ts b/translations/harbour-seaprint-fr.ts index aab9b47..95255cc 100644 --- a/translations/harbour-seaprint-fr.ts +++ b/translations/harbour-seaprint-fr.ts @@ -140,6 +140,10 @@ Unknown Inconnu + + No compatible formats supported + Aucun format compatible supporté + JobsPage @@ -281,9 +285,5 @@ dots/cm pts/cm - - No compatible formats supported - Aucun format compatible supporté - diff --git a/translations/harbour-seaprint-zh_CN.ts b/translations/harbour-seaprint-zh_CN.ts index 4bc2bc1..cf011ef 100644 --- a/translations/harbour-seaprint-zh_CN.ts +++ b/translations/harbour-seaprint-zh_CN.ts @@ -140,6 +140,10 @@ Unknown 未知 + + No compatible formats supported + 不支持相关格式 + JobsPage @@ -281,9 +285,5 @@ dots/cm 点/厘米 - - No compatible formats supported - 不支持相关格式 - diff --git a/translations/harbour-seaprint.ts b/translations/harbour-seaprint.ts index 7d79407..7bd5741 100644 --- a/translations/harbour-seaprint.ts +++ b/translations/harbour-seaprint.ts @@ -140,6 +140,10 @@ Unknown + + No compatible formats supported + + JobsPage @@ -281,9 +285,5 @@ dots/cm - - No compatible formats supported - -