1
0
forked from pool/libqt5-qtbase

Accepting request 641330 from KDE:Qt5

- Add patch to fix boo#1096328, printer settings not remembered:
  * 0001-Unix-print-dialog-Properly-initialize-duplex.patch

OBS-URL: https://build.opensuse.org/request/show/641330
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=89
This commit is contained in:
Dominique Leuenberger 2018-10-15 07:17:41 +00:00 committed by Git OBS Bridge
parent d9567c040d
commit a9a0afee32
3 changed files with 95 additions and 0 deletions

View File

@ -0,0 +1,88 @@
From 82f21f3d47cf4bb3be71bf2eda3f971b43acc76d Mon Sep 17 00:00:00 2001
From: Mischa Salle <mischa.salle@gmail.com>
Date: Thu, 27 Sep 2018 13:22:47 +0200
Subject: [PATCH] Unix print dialog: Properly initialize duplex
This is a backport of https://codereview.qt-project.org/#/c/226881/ and fixes
https://bugzilla.suse.com/show_bug.cgi?id=1096328
---
src/printsupport/dialogs/qprintdialog_unix.cpp | 32 ++++++++++++++++++++++----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
index 86daea3b02..53d26bf9fc 100644
--- a/src/printsupport/dialogs/qprintdialog_unix.cpp
+++ b/src/printsupport/dialogs/qprintdialog_unix.cpp
@@ -240,6 +240,10 @@ public:
QDialogButtonBox *buttons;
QPushButton *collapseButton;
QPrinter::OutputFormat printerOutputFormat;
+private:
+ void setExplicitDuplexMode(QPrint::DuplexMode duplexMode);
+ // duplex mode explicitly set by user, QPrint::DuplexAuto otherwise
+ QPrint::DuplexMode explicitDuplexMode;
};
#if QT_CONFIG(cups)
@@ -479,7 +483,8 @@ void QPrintPropertiesDialog::accept()
*/
QPrintDialogPrivate::QPrintDialogPrivate()
- : top(nullptr), bottom(nullptr), buttons(nullptr), collapseButton(nullptr)
+ : top(nullptr), bottom(nullptr), buttons(nullptr), collapseButton(nullptr),
+ explicitDuplexMode(QPrint::DuplexAuto)
{
initResources();
}
@@ -540,6 +545,10 @@ void QPrintDialogPrivate::init()
q, SLOT(_q_togglePageSetCombo(bool)));
QObject::connect(collapseButton, SIGNAL(released()), q, SLOT(_q_collapseOrExpandDialog()));
+
+ QObject::connect(options.noDuplex, &QAbstractButton::clicked, q, [this] { setExplicitDuplexMode(QPrint::DuplexNone); });
+ QObject::connect(options.duplexLong, &QAbstractButton::clicked, q, [this] { setExplicitDuplexMode(QPrint::DuplexLongSide); });
+ QObject::connect(options.duplexShort, &QAbstractButton::clicked, q, [this] { setExplicitDuplexMode(QPrint::DuplexShortSide); });
}
// initialize printer options
@@ -559,13 +568,21 @@ void QPrintDialogPrivate::selectPrinter(const QPrinter::OutputFormat outputForma
else
options.grayscale->setChecked(true);
- switch (p->duplex()) {
- case QPrinter::DuplexNone:
+ // keep duplex value explicitly set by user, if any, and selected printer supports it;
+ // use device default otherwise
+ QPrint::DuplexMode duplex;
+ if (explicitDuplexMode != QPrint::DuplexAuto && supportedDuplexMode.contains(explicitDuplexMode))
+ duplex = explicitDuplexMode;
+ else
+ duplex = top->d->m_currentPrintDevice.defaultDuplexMode();
+
+ switch (duplex) {
+ case QPrint::DuplexNone:
options.noDuplex->setChecked(true); break;
- case QPrinter::DuplexLongSide:
+ case QPrint::DuplexLongSide:
case QPrinter::DuplexAuto:
options.duplexLong->setChecked(true); break;
- case QPrinter::DuplexShortSide:
+ case QPrint::DuplexShortSide:
options.duplexShort->setChecked(true); break;
}
options.copies->setValue(p->copyCount());
@@ -667,6 +684,11 @@ static bool isValidPagesString(const QString &pagesString) Q_DECL_NOTHROW
}
#endif
+void QPrintDialogPrivate::setExplicitDuplexMode(const QPrint::DuplexMode duplexMode)
+{
+ explicitDuplexMode = duplexMode;
+}
+
void QPrintDialogPrivate::setupPrinter()
{
// First setup the requested OutputFormat, Printer and Page Size first
--
2.16.4

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Sep 27 11:34:31 UTC 2018 - mischa.salle@gmail.com
- Add patch to fix boo#1096328, printer settings not remembered:
* 0001-Unix-print-dialog-Properly-initialize-duplex.patch
-------------------------------------------------------------------
Wed Sep 26 14:16:33 UTC 2018 - fabian@ritter-vogt.de

View File

@ -74,6 +74,7 @@ Patch19: qapplication-emit-palettechanged.patch
Patch1000: Export-qt_open64-from-QtCore.patch
Patch1001: 0001-xcb-Don-t-get-initial-screen-rotation.patch
# patches 2000-3000 and above from upstream 5.12/dev branch #
Patch2000: 0001-Unix-print-dialog-Properly-initialize-duplex.patch
BuildRequires: alsa-devel
BuildRequires: cups-devel
BuildRequires: double-conversion-devel