File 0001-Add-apply-button-to-unix-variant-of-QPrintDialog.patch of Package mingw64-libqt4

From 2c2e45fa8da407c1339c357536e64b3129d8ce3b Mon Sep 17 00:00:00 2001
From: Ralf Habacker <ralf.habacker@freenet.de>
Date: Wed, 4 Mar 2020 15:23:17 +0100
Subject: [PATCH] Add apply button to unix variant of QPrintDialog

This also allows the Unix version of the print dialog to only adapt
changes and not to print immediately, which is possible on Windows.
---
 src/gui/dialogs/qprintdialog_unix.cpp | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp
index a851d47a2b..74493f4b98 100644
--- a/src/gui/dialogs/qprintdialog_unix.cpp
+++ b/src/gui/dialogs/qprintdialog_unix.cpp
@@ -128,6 +128,8 @@ public:
 #endif
     void _q_collapseOrExpandDialog();
 
+    void _q_applyDialog();
+
     void setupPrinter();
     void updateWidgets();
 
@@ -392,7 +394,7 @@ void QPrintDialogPrivate::init()
     options.grayscale->setIcon(QIcon(QLatin1String(":/trolltech/dialogs/qprintdialog/images/status-gray-scale.png")));
     top->d->setOptionsPane(this);
 
-    buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, q);
+    buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Apply, Qt::Horizontal, q);
     collapseButton = new QPushButton(QPrintDialog::tr("&Options >>"), buttons);
     buttons->addButton(collapseButton, QDialogButtonBox::ResetRole);
     bottom->setVisible(false);
@@ -400,6 +402,7 @@ void QPrintDialogPrivate::init()
     QPushButton *printButton = buttons->button(QDialogButtonBox::Ok);
     printButton->setText(QPrintDialog::tr("&Print"));
     printButton->setDefault(true);
+    QPushButton *applyButton = buttons->button(QDialogButtonBox::Apply);
 
     QVBoxLayout *lay = new QVBoxLayout(q);
     q->setLayout(lay);
@@ -422,6 +425,8 @@ void QPrintDialogPrivate::init()
                      q, SLOT(_q_chbPrintLastFirstToggled(bool)));
 
     QObject::connect(collapseButton, SIGNAL(released()), q, SLOT(_q_collapseOrExpandDialog()));
+
+    QObject::connect(applyButton, SIGNAL(released()), q, SLOT(_q_applyDialog()));
 }
 
 void QPrintDialogPrivate::applyPrinterProperties(QPrinter *p)
@@ -482,6 +487,13 @@ void QPrintDialogPrivate::_q_checkFields()
 }
 #endif // QT_NO_MESSAGEBOX
 
+void QPrintDialogPrivate::_q_applyDialog()
+{
+    Q_Q(QPrintDialog);
+    if (top->d->checkFields())
+        q->done((int)QDialog::Accepted+1);
+}
+
 void QPrintDialogPrivate::setupPrinter()
 {
     Q_Q(QPrintDialog);
-- 
2.16.4

openSUSE Build Service is sponsored by