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 Cups servers which announce themselves on avahi will be shown in
the printer dialog. This adds a delay the first time the print dialog 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 is opened in order to search for print queues . Because of this delay,
network printer queue and you find the delay too annoying, it can be the remote print queue discovery is disabled by default and can be enabled
disabled by setting the QT_DISABLE_PRINTER_DISCOVERY environment variable by setting the QT_ENABLE_PRINTER_DISCOVERY environment variable to 1.
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 +++++++- src/plugins/printsupport/cups/qcupsprintengine.cpp | 35 +++++++-
.../printsupport/cups/qcupsprintersupport.cpp | 95 ++++++++++++++++++++-- .../printsupport/cups/qcupsprintersupport.cpp | 95 ++++++++++++++++++++--
@ -39,7 +39,7 @@ Index: qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qcupsprintengi
+ bool fallbackToLocal = false; + bool fallbackToLocal = false;
+ cups_dest_t *cupsDest = NULL; + cups_dest_t *cupsDest = NULL;
+ +
+ if (qEnvironmentVariableIsSet("QT_DISABLE_PRINTER_DISCOVERY")) { + if (!qEnvironmentVariableIsSet("QT_ENABLE_PRINTER_DISCOVERY")) {
+ fallbackToLocal = true; + fallbackToLocal = true;
+ } else { + } else {
+ cupsDest = cupsGetDest(printerName.toLocal8Bit(), NULL, QCupsPrinterSupport::cupsPrintersCount(), QCupsPrinterSupport::cupsPrinters()); + 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); - int count = cupsGetDests(&dests);
- list.reserve(count); - list.reserve(count);
- for (int i = 0; i < count; ++i) { - for (int i = 0; i < count; ++i) {
+ bool disablePrinterDiscovery = qEnvironmentVariableIsSet("QT_DISABLE_PRINTER_DISCOVERY"); + bool enablePrinterDiscovery = qEnvironmentVariableIsSet("QT_ENABLE_PRINTER_DISCOVERY");
+ if (disablePrinterDiscovery) { + if (!enablePrinterDiscovery) {
+ qt_cups_num_printers = cupsGetDests(&dests); + qt_cups_num_printers = cupsGetDests(&dests);
+ } else { + } else {
+ if (qt_cups_num_printers == 0) + 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); list.append(printerId);
} }
- cupsFreeDests(count, dests); - cupsFreeDests(count, dests);
+ if (disablePrinterDiscovery) { + if (!enablePrinterDiscovery) {
+ cupsFreeDests(qt_cups_num_printers, dests); + 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); - int count = cupsGetDests(&dests);
- for (int i = 0; i < count; ++i) { - for (int i = 0; i < count; ++i) {
+ +
+ bool disablePrinterDiscovery = qEnvironmentVariableIsSet("QT_DISABLE_PRINTER_DISCOVERY"); + bool enablePrinterDiscovery = qEnvironmentVariableIsSet("QT_ENABLE_PRINTER_DISCOVERY");
+ if (disablePrinterDiscovery) { + if (!enablePrinterDiscovery) {
+ qt_cups_num_printers = cupsGetDests(&dests); + qt_cups_num_printers = cupsGetDests(&dests);
+ } else { + } else {
+ if (qt_cups_num_printers == 0) + 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); - cupsFreeDests(count, dests);
+ if (disablePrinterDiscovery) { + if (!enablePrinterDiscovery) {
+ cupsFreeDests(qt_cups_num_printers, dests); + cupsFreeDests(qt_cups_num_printers, dests);
+ } + }
return printerId; return printerId;
@ -250,12 +250,12 @@ Index: qtbase-everywhere-src-5.10.0/src/plugins/printsupport/cups/qppdprintdevic
m_cupsDest = 0; m_cupsDest = 0;
} }
+ bool disablePrinterDiscovery = qEnvironmentVariableIsSet("QT_DISABLE_PRINTER_DISCOVERY"); + bool enablePrinterDiscovery = qEnvironmentVariableIsSet("QT_ENABLE_PRINTER_DISCOVERY");
+ +
// Get the print instance and PPD file // Get the print instance and PPD file
- m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance); - m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance);
+ +
+ if (disablePrinterDiscovery) { + if (!enablePrinterDiscovery) {
+ m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance); + m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance);
+ } else { + } else {
+ cups_dest_t *cupsDest = cupsGetDest( m_cupsName, + 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; + http_t *http = NULL;
+ const char *ppdFile = NULL; + const char *ppdFile = NULL;
+ +
+ if (!disablePrinterDiscovery) { + if (enablePrinterDiscovery) {
+ http = cupsConnectDest (m_cupsDest, 0, -1, 0, + http = cupsConnectDest (m_cupsDest, 0, -1, 0,
+ resource, sizeof (resource), + resource, sizeof (resource),
+ 0, 0); + 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 Fri Feb 23 09:00:44 UTC 2018 - fabian@ritter-vogt.de