diff options
Diffstat (limited to 'tdeprint/cups')
-rw-r--r-- | tdeprint/cups/cupsdconf2/cupsddialog.cpp | 14 | ||||
-rw-r--r-- | tdeprint/cups/kmcupsmanager.cpp | 26 |
2 files changed, 36 insertions, 4 deletions
diff --git a/tdeprint/cups/cupsdconf2/cupsddialog.cpp b/tdeprint/cups/cupsdconf2/cupsddialog.cpp index 22a3b2d54..1800aaae4 100644 --- a/tdeprint/cups/cupsdconf2/cupsddialog.cpp +++ b/tdeprint/cups/cupsdconf2/cupsddialog.cpp @@ -44,6 +44,7 @@ #include <tdeio/passdlg.h> #include <kguiitem.h> #include <kprocess.h> +#include <tqprocess.h> #include <stdlib.h> #include <signal.h> @@ -70,6 +71,18 @@ extern "C" int getServerPid() { +#if defined(__OpenBSD__) + TQProcess *proc = new TQProcess(); + proc->addArgument("pgrep"); + proc->addArgument("cupsd"); + proc->start(); + while (proc->isRunning()); //Wait for process to exit + TQString pidString = proc->readLineStdout(); + bool ok; + int pid = pidString.toInt(&ok); + if (ok) return pid; + return (-1); +#else TQDir dir("/proc",TQString::null,TQDir::Name,TQDir::Dirs); for (uint i=0;i<dir.count();i++) { @@ -88,6 +101,7 @@ int getServerPid() } } return (-1); +#endif } const char* getPassword(const char*) diff --git a/tdeprint/cups/kmcupsmanager.cpp b/tdeprint/cups/kmcupsmanager.cpp index eaf5070b8..7f06e0636 100644 --- a/tdeprint/cups/kmcupsmanager.cpp +++ b/tdeprint/cups/kmcupsmanager.cpp @@ -101,11 +101,20 @@ TQString KMCupsManager::driverDbCreationProgram() TQString KMCupsManager::driverDirectory() { TQString d = cupsInstallDir(); - if (d.isEmpty()) + if (d.isEmpty()) { +#ifdef __OpenBSD__ + d = "/usr/local"; +#else d = "/usr"; +#endif + } d.append("/share/cups/model"); // raw foomatic support +#ifdef __OpenBSD__ + d.append(":/usr/local/share/foomatic/db/source"); +#else d.append(":/usr/share/foomatic/db/source"); +#endif return d; } @@ -138,7 +147,7 @@ bool KMCupsManager::createPrinter(KMPrinter *p) req.setOperation(CUPS_ADD_CLASS); TQStringList members = p->members(), uris; TQString s; - s = TQString::fromLocal8Bit("ipp://%1/printers/").arg(CupsInfos::self()->hostaddr()); + s = TQString::fromLocal8Bit("ipp://%1/printers/").arg(CupsInfos::self()->hostaddr()); for (TQStringList::ConstIterator it=members.begin(); it!=members.end(); ++it) uris.append(s+(*it)); req.addURI(IPP_TAG_PRINTER,"member-uris",uris); @@ -627,7 +636,11 @@ DrMain* KMCupsManager::loadMaticDriver(const TQString& drname) { TQStringList comps = TQStringList::split('/', drname, false); TQString tmpFile = locateLocal("tmp", "foomatic_" + kapp->randomString(8)); +#ifdef __OpenBSD__ + TQString PATH = getenv("PATH") + TQString::fromLatin1(":/usr/local/bin:/usr/sbin:/usr/local/sbin:/opt/sbin:/opt/local/sbin"); +#else TQString PATH = getenv("PATH") + TQString::fromLatin1(":/usr/sbin:/usr/local/sbin:/opt/sbin:/opt/local/sbin"); +#endif TQString exe = TDEStandardDirs::findExe("foomatic-datafile", PATH); if (exe.isEmpty()) { @@ -937,10 +950,15 @@ void KMCupsManager::exportDriver() !m_currentprinter->isClass(true) && !m_currentprinter->isSpecial()) { TQString path = cupsInstallDir(); - if (path.isEmpty()) + if (path.isEmpty()) { +#ifdef __OpenBSD__ + path = "/usr/local/share/cups"; +#else path = "/usr/share/cups"; - else +#endif + } else { path += "/share/cups"; + } CupsAddSmb::exportDest(m_currentprinter->printerName(), path); } } |