From d44dcf0a888ebfbe46af64092c5da0adf3fb0b81 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Sat, 1 Aug 2020 20:43:52 +0200 Subject: [PATCH] Enable page ranges for when pdfinfo is missing --- qml/components/RangeSetting.qml | 4 ++-- qml/pages/PrinterPage.qml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/qml/components/RangeSetting.qml b/qml/components/RangeSetting.qml index 0c80a4d..2a1d932 100644 --- a/qml/components/RangeSetting.qml +++ b/qml/components/RangeSetting.qml @@ -50,7 +50,7 @@ Setting { { id: low_slider minimumValue: 1 - maximumValue: high + maximumValue: high > 100 ? 100 : high width: parent.width stepSize: 1 value: choice_low @@ -79,7 +79,7 @@ Setting { { id: high_slider minimumValue: 0 - maximumValue: high + maximumValue: high > 100 ? 100 : high width: parent.width stepSize: 1 value: choice_high diff --git a/qml/pages/PrinterPage.qml b/qml/pages/PrinterPage.qml index 6701f15..dc88831 100644 --- a/qml/pages/PrinterPage.qml +++ b/qml/pages/PrinterPage.qml @@ -114,12 +114,13 @@ Page { case IppMsg.IntegerRange: var valid = printer.attrs.hasOwnProperty(name+"-supported") && name=="page-ranges" && Mimer.get_type(selectedFile) == "application/pdf"; + var pdfpages = ConvertChecker.pdfPages(selectedFile); loader.setSource("../components/RangeSetting.qml", {name: name, prettyName: prettyName, tag: tag, valid: valid, - high: name=="page-ranges" ? ConvertChecker.pdfPages(selectedFile) : 0 + high: name=="page-ranges" ? (pdfpages == 0 ? 65535 : pdfpages) : 0 }) break case IppMsg.Resolution: