1
0
forked from pool/libqt5-qtbase
Dominique Leuenberger 2018-03-04 10:54:46 +00:00 committed by Git OBS Bridge
parent b83c455678
commit 65e6f384bc
2 changed files with 23 additions and 15 deletions

View File

@ -5,12 +5,12 @@ Subject: [PATCH] Add remote print queue support
Cups servers which announce themselves on avahi will be shown in
the printer dialog. This adds a delay the first time the print dialog
is opened in order to search for print queues . If you don't have any
network printer queue and you find the delay too annoying, it can be
disabled by setting the QT_DISABLE_PRINTER_DISCOVERY environment variable
to 1
is opened in order to search for print queues . Because of this delay,
the remote print queue discovery is disabled by default and can be enabled
by setting the QT_ENABLE_PRINTER_DISCOVERY environment variable to 1.
Change-Id: Ib70715d331e8f380a3c9039011bb8521986652aa
The commit to Qt (which enabled the discovery by default) has
a Change-Id: Ib70715d331e8f380a3c9039011bb8521986652aa
---
src/plugins/printsupport/cups/qcupsprintengine.cpp | 35 +++++++-
.../printsupport/cups/qcupsprintersupport.cpp | 95 ++++++++++++++++++++--
@ -39,7 +39,7 @@ Index: qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qcupsprintengi
+ bool fallbackToLocal = false;
+ cups_dest_t *cupsDest = NULL;
+
+ if (qEnvironmentVariableIsSet("QT_DISABLE_PRINTER_DISCOVERY")) {
+ if (!qEnvironmentVariableIsSet("QT_ENABLE_PRINTER_DISCOVERY")) {
+ fallbackToLocal = true;
+ } else {
+ cupsDest = cupsGetDest(printerName.toLocal8Bit(), NULL, QCupsPrinterSupport::cupsPrintersCount(), QCupsPrinterSupport::cupsPrinters());
@ -128,8 +128,8 @@ Index: qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qcupsprintersu
- int count = cupsGetDests(&dests);
- list.reserve(count);
- for (int i = 0; i < count; ++i) {
+ bool disablePrinterDiscovery = qEnvironmentVariableIsSet("QT_DISABLE_PRINTER_DISCOVERY");
+ if (disablePrinterDiscovery) {
+ bool enablePrinterDiscovery = qEnvironmentVariableIsSet("QT_ENABLE_PRINTER_DISCOVERY");
+ if (!enablePrinterDiscovery) {
+ qt_cups_num_printers = cupsGetDests(&dests);
+ } else {
+ if (qt_cups_num_printers == 0)
@ -146,7 +146,7 @@ Index: qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qcupsprintersu
list.append(printerId);
}
- cupsFreeDests(count, dests);
+ if (disablePrinterDiscovery) {
+ if (!enablePrinterDiscovery) {
+ cupsFreeDests(qt_cups_num_printers, dests);
+ }
+
@ -160,8 +160,8 @@ Index: qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qcupsprintersu
- int count = cupsGetDests(&dests);
- for (int i = 0; i < count; ++i) {
+
+ bool disablePrinterDiscovery = qEnvironmentVariableIsSet("QT_DISABLE_PRINTER_DISCOVERY");
+ if (disablePrinterDiscovery) {
+ bool enablePrinterDiscovery = qEnvironmentVariableIsSet("QT_ENABLE_PRINTER_DISCOVERY");
+ if (!enablePrinterDiscovery) {
+ qt_cups_num_printers = cupsGetDests(&dests);
+ } else {
+ if (qt_cups_num_printers == 0)
@ -179,7 +179,7 @@ Index: qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qcupsprintersu
}
}
- cupsFreeDests(count, dests);
+ if (disablePrinterDiscovery) {
+ if (!enablePrinterDiscovery) {
+ cupsFreeDests(qt_cups_num_printers, dests);
+ }
return printerId;
@ -250,12 +250,12 @@ Index: qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qppdprintdevic
m_cupsDest = 0;
}
+ bool disablePrinterDiscovery = qEnvironmentVariableIsSet("QT_DISABLE_PRINTER_DISCOVERY");
+ bool enablePrinterDiscovery = qEnvironmentVariableIsSet("QT_ENABLE_PRINTER_DISCOVERY");
+
// Get the print instance and PPD file
- m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance);
+
+ if (disablePrinterDiscovery) {
+ if (!enablePrinterDiscovery) {
+ m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance);
+ } else {
+ cups_dest_t *cupsDest = cupsGetDest( m_cupsName,
@ -270,7 +270,7 @@ Index: qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qppdprintdevic
+ http_t *http = NULL;
+ const char *ppdFile = NULL;
+
+ if (!disablePrinterDiscovery) {
+ if (enablePrinterDiscovery) {
+ http = cupsConnectDest (m_cupsDest, 0, -1, 0,
+ resource, sizeof (resource),
+ 0, 0);

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Mar 1 12:14:13 UTC 2018 - alarrosa@suse.com
- Rework 0001-Add-remote-print-queue-support.patch so now the remote
print queue discovery is disabled by default and is only enabled when
the QT_ENABLE_PRINTER_DISCOVERY environment variable is set
(QT_DISABLE_PRINTER_DISCOVERY is no longer used).
-------------------------------------------------------------------
Fri Feb 23 09:00:44 UTC 2018 - fabian@ritter-vogt.de