print-manager/print-manager-4.14.2-cups-2.0.0-2.patch

169 lines
7.8 KiB
Diff
Raw Normal View History

From 731085d7720e7128ab102ef80383d1bfaea27661 Mon Sep 17 00:00:00 2001
From: Daniel Nicoletti <dantti12@gmail.com>
Date: Mon, 25 Aug 2014 17:04:18 -0300
Subject: [PATCH 2/2] Fix ifdef's logic to still match 1.6 onwards and 1.6
backwards BUG:338543
---
libkcups/KCupsConnection.cpp | 16 ++++++++--------
libkcups/KCupsServer.cpp | 6 +++---
printer-manager-kcm/PrintKCM.cpp | 16 ++++++++--------
3 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/libkcups/KCupsConnection.cpp b/libkcups/KCupsConnection.cpp
index a49d590..335fc46 100644
--- a/libkcups/KCupsConnection.cpp
+++ b/libkcups/KCupsConnection.cpp
@@ -377,11 +377,11 @@ int KCupsConnection::renewDBusSubscription(int subscriptionId, int leaseDuration
response = request.sendIppRequest();
} while (retry("/", operation));
-#if CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR >= 6
+#if !(CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6)
if (response && ippGetStatusCode(response) == IPP_OK) {
#else
if (response && response->request.status.status_code == IPP_OK) {
-#endif // CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR >= 6
+#endif // !(CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6)
ipp_attribute_t *attr;
if (subscriptionId >= 0) {
// Request was ok, just return the current subscription
@@ -392,7 +392,7 @@ int KCupsConnection::renewDBusSubscription(int subscriptionId, int leaseDuration
kWarning() << "No notify-subscription-id in response!";
ret = -1;
} else {
-#if CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR >= 6
+#if !(CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6)
ret = ippGetInteger(attr, 0);
}
} else if (subscriptionId >= 0 && response && ippGetStatusCode(response) == IPP_NOT_FOUND) {
@@ -406,7 +406,7 @@ int KCupsConnection::renewDBusSubscription(int subscriptionId, int leaseDuration
kDebug() << "Subscription not found";
// When the subscription is not found try to get a new one
return renewDBusSubscription(-1, leaseDuration, events);
-#endif // CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR >= 6
+#endif // !(CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6)
} else {
kDebug() << "Request failed" << cupsLastError() << httpGetStatus(CUPS_HTTP_DEFAULT);
// When the server stops/restarts we will have some error so ignore it
@@ -582,7 +582,7 @@ ReturnArguments KCupsConnection::parseIPPVars(ipp_t *response, ipp_tag_t group_t
ipp_attribute_t *attr;
ReturnArguments ret;
-#if CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR >= 6
+#if !(CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6)
QVariantHash destAttributes;
for (attr = ippFirstAttribute(response); attr != NULL; attr = ippNextAttribute(response)) {
// We hit an attribute sepparator
@@ -659,7 +659,7 @@ ReturnArguments KCupsConnection::parseIPPVars(ipp_t *response, ipp_tag_t group_t
break;
}
}
-#endif // CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR >= 6
+#endif // !(CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6)
return ret;
}
@@ -667,7 +667,7 @@ ReturnArguments KCupsConnection::parseIPPVars(ipp_t *response, ipp_tag_t group_t
QVariant KCupsConnection::ippAttrToVariant(ipp_attribute_t *attr)
{
QVariant ret;
-#if CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR >= 6
+#if !(CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6)
switch (ippGetValueTag(attr)) {
case IPP_TAG_INTEGER:
case IPP_TAG_ENUM:
@@ -760,7 +760,7 @@ QVariant KCupsConnection::ippAttrToVariant(ipp_attribute_t *attr)
ret = values;
}
}
-#endif // CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR >= 6
+#endif // !(CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6)
return ret;
}
diff --git a/libkcups/KCupsServer.cpp b/libkcups/KCupsServer.cpp
index a28a11a..d5a81c5 100644
--- a/libkcups/KCupsServer.cpp
+++ b/libkcups/KCupsServer.cpp
@@ -56,7 +56,7 @@ void KCupsServer::setAllowUserCancelAnyJobs(bool allow)
bool KCupsServer::showSharedPrinters() const
{
-#if CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR < 6
+#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6
return m_arguments.value(CUPS_SERVER_REMOTE_PRINTERS).toBool();
#else
return false;
@@ -65,11 +65,11 @@ bool KCupsServer::showSharedPrinters() const
void KCupsServer::setShowSharedPrinters(bool show)
{
-#if CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR < 6
+#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6
m_arguments[CUPS_SERVER_REMOTE_PRINTERS] = show ? QLatin1String("1") : QLatin1String("0");
#else
Q_UNUSED(show)
-#endif // CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR < 6
+#endif // CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6
}
bool KCupsServer::sharePrinters() const
diff --git a/printer-manager-kcm/PrintKCM.cpp b/printer-manager-kcm/PrintKCM.cpp
index edf2a9c..823b12e 100644
--- a/printer-manager-kcm/PrintKCM.cpp
+++ b/printer-manager-kcm/PrintKCM.cpp
@@ -83,11 +83,11 @@ PrintKCM::PrintKCM(QWidget *parent, const QVariantList &args) :
QMenu *systemMenu = new QMenu(this);
connect(systemMenu, SIGNAL(aboutToShow()), this, SLOT(getServerSettings()));
connect(systemMenu, SIGNAL(triggered(QAction*)), this, SLOT(systemPreferencesTriggered()));
-#if CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR < 6
+#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6
m_showSharedPrinters = systemMenu->addAction(i18nc("@action:intoolbar","Show printers shared by other systems"));
m_showSharedPrinters->setCheckable(true);
systemMenu->addSeparator();
-#endif // CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR < 6
+#endif // CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6
m_shareConnectedPrinters = systemMenu->addAction(i18nc("@action:intoolbar","Share printers connected to this system"));
m_shareConnectedPrinters->setCheckable(true);
m_allowPrintringFromInternet = systemMenu->addAction(i18nc("@action:intoolbar","Allow printing from the Internet"));
@@ -325,9 +325,9 @@ void PrintKCM::getServerSettingsFinished()
// we can safely ignore the error since it DOES bring the server settings
bool error = request->hasError() && request->error() != IPP_NOT_FOUND;
-#if CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR < 6
+#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6
m_showSharedPrinters->setEnabled(!error);
-#endif // CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR < 6
+#endif // CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6
m_shareConnectedPrinters->setEnabled(!error);
m_allowRemoteAdmin->setEnabled(!error);
m_allowUsersCancelAnyJob->setEnabled(!error);
@@ -342,9 +342,9 @@ void PrintKCM::getServerSettingsFinished()
} else {
KCupsServer server = request->serverSettings();
-#if CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR < 6
+#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6
m_showSharedPrinters->setChecked(server.showSharedPrinters());
-#endif // CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR < 6
+#endif // CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6
m_shareConnectedPrinters->setChecked(server.sharePrinters());
m_allowPrintringFromInternet->setChecked(server.allowPrintingFromInternet());
m_allowRemoteAdmin->setChecked(server.allowRemoteAdmin());
@@ -381,9 +381,9 @@ void PrintKCM::updateServerFinished()
void PrintKCM::systemPreferencesTriggered()
{
KCupsServer server;
-#if CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR < 6
+#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6
server.setShowSharedPrinters(m_showSharedPrinters->isChecked());
-#endif // CUPS_VERSION_MAJOR >= 1 && CUPS_VERSION_MINOR < 6
+#endif // CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 6
server.setSharePrinters(m_shareConnectedPrinters->isChecked());
server.setAllowPrintingFromInternet(m_allowPrintringFromInternet->isChecked());
server.setAllowRemoteAdmin(m_allowRemoteAdmin->isChecked());
--
1.9.3