File 0013-cups-Dont-show-InstallableOptions-in-the-advanced-properties-tab.patch of Package libqt5-qtbase.16540

From bf59032d704f1163befc05e258a7f65887626add Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <albert.astals.cid@kdab.com>
Date: Wed, 27 Dec 2017 15:13:33 +0100
Subject: [PATCH 1/1] cups: Don't show InstallableOptions in the advanced
 properties

According to CUPS maintainer it is recommended to not show them[1].
GTK and Libreoffice behave like that.

[1] https://lists.cups.org/pipermail/cups/2015-September/027124.html

Change-Id: I82614003490554d41e38a125d44e3a599c2e7342
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
---
 src/printsupport/dialogs/qprintdialog_unix.cpp | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
index 29000bf..3a89c9e 100644
--- a/src/printsupport/dialogs/qprintdialog_unix.cpp
+++ b/src/printsupport/dialogs/qprintdialog_unix.cpp
@@ -1148,6 +1148,11 @@ void QUnixPrintWidget::updatePrinter()
 
 #if QT_CONFIG(cups)
 
+static bool isBlacklistedGroup(ppd_group_t *group) Q_DECL_NOTHROW
+{
+    return qstrcmp(group->name, "InstallableOptions") == 0;
+};
+
 QPPDOptionsModel::QPPDOptionsModel(QPrintDevice *currentPrintDevice, QObject *parent)
     : QAbstractItemModel(parent)
     , m_currentPrintDevice(currentPrintDevice)
@@ -1159,10 +1164,12 @@ QPPDOptionsModel::QPPDOptionsModel(QPrintDevice *currentPrintDevice, QObject *pa
     if (ppd) {
         m_cupsCodec = QTextCodec::codecForName(ppd->lang_encoding);
         for (int i = 0; i < ppd->num_groups; ++i) {
-            QOptionTreeItem *group = new QOptionTreeItem(QOptionTreeItem::Group, i, &ppd->groups[i], m_rootItem);
-            m_rootItem->childItems.append(group);
-            parseGroups(group); // parse possible subgroups
-            parseOptions(group); // parse options
+            if (!isBlacklistedGroup(&ppd->groups[i])) {
+                QOptionTreeItem *group = new QOptionTreeItem(QOptionTreeItem::Group, i, &ppd->groups[i], m_rootItem);
+                m_rootItem->childItems.append(group);
+                parseGroups(group); // parse possible subgroups
+                parseOptions(group); // parse options
+            }
         }
     }
 
@@ -1322,10 +1329,12 @@ void QPPDOptionsModel::parseGroups(QOptionTreeItem *parent)
 
     if (group) {
         for (int i = 0; i < group->num_subgroups; ++i) {
-            QOptionTreeItem *subgroup = new QOptionTreeItem(QOptionTreeItem::Group, i, &group->subgroups[i], parent);
-            parent->childItems.append(subgroup);
-            parseGroups(subgroup); // parse possible subgroups
-            parseOptions(subgroup); // parse options
+            if (!isBlacklistedGroup(&group->subgroups[i])) {
+                QOptionTreeItem *subgroup = new QOptionTreeItem(QOptionTreeItem::Group, i, &group->subgroups[i], parent);
+                parent->childItems.append(subgroup);
+                parseGroups(subgroup); // parse possible subgroups
+                parseOptions(subgroup); // parse options
+            }
         }
     }
 }
-- 
2.7.4
openSUSE Build Service is sponsored by