diff --git a/qml/pages/PrinterPage.qml b/qml/pages/PrinterPage.qml index a8e879b..9dca3a5 100644 --- a/qml/pages/PrinterPage.qml +++ b/qml/pages/PrinterPage.qml @@ -1,6 +1,7 @@ import QtQuick 2.0 import Sailfish.Silica 1.0 import "utils.js" as Utils +import Nemo.Configuration 1.0 Page { id: page @@ -8,6 +9,13 @@ Page { property var jobParams: new Object(); property string selectedFile + ConfigurationValue + { + id: alwaysConvert + key: "/apps/harbour-seaprint/settings/always_convert" + defaultValue: false + } + Component.onCompleted: { console.log(JSON.stringify(printer.attrs)) } @@ -24,7 +32,7 @@ Page { console.log(JSON.stringify(jobParams)) pageStack.replace(Qt.resolvedUrl("BusyPage.qml"),{printer:printer}, PageStackAction.Immediate) - printer.print(jobParams, page.selectedFile) + printer.print(jobParams, page.selectedFile, alwaysConvert.value) } } } diff --git a/src/ippprinter.cpp b/src/ippprinter.cpp index 8a73c19..86e52d3 100644 --- a/src/ippprinter.cpp +++ b/src/ippprinter.cpp @@ -228,7 +228,7 @@ void IppPrinter::convertFailed(QString message) emit jobFinished(false); } -void IppPrinter::print(QJsonObject attrs, QString filename){ +void IppPrinter::print(QJsonObject attrs, QString filename, bool alwaysConvert){ qDebug() << "printing" << filename << attrs; QFile file(filename); @@ -283,7 +283,7 @@ void IppPrinter::print(QJsonObject attrs, QString filename){ qDebug() << supportedMimeTypes << supportedMimeTypes.contains(mimeType); - if(from == Image || (from == Pdf /*&& !supportedMimeTypes.contains("application/pdf")*/)) + if(alwaysConvert || from == Image || (from == Pdf && !supportedMimeTypes.contains("application/pdf"))) { if(supportedMimeTypes.contains("image/pwg-raster")) { @@ -347,6 +347,11 @@ void IppPrinter::print(QJsonObject attrs, QString filename){ emit doConvertImage(request, filename, tempfile, target==UrfConvert, Colors, Quality, PaperSize, HwResX, HwResY); } + else + { + emit convertFailed(tr("Cannot convert this file format")); + return; + } } else { diff --git a/src/ippprinter.h b/src/ippprinter.h index 01eeb46..aa2e83c 100644 --- a/src/ippprinter.h +++ b/src/ippprinter.h @@ -63,7 +63,7 @@ signals: void busyMessageChanged(); public slots: - void print(QJsonObject attrs, QString file); + void print(QJsonObject attrs, QString file, bool alwaysConvert); void onUrlChanged(); diff --git a/translations/harbour-seaprint-de.ts b/translations/harbour-seaprint-de.ts index 37a3078..6edc3c7 100644 --- a/translations/harbour-seaprint-de.ts +++ b/translations/harbour-seaprint-de.ts @@ -201,6 +201,10 @@ Unsupported print media + + Cannot convert this file format + + JobsPage diff --git a/translations/harbour-seaprint-es.ts b/translations/harbour-seaprint-es.ts index db42f13..8cd54a5 100644 --- a/translations/harbour-seaprint-es.ts +++ b/translations/harbour-seaprint-es.ts @@ -201,6 +201,10 @@ Unsupported print media + + Cannot convert this file format + + JobsPage diff --git a/translations/harbour-seaprint-fr.ts b/translations/harbour-seaprint-fr.ts index 64b24e4..bca0d34 100644 --- a/translations/harbour-seaprint-fr.ts +++ b/translations/harbour-seaprint-fr.ts @@ -201,6 +201,10 @@ Unsupported print media + + Cannot convert this file format + + JobsPage diff --git a/translations/harbour-seaprint-zh_CN.ts b/translations/harbour-seaprint-zh_CN.ts index 6fba3d7..9d0b14d 100644 --- a/translations/harbour-seaprint-zh_CN.ts +++ b/translations/harbour-seaprint-zh_CN.ts @@ -201,6 +201,10 @@ Unsupported print media + + Cannot convert this file format + + JobsPage diff --git a/translations/harbour-seaprint.ts b/translations/harbour-seaprint.ts index 6ae5903..60aa166 100644 --- a/translations/harbour-seaprint.ts +++ b/translations/harbour-seaprint.ts @@ -201,6 +201,10 @@ Unsupported print media + + Cannot convert this file format + + JobsPage