diff --git a/kdelibs-3.5.10-cups16.patch b/kdelibs-3.5.10-cups16.patch new file mode 100644 index 0000000..e1664b3 --- /dev/null +++ b/kdelibs-3.5.10-cups16.patch @@ -0,0 +1,849 @@ +diff -ur kdelibs-3.5.10/kdeprint/configure.in.in kdelibs-3.5.10-cups16/kdeprint/configure.in.in +--- kdelibs-3.5.10/kdeprint/configure.in.in 2005-09-10 10:27:43.000000000 +0200 ++++ kdelibs-3.5.10-cups16/kdeprint/configure.in.in 2012-12-25 16:29:53.000000000 +0100 +@@ -84,6 +84,13 @@ + if test "$ac_have_new_cups" = "yes"; then + AC_DEFINE(HAVE_CUPS_NO_PWD_CACHE, 1, CUPS doesn't have password caching) + fi ++ ++ dnl check if CUPS is at least 1.6 ++ ac_have_new_cups="no" ++ AC_CHECK_CUPS_VERSION(1.06) ++ if test "$ac_have_new_cups" = "yes"; then ++ AC_DEFINE(HAVE_CUPS_1_6, 1, CUPS is at least version 1.6) ++ fi + fi + fi + LDFLAGS="$ac_LDFLAGS_save" +diff -ur kdelibs-3.5.10/kdeprint/cups/cupsdconf2/cupsdconf.cpp kdelibs-3.5.10-cups16/kdeprint/cups/cupsdconf2/cupsdconf.cpp +--- kdelibs-3.5.10/kdeprint/cups/cupsdconf2/cupsdconf.cpp 2005-10-10 17:06:30.000000000 +0200 ++++ kdelibs-3.5.10-cups16/kdeprint/cups/cupsdconf2/cupsdconf.cpp 2012-12-25 16:34:57.000000000 +0100 +@@ -629,26 +629,44 @@ + cups_lang_t* lang = cupsLangDefault(); + ippAddString(request_, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, cupsLangEncoding(lang)); + ippAddString(request_, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, lang->language); ++#ifdef HAVE_CUPS_1_6 ++ ippSetOperation(request_, CUPS_GET_PRINTERS); ++#else // HAVE_CUPS_1_6 + request_->request.op.operation_id = CUPS_GET_PRINTERS; ++#endif // HAVE_CUPS_1_6 + request_ = cupsDoRequest(http_, request_, "/printers/"); + if (request_) + { + QString name; + int type(0); ++#ifdef HAVE_CUPS_1_6 ++ ipp_attribute_t *attr = ippFirstAttribute(request_); ++#else // HAVE_CUPS_1_6 + ipp_attribute_t *attr = request_->attrs; ++#endif // HAVE_CUPS_1_6 + while (attr) + { + // check new printer (keep only local non-implicit printers) ++#ifdef HAVE_CUPS_1_6 ++ if (!ippGetName(attr)) ++#else // HAVE_CUPS_1_6 + if (!attr->name) ++#endif // HAVE_CUPS_1_6 + { + if (!(type & CUPS_PRINTER_REMOTE) && !(type & CUPS_PRINTER_IMPLICIT) && !name.isEmpty()) + resources_.append(new CupsResource("/printers/"+name)); + name = ""; + type = 0; + } ++#ifdef HAVE_CUPS_1_6 ++ else if (strcmp(ippGetName(attr), "printer-name") == 0) name = ippGetString(attr, 0, NULL); ++ else if (strcmp(ippGetName(attr), "printer-type") == 0) type = ippGetInteger(attr, 0); ++ attr = ippNextAttribute(request_); ++#else // HAVE_CUPS_1_6 + else if (strcmp(attr->name, "printer-name") == 0) name = attr->values[0].string.text; + else if (strcmp(attr->name, "printer-type") == 0) type = attr->values[0].integer; + attr = attr->next; ++#endif // HAVE_CUPS_1_6 + } + if (!(type & CUPS_PRINTER_REMOTE) && !(type & CUPS_PRINTER_IMPLICIT) && !name.isEmpty()) + resources_.append(new CupsResource("/printers/"+name)); +@@ -658,26 +676,44 @@ + request_ = ippNew(); + ippAddString(request_, IPP_TAG_OPERATION, IPP_TAG_CHARSET, "attributes-charset", NULL, cupsLangEncoding(lang)); + ippAddString(request_, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, lang->language); ++#ifdef HAVE_CUPS_1_6 ++ ippSetOperation(request_, CUPS_GET_CLASSES); ++#else // HAVE_CUPS_1_6 + request_->request.op.operation_id = CUPS_GET_CLASSES; ++#endif // HAVE_CUPS_1_6 + request_ = cupsDoRequest(http_, request_, "/classes/"); + if (request_) + { + QString name; + int type(0); ++#ifdef HAVE_CUPS_1_6 ++ ipp_attribute_t *attr = ippFirstAttribute(request_); ++#else // HAVE_CUPS_1_6 + ipp_attribute_t *attr = request_->attrs; ++#endif // HAVE_CUPS_1_6 + while (attr) + { + // check new class (keep only local classes) ++#ifdef HAVE_CUPS_1_6 ++ if (!ippGetName(attr)) ++#else // HAVE_CUPS_1_6 + if (!attr->name) ++#endif // HAVE_CUPS_1_6 + { + if (!(type & CUPS_PRINTER_REMOTE) && !name.isEmpty()) + resources_.append(new CupsResource("/classes/"+name)); + name = ""; + type = 0; + } ++#ifdef HAVE_CUPS_1_6 ++ else if (strcmp(ippGetName(attr), "printer-name") == 0) name = ippGetString(attr, 0, NULL); ++ else if (strcmp(ippGetName(attr), "printer-type") == 0) type = ippGetInteger(attr, 0); ++ attr = ippNextAttribute(request_); ++#else // HAVE_CUPS_1_6 + else if (strcmp(attr->name, "printer-name") == 0) name = attr->values[0].string.text; + else if (strcmp(attr->name, "printer-type") == 0) type = attr->values[0].integer; + attr = attr->next; ++#endif // HAVE_CUPS_1_6 + } + if (!(type & CUPS_PRINTER_REMOTE) && !name.isEmpty()) + resources_.append(new CupsResource("/classes/"+name)); +diff -ur kdelibs-3.5.10/kdeprint/cups/ipprequest.cpp kdelibs-3.5.10-cups16/kdeprint/cups/ipprequest.cpp +--- kdelibs-3.5.10/kdeprint/cups/ipprequest.cpp 2007-10-08 11:52:10.000000000 +0200 ++++ kdelibs-3.5.10-cups16/kdeprint/cups/ipprequest.cpp 2012-12-25 16:55:53.000000000 +0100 +@@ -51,6 +51,58 @@ + kdDebug(500) << "Null request" << endl; + return; + } ++#ifdef HAVE_CUPS_1_6 ++ kdDebug(500) << "State = 0x" << QString::number(ippGetState(req), 16) << endl; ++ kdDebug(500) << "ID = 0x" << QString::number(ippGetRequestId(req), 16) << endl; ++ if (answer) ++ { ++ kdDebug(500) << "Status = 0x" << QString::number(ippGetStatusCode(req), 16) << endl; ++ kdDebug(500) << "Status message = " << ippErrorString(ippGetStatusCode(req)) << endl; ++ } ++ else ++ kdDebug(500) << "Operation = 0x" << QString::number(ippGetOperation(req), 16) << endl; ++ int minorVersion; ++ int majorVersion = ippGetVersion(req, &minorVersion); ++ kdDebug(500) << "Version = " << (int)(majorVersion) << "." << (int)(minorVersion) << endl; ++ kdDebug(500) << endl; ++ ++ ipp_attribute_t *attr = ippFirstAttribute(req); ++ while (attr) ++ { ++ QString s = QString::fromLatin1("%1 (0x%2) = ").arg(ippGetName(attr)).arg(ippGetValueTag(attr), 0, 16); ++ for (int i=0;istate, 16) << endl; + kdDebug(500) << "ID = 0x" << QString::number(req->request.status.request_id, 16) << endl; + if (answer) +@@ -99,6 +151,7 @@ + kdDebug(500) << s << endl; + attr = attr->next; + } ++#endif // HAVE_CUPS_1_6 + } + + QString errorString(int status) +@@ -177,7 +230,11 @@ + ipp_attribute_t *attr = ippAddStrings(request_,(ipp_tag_t)group,(ipp_tag_t)type,name.latin1(),(int)(values.count()),NULL,NULL); + int i(0); + for (QStringList::ConstIterator it=values.begin(); it != values.end(); ++it, i++) ++#ifdef HAVE_CUPS_1_6 ++ ippSetString(request_, &attr, i, strdup((*it).local8Bit())); ++#else // HAVE_CUPS_1_6 + attr->values[i].string.text = strdup((*it).local8Bit()); ++#endif // HAVE_CUPS_1_6 + } + } + +@@ -193,7 +250,11 @@ + ipp_attribute_t *attr = ippAddIntegers(request_,(ipp_tag_t)group,(ipp_tag_t)type,name.latin1(),(int)(values.count()),NULL); + int i(0); + for (QValueList::ConstIterator it=values.begin(); it != values.end(); ++it, i++) ++#ifdef HAVE_CUPS_1_6 ++ ippSetInteger(request_, &attr, i, *it); ++#else // HAVE_CUPS_1_6 + attr->values[i].integer = *it; ++#endif // HAVE_CUPS_1_6 + } + } + +@@ -209,19 +270,32 @@ + ipp_attribute_t *attr = ippAddBooleans(request_,(ipp_tag_t)group,name.latin1(),(int)(values.count()),NULL); + int i(0); + for (QValueList::ConstIterator it=values.begin(); it != values.end(); ++it, i++) ++#ifdef HAVE_CUPS_1_6 ++ ippSetBoolean(request_, &attr, i, (char)(*it)); ++#else // HAVE_CUPS_1_6 + attr->values[i].boolean = (char)(*it); ++#endif // HAVE_CUPS_1_6 + } + } + + void IppRequest::setOperation(int op) + { ++#ifdef HAVE_CUPS_1_6 ++ ippSetOperation(request_, (ipp_op_t)op); ++ ippSetRequestId(request_, 1); // 0 is not RFC-compliant, should be at least 1 ++#else // HAVE_CUPS_1_6 + request_->request.op.operation_id = (ipp_op_t)op; + request_->request.op.request_id = 1; // 0 is not RFC-compliant, should be at least 1 ++#endif // HAVE_CUPS_1_6 + } + + int IppRequest::status() + { ++#ifdef HAVE_CUPS_1_6 ++ return (request_ ? ippGetStatusCode(request_) : (connect_ ? cupsLastError() : -2)); ++#else // HAVE_CUPS_1_6 + return (request_ ? request_->request.status.status_code : (connect_ ? cupsLastError() : -2)); ++#endif // HAVE_CUPS_1_6 + } + + QString IppRequest::statusMessage() +@@ -248,7 +322,11 @@ + ipp_attribute_t *attr = ippFindAttribute(request_, name.latin1(), (ipp_tag_t)type); + if (attr) + { ++#ifdef HAVE_CUPS_1_6 ++ value = ippGetInteger(attr, 0); ++#else // HAVE_CUPS_1_6 + value = attr->values[0].integer; ++#endif // HAVE_CUPS_1_6 + return true; + } + else return false; +@@ -260,7 +338,11 @@ + ipp_attribute_t *attr = ippFindAttribute(request_, name.latin1(), (ipp_tag_t)type); + if (attr) + { ++#ifdef HAVE_CUPS_1_6 ++ value = QString::fromLocal8Bit(ippGetString(attr, 0, NULL)); ++#else // HAVE_CUPS_1_6 + value = QString::fromLocal8Bit(attr->values[0].string.text); ++#endif // HAVE_CUPS_1_6 + return true; + } + else return false; +@@ -273,8 +355,13 @@ + values.clear(); + if (attr) + { ++#ifdef HAVE_CUPS_1_6 ++ for (int i=0;inum_values;i++) + values.append(QString::fromLocal8Bit(attr->values[i].string.text)); ++#endif // HAVE_CUPS_1_6 + return true; + } + else return false; +@@ -286,7 +373,11 @@ + ipp_attribute_t *attr = ippFindAttribute(request_, name.latin1(), IPP_TAG_BOOLEAN); + if (attr) + { ++#ifdef HAVE_CUPS_1_6 ++ value = (bool)ippGetBoolean(attr, 0); ++#else // HAVE_CUPS_1_6 + value = (bool)attr->values[0].boolean; ++#endif // HAVE_CUPS_1_6 + return true; + } + else return false; +@@ -338,10 +429,18 @@ + } + + /* No printers found */ ++#ifdef HAVE_CUPS_1_6 ++ if ( request_ && ippGetStatusCode(request_) == 0x406 ) ++#else // HAVE_CUPS_1_6 + if ( request_ && request_->request.status.status_code == 0x406 ) ++#endif // HAVE_CUPS_1_6 + return true; + ++#ifdef HAVE_CUPS_1_6 ++ if (!request_ || ippGetState(request_) == IPP_ERROR || (ippGetStatusCode(request_) & 0x0F00)) ++#else // HAVE_CUPS_1_6 + if (!request_ || request_->state == IPP_ERROR || (request_->request.status.status_code & 0x0F00)) ++#endif // HAVE_CUPS_1_6 + return false; + + +@@ -356,14 +455,88 @@ + output << "" << i18n("Attribute") << "" << endl; + output << "" << i18n("Values") << "" << endl; + // go to the first attribute of the specified group ++#ifdef HAVE_CUPS_1_6 ++ ipp_attribute_t *attr = ippFirstAttribute(request_); ++ while (attr && ippGetGroupTag(attr) != group) ++ attr = ippNextAttribute(request_); ++#else // HAVE_CUPS_1_6 + ipp_attribute_t *attr = request_->attrs; + while (attr && attr->group_tag != group) + attr = attr->next; ++#endif // HAVE_CUPS_1_6 + // print each attribute +- ipp_uchar_t *d; +- QCString dateStr; +- QDateTime dt; +- bool bg(false); ++ const ipp_uchar_t *d; ++ QCString dateStr; ++ QDateTime dt; ++ bool bg(false); ++#ifdef HAVE_CUPS_1_6 ++ while (attr && ippGetGroupTag(attr) == group) ++ { ++ output << " \n " << ippGetName(attr) << "\n " << endl; ++ bg = !bg; ++ for (int i=0; i 0 ? lowervalue : 1) ++ << ", " << (uppervalue > 0 ? uppervalue : 65535) << " ]"; ++ break; ++ case IPP_TAG_DATE: ++ d = ippGetDate(attr, i); ++ dateStr.sprintf("%.4d-%.2d-%.2d, %.2d:%.2d:%.2d %c%.2d%.2d", ++ d[0]*256+d[1], d[2], d[3], ++ d[4], d[5], d[6], ++ d[8], d[9], d[10]); ++ output << dateStr; ++ break; ++ default: ++ continue; ++ } ++ if (i < ippGetCount(attr)-1) ++ output << "
"; ++ } ++ output << "\n " << endl; ++ attr = ippNextAttribute(request_); ++#else // HAVE_CUPS_1_6 + while (attr && attr->group_tag == group) + { + output << " \n " << attr->name << "\n " << endl; +@@ -423,6 +596,7 @@ + } + output << "\n " << endl; + attr = attr->next; ++#endif // HAVE_CUPS_1_6 + } + // end table + output << "" << endl; +@@ -438,6 +612,59 @@ + ipp_attribute_t *attr = first(); + while (attr) + { ++#ifdef HAVE_CUPS_1_6 ++ if (group != -1 && ippGetGroupTag(attr) != group) ++ { ++ attr = ippNextAttribute(request_); ++ continue; ++ } ++ QString value; ++ for (int i=0; i 0) ++ value.append(QString::number(lowervalue)); ++ if (lowervalue != uppervalue) ++ { ++ value.append("-"); ++ if (uppervalue > 0) ++ value.append(QString::number(uppervalue)); ++ } ++ value.append(","); ++ break; ++ case IPP_TAG_STRING: ++ case IPP_TAG_TEXT: ++ case IPP_TAG_NAME: ++ case IPP_TAG_KEYWORD: ++ case IPP_TAG_URI: ++ case IPP_TAG_MIMETYPE: ++ case IPP_TAG_NAMELANG: ++ case IPP_TAG_TEXTLANG: ++ case IPP_TAG_CHARSET: ++ case IPP_TAG_LANGUAGE: ++ value.append(QString::fromLocal8Bit(ippGetString(attr, i, NULL))).append(","); ++ break; ++ default: ++ break; ++ } ++ } ++ if (!value.isEmpty()) ++ value.truncate(value.length()-1); ++ opts[QString::fromLocal8Bit(ippGetName(attr))] = value; ++ attr = ippNextAttribute(request_); ++#else // HAVE_CUPS_1_6 + if (group != -1 && attr->group_tag != group) + { + attr = attr->next; +@@ -486,6 +713,7 @@ + value.truncate(value.length()-1); + opts[QString::fromLocal8Bit(attr->name)] = value; + attr = attr->next; ++#endif // HAVE_CUPS_1_6 + } + } + return opts; +@@ -542,3 +770,11 @@ + } + #endif + } ++ ++#ifdef HAVE_CUPS_1_6 ++ipp_attribute_t* IppRequest::first() ++{ return (request_ ? ippFirstAttribute(request_) : NULL); } ++#else // HAVE_CUPS_1_6 ++ipp_attribute_t* IppRequest::first() ++{ return (request_ ? request_->attrs : NULL); } ++#endif // HAVE_CUPS_1_6 +diff -ur kdelibs-3.5.10/kdeprint/cups/ipprequest.h kdelibs-3.5.10-cups16/kdeprint/cups/ipprequest.h +--- kdelibs-3.5.10/kdeprint/cups/ipprequest.h 2005-10-10 17:06:30.000000000 +0200 ++++ kdelibs-3.5.10-cups16/kdeprint/cups/ipprequest.h 2012-12-25 16:37:50.000000000 +0100 +@@ -27,6 +27,8 @@ + + #include + ++#include "config.h" ++ + class IppRequest + { + public: +@@ -72,7 +74,10 @@ + bool keyword(const QString& name, QStringList& value); + bool mime(const QString& name, QString& value); + ipp_attribute_t* first(); ++#ifndef HAVE_CUPS_1_6 + ipp_attribute_t* last(); ++#endif // HAVE_CUPS_1_6 ++ ipp_t* request(); + QMap toMap(int group = -1); + void setMap(const QMap& opts); + +@@ -178,11 +183,10 @@ + inline bool IppRequest::doRequest(const QString& res) + { return doFileRequest(res); } + +-inline ipp_attribute_t* IppRequest::first() +-{ return (request_ ? request_->attrs : NULL); } +- ++#ifndef HAVE_CUPS_1_6 + inline ipp_attribute_t* IppRequest::last() + { return (request_ ? request_->last : NULL); } ++#endif // HAVE_CUPS_1_6 + + inline void IppRequest::setHost(const QString& host) + { host_ = host; } +@@ -193,4 +197,7 @@ + inline void IppRequest::dump(int state) + { dump_ = state; } + ++inline ipp_t* IppRequest::request() ++{ return request_; } ++ + #endif +diff -ur kdelibs-3.5.10/kdeprint/cups/kmcupsjobmanager.cpp kdelibs-3.5.10-cups16/kdeprint/cups/kmcupsjobmanager.cpp +--- kdelibs-3.5.10/kdeprint/cups/kmcupsjobmanager.cpp 2007-01-15 12:34:19.000000000 +0100 ++++ kdelibs-3.5.10-cups16/kdeprint/cups/kmcupsjobmanager.cpp 2012-12-25 16:34:57.000000000 +0100 +@@ -36,6 +36,8 @@ + #include + #include + ++#include "config.h" ++ + KMCupsJobManager::KMCupsJobManager(QObject *parent, const char *name, const QStringList & /*args*/) + : KMJobManager(parent,name) + { +@@ -166,10 +168,79 @@ + void KMCupsJobManager::parseListAnswer(IppRequest& req, KMPrinter *pr) + { + ipp_attribute_t *attr = req.first(); ++ ipp_attribute_t *nextAttr; + KMJob *job = new KMJob(); + QString uri; + while (attr) + { ++#ifdef HAVE_CUPS_1_6 ++ QString name(ippGetName(attr)); ++ if (name == "job-id") job->setId(ippGetInteger(attr, 0)); ++ else if (name == "job-uri") job->setUri(QString::fromLocal8Bit(ippGetString(attr, 0, NULL))); ++ else if (name == "job-name") job->setName(QString::fromLocal8Bit(ippGetString(attr, 0, NULL))); ++ else if (name == "job-state") ++ { ++ switch (ippGetInteger(attr, 0)) ++ { ++ case IPP_JOB_PENDING: ++ job->setState(KMJob::Queued); ++ break; ++ case IPP_JOB_HELD: ++ job->setState(KMJob::Held); ++ break; ++ case IPP_JOB_PROCESSING: ++ job->setState(KMJob::Printing); ++ break; ++ case IPP_JOB_STOPPED: ++ job->setState(KMJob::Error); ++ break; ++ case IPP_JOB_CANCELLED: ++ job->setState(KMJob::Cancelled); ++ break; ++ case IPP_JOB_ABORTED: ++ job->setState(KMJob::Aborted); ++ break; ++ case IPP_JOB_COMPLETED: ++ job->setState(KMJob::Completed); ++ break; ++ default: ++ job->setState(KMJob::Unknown); ++ break; ++ } ++ } ++ else if (name == "job-k-octets") job->setSize(ippGetInteger(attr, 0)); ++ else if (name == "job-originating-user-name") job->setOwner(QString::fromLocal8Bit(ippGetString(attr, 0, NULL))); ++ else if (name == "job-k-octets-completed") job->setProcessedSize(ippGetInteger(attr, 0)); ++ else if (name == "job-media-sheets") job->setPages(ippGetInteger(attr, 0)); ++ else if (name == "job-media-sheets-completed") job->setProcessedPages(ippGetInteger(attr, 0)); ++ else if (name == "job-printer-uri" && !pr->isRemote()) ++ { ++ QString str(ippGetString(attr, 0, NULL)); ++ int p = str.findRev('/'); ++ if (p != -1) ++ job->setPrinter(str.mid(p+1)); ++ } ++ else if (name == "job-priority") ++ { ++ job->setAttribute(0, QString::fromLatin1("%1").arg(ippGetInteger(attr, 0), 3)); ++ } ++ else if (name == "job-billing") ++ { ++ job->setAttributeCount(2); ++ job->setAttribute(1, QString::fromLocal8Bit(ippGetString(attr, 0, NULL))); ++ } ++ ++ nextAttr = ippNextAttribute(req.request()); ++ if (name.isEmpty() || (!nextAttr)) ++ { ++ if (job->printer().isEmpty()) ++ job->setPrinter(pr->printerName()); ++ job->setRemote(pr->isRemote()); ++ addJob(job); // don't use job after this call !!! ++ job = new KMJob(); ++ } ++ attr = nextAttr; ++#else // HAVE_CUPS_1_6 + QString name(attr->name); + if (name == "job-id") job->setId(attr->values[0].integer); + else if (name == "job-uri") job->setUri(QString::fromLocal8Bit(attr->values[0].string.text)); +@@ -236,6 +307,7 @@ + } + + attr = attr->next; ++#endif // HAVE_CUPS_1_6 + } + delete job; + } +diff -ur kdelibs-3.5.10/kdeprint/cups/kmcupsmanager.cpp kdelibs-3.5.10-cups16/kdeprint/cups/kmcupsmanager.cpp +--- kdelibs-3.5.10/kdeprint/cups/kmcupsmanager.cpp 2007-01-15 12:34:19.000000000 +0100 ++++ kdelibs-3.5.10-cups16/kdeprint/cups/kmcupsmanager.cpp 2012-12-25 16:34:57.000000000 +0100 +@@ -476,9 +476,59 @@ + void KMCupsManager::processRequest(IppRequest* req) + { + ipp_attribute_t *attr = req->first(); ++ ipp_attribute_t *nextAttr; + KMPrinter *printer = new KMPrinter(); + while (attr) + { ++#ifdef HAVE_CUPS_1_6 ++ QString attrname(ippGetName(attr)); ++ if (attrname == "printer-name") ++ { ++ QString value = QString::fromLocal8Bit(ippGetString(attr, 0, NULL)); ++ printer->setName(value); ++ printer->setPrinterName(value); ++ } ++ else if (attrname == "printer-type") ++ { ++ int value = ippGetInteger(attr, 0); ++ printer->setType(0); ++ printer->addType(((value & CUPS_PRINTER_CLASS) || (value & CUPS_PRINTER_IMPLICIT) ? KMPrinter::Class : KMPrinter::Printer)); ++ if ((value & CUPS_PRINTER_REMOTE)) printer->addType(KMPrinter::Remote); ++ if ((value & CUPS_PRINTER_IMPLICIT)) printer->addType(KMPrinter::Implicit); ++ ++ // convert printer-type attribute ++ printer->setPrinterCap( ( value & CUPS_PRINTER_OPTIONS ) >> 2 ); ++ } ++ else if (attrname == "printer-state") ++ { ++ switch (ippGetInteger(attr, 0)) ++ { ++ case IPP_PRINTER_IDLE: printer->setState(KMPrinter::Idle); break; ++ case IPP_PRINTER_PROCESSING: printer->setState(KMPrinter::Processing); break; ++ case IPP_PRINTER_STOPPED: printer->setState(KMPrinter::Stopped); break; ++ } ++ } ++ else if (attrname == "printer-uri-supported") ++ { ++ printer->setUri(KURL(ippGetString(attr, 0, NULL))); ++ } ++ else if (attrname == "printer-location") ++ { ++ printer->setLocation(QString::fromLocal8Bit(ippGetString(attr, 0, NULL))); ++ } ++ else if (attrname == "printer-is-accepting-jobs") ++ { ++ printer->setAcceptJobs(ippGetBoolean(attr, 0)); ++ } ++ ++ nextAttr = ippNextAttribute(req->request()); ++ if (attrname.isEmpty() || (!nextAttr)) ++ { ++ addPrinter(printer); ++ printer = new KMPrinter(); ++ } ++ attr = nextAttr; ++#else // HAVE_CUPS_1_6 + QString attrname(attr->name); + if (attrname == "printer-name") + { +@@ -524,6 +574,7 @@ + printer = new KMPrinter(); + } + attr = attr->next; ++#endif // HAVE_CUPS_1_6 + } + delete printer; + } +@@ -817,6 +868,7 @@ + { + QStringList list; + IppRequest req; ++ ipp_attribute_t *nextAttr; + req.setOperation(CUPS_GET_DEVICES); + if (req.doRequest("/")) + { +@@ -824,6 +876,24 @@ + ipp_attribute_t *attr = req.first(); + while (attr) + { ++#ifdef HAVE_CUPS_1_6 ++ QString attrname(ippGetName(attr)); ++ if (attrname == "device-info") desc = ippGetString(attr, 0, NULL); ++ else if (attrname == "device-make-and-model") printer = ippGetString(attr, 0, NULL); ++ else if (attrname == "device-uri") uri = ippGetString(attr, 0, NULL); ++ else if ( attrname == "device-class" ) cl = ippGetString(attr, 0, NULL); ++ nextAttr = ippNextAttribute(req.request()); ++ if (attrname.isEmpty() || (!nextAttr)) ++ { ++ if (!uri.isEmpty()) ++ { ++ if (printer == "Unknown") printer = QString::null; ++ list << cl << uri << desc << printer; ++ } ++ uri = desc = printer = cl = QString::null; ++ } ++ attr = nextAttr; ++#else // HAVE_CUPS_1_6 + QString attrname(attr->name); + if (attrname == "device-info") desc = attr->values[0].string.text; + else if (attrname == "device-make-and-model") printer = attr->values[0].string.text; +@@ -839,6 +909,7 @@ + uri = desc = printer = cl = QString::null; + } + attr = attr->next; ++#endif // HAVE_CUPS_1_6 + } + } + return list; +diff -ur kdelibs-3.5.10/kdeprint/cups/kmcupsuimanager.cpp kdelibs-3.5.10-cups16/kdeprint/cups/kmcupsuimanager.cpp +--- kdelibs-3.5.10/kdeprint/cups/kmcupsuimanager.cpp 2006-10-01 19:33:43.000000000 +0200 ++++ kdelibs-3.5.10-cups16/kdeprint/cups/kmcupsuimanager.cpp 2012-12-25 16:34:57.000000000 +0100 +@@ -60,6 +60,8 @@ + #include + #include + ++#include "config.h" ++ + KMCupsUiManager::KMCupsUiManager(QObject *parent, const char *name, const QStringList & /*args*/) + : KMUiManager(parent,name) + { +@@ -143,6 +145,24 @@ + ipp_attribute_t *attr = req.first(); + while (attr) + { ++#ifdef HAVE_CUPS_1_6 ++ if (ippGetName(attr) && strcmp(ippGetName(attr),"device-uri") == 0) ++ { ++ if (strncmp(ippGetString(attr, 0, NULL),"socket",6) == 0) backend->enableBackend(KMWizard::TCP,true); ++ else if (strncmp(ippGetString(attr, 0, NULL),"parallel",8) == 0) backend->enableBackend(KMWizard::Local,true); ++ else if (strncmp(ippGetString(attr, 0, NULL),"serial",6) == 0) backend->enableBackend(KMWizard::Local,true); ++ else if (strncmp(ippGetString(attr, 0, NULL),"smb",3) == 0) backend->enableBackend(KMWizard::SMB,true); ++ else if (strncmp(ippGetString(attr, 0, NULL),"lpd",3) == 0) backend->enableBackend(KMWizard::LPD,true); ++ else if (strncmp(ippGetString(attr, 0, NULL),"usb",3) == 0) backend->enableBackend(KMWizard::Local,true); ++ else if (strncmp(ippGetString(attr, 0, NULL),"http",4) == 0 || strncmp(ippGetString(attr, 0, NULL),"ipp",3) == 0) ++ { ++ backend->enableBackend(KMWizard::IPP,true); ++ backend->enableBackend(KMWizard::Custom+1,true); ++ } ++ else if (strncmp(ippGetString(attr, 0, NULL),"fax",3) == 0) backend->enableBackend(KMWizard::Custom+2,true); ++ } ++ attr = ippNextAttribute(req.request()); ++#else // HAVE_CUPS_1_6 + if (attr->name && strcmp(attr->name,"device-uri") == 0) + { + if (strncmp(attr->values[0].string.text,"socket",6) == 0) backend->enableBackend(KMWizard::TCP,true); +@@ -159,6 +179,7 @@ + else if (strncmp(attr->values[0].string.text,"fax",3) == 0) backend->enableBackend(KMWizard::Custom+2,true); + } + attr = attr->next; ++#endif // HAVE_CUPS_1_6 + } + backend->enableBackend(KMWizard::Class, true); + backend->enableBackend(KMWizard::Custom+5, true); +diff -ur kdelibs-3.5.10/kdeprint/cups/kmwfax.cpp kdelibs-3.5.10-cups16/kdeprint/cups/kmwfax.cpp +--- kdelibs-3.5.10/kdeprint/cups/kmwfax.cpp 2007-01-15 12:34:19.000000000 +0100 ++++ kdelibs-3.5.10-cups16/kdeprint/cups/kmwfax.cpp 2012-12-25 16:34:57.000000000 +0100 +@@ -30,6 +30,8 @@ + #include + #include + ++#include "config.h" ++ + KMWFax::KMWFax(QWidget *parent, const char *name) + : KMWizardPage(parent,name) + { +@@ -55,11 +57,19 @@ + ipp_attribute_t *attr = req.first(); + while (attr) + { ++#ifdef HAVE_CUPS_1_6 ++ if (ippGetName(attr) && strcmp(ippGetName(attr),"device-uri") == 0 && strncmp(ippGetString(attr, 0, NULL),"fax",3) == 0) ++ { ++ m_list->insertItem(SmallIcon("blockdevice"),QString::fromLatin1(ippGetString(attr, 0, NULL))); ++ } ++ attr = ippNextAttribute(req.request()); ++#else // HAVE_CUPS_1_6 + if (attr->name && strcmp(attr->name,"device-uri") == 0 && strncmp(attr->values[0].string.text,"fax",3) == 0) + { + m_list->insertItem(SmallIcon("blockdevice"),QString::fromLatin1(attr->values[0].string.text)); + } + attr = attr->next; ++#endif // HAVE_CUPS_1_6 + } + } + } +diff -ur kdelibs-3.5.10/kdeprint/cups/kmwippselect.cpp kdelibs-3.5.10-cups16/kdeprint/cups/kmwippselect.cpp +--- kdelibs-3.5.10/kdeprint/cups/kmwippselect.cpp 2007-01-15 12:34:19.000000000 +0100 ++++ kdelibs-3.5.10-cups16/kdeprint/cups/kmwippselect.cpp 2012-12-25 16:34:57.000000000 +0100 +@@ -29,6 +29,8 @@ + #include + #include + ++#include "config.h" ++ + KMWIppSelect::KMWIppSelect(QWidget *parent, const char *name) + : KMWizardPage(parent,name) + { +@@ -83,9 +85,15 @@ + ipp_attribute_t *attr = req.first(); + while (attr) + { ++#ifdef HAVE_CUPS_1_6 ++ if (ippGetName(attr) && strcmp(ippGetName(attr),"printer-name") == 0) ++ m_list->insertItem(SmallIcon("kdeprint_printer"),QString::fromLatin1(ippGetString(attr, 0, NULL))); ++ attr = ippNextAttribute(req.request()); ++#else // HAVE_CUPS_1_6 + if (attr->name && strcmp(attr->name,"printer-name") == 0) + m_list->insertItem(SmallIcon("kdeprint_printer"),QString::fromLatin1(attr->values[0].string.text)); + attr = attr->next; ++#endif // HAVE_CUPS_1_6 + } + m_list->sort(); + } diff --git a/kdelibs3.spec b/kdelibs3.spec index 433ff36..1d5a21a 100644 --- a/kdelibs3.spec +++ b/kdelibs3.spec @@ -18,14 +18,10 @@ %define apidocs 0 -%if 0%{?fedora} < 19 && 0%{?rhel} < 7 -%global _enable_cups --enable-cups -%endif - Summary: KDE 3 Libraries Name: kdelibs3 Version: 3.5.10 -Release: 44%{?dist} +Release: 45%{?dist} License: LGPLv2 Url: http://www.kde.org/ @@ -89,6 +85,12 @@ Patch110: arts-acinclude.patch # kde4.4 backport Patch111: kdelibs-3.5.10-kde-config_kde-version.patch +## Trinity backports +# build fix for CUPS 1.6 by Timothy Pearson, backported by Kevin Kofler +# http://git.trinitydesktop.org/cgit/tdelibs/commit?id=9bc0d2cd9d38750658770e69bf0445dc5162beb7 +# http://git.trinitydesktop.org/cgit/tdelibs/commit?id=91bf63b43bf4cc9ff640bd3c11549644cef05e6e +Patch150: kdelibs-3.5.10-cups16.patch + ## security fixes # fix CVE-2009-2537 - select length DoS Patch200: kdelibs-3.5.10-cve-2009-2537-select-length.patch @@ -132,7 +134,7 @@ Requires: hunspell BuildRequires: gettext BuildRequires: pcre-devel -%{?_enable_cups:BuildRequires: cups-devel cups} +BuildRequires: cups-devel cups BuildRequires: %{qt3}-devel %{qt3}-devel-docs BuildRequires: arts-devel >= %{arts_ev} BuildRequires: flex >= 2.5.4a-13 @@ -249,6 +251,8 @@ format for easy browsing %patch110 -p1 -b .autoconf %patch111 -p1 -b .kde-config_kde-version +%patch150 -p1 -b .cups16 + # security fixes %patch200 -p1 -b .cve-2009-2537 %patch201 -p0 -b .cve-2009-1725 @@ -290,7 +294,7 @@ export DO_NOT_COMPILE="libkscreensaver" %if "%{_lib}" == "lib64" --enable-libsuffix="64" \ %endif - %{?_enable_cups}%{!?enable_cups:--disable-cups} \ + --enable-cups \ --enable-mitshm \ --enable-pie \ --enable-sendfile \ @@ -479,11 +483,9 @@ touch --no-create %{_datadir}/icons/crystalsvg 2> /dev/null || : %config(noreplace) %{_sysconfdir}/profile.d/* %endif %{_bindir}/artsmessage -%if 0%{?_enable_cups} %{_bindir}/cupsdconf %{_bindir}/cupsdoprint %{_bindir}/make_driver_db_cups -%endif %{_bindir}/dcop %{_bindir}/dcopclient %{_bindir}/dcopfind @@ -572,6 +574,10 @@ touch --no-create %{_datadir}/icons/crystalsvg 2> /dev/null || : %changelog +* Tue Dec 25 2012 Kevin Kofler 3.5.10-45 +- drop CUPS conditionals, CUPS support must always be built +- backport CUPS 1.6 build fixes from Trinity / Timothy Pearson + * Fri Dec 21 2012 Rex Dieter 3.5.10-44 - disable cups support on f19+ (for now, needs lots 'o love)