aboutsummaryrefslogtreecommitdiffstats
path: root/x11/kdelibs4
diff options
context:
space:
mode:
authorlofi <lofi@FreeBSD.org>2007-09-15 01:58:32 +0800
committerlofi <lofi@FreeBSD.org>2007-09-15 01:58:32 +0800
commita322d9fbeb44cd585120344a592ef587edb10a72 (patch)
tree319b1b5892edc94a801dab02db40871260f90014 /x11/kdelibs4
parent3824efba4f1fd6d4a95c6188fd19989a8b8a7fa1 (diff)
downloadfreebsd-ports-gnome-a322d9fbeb44cd585120344a592ef587edb10a72.tar.gz
freebsd-ports-gnome-a322d9fbeb44cd585120344a592ef587edb10a72.tar.zst
freebsd-ports-gnome-a322d9fbeb44cd585120344a592ef587edb10a72.zip
Add a patch to allow restarting cups from the print kcm module.
Submitted by: Tim McCormick <tim@pcbsd.org>
Diffstat (limited to 'x11/kdelibs4')
-rw-r--r--x11/kdelibs4/Makefile4
-rw-r--r--x11/kdelibs4/files/patch-kdeprint_cups_cupsdconf265
2 files changed, 69 insertions, 0 deletions
diff --git a/x11/kdelibs4/Makefile b/x11/kdelibs4/Makefile
index dcc1e875c6f6..02510f68f92b 100644
--- a/x11/kdelibs4/Makefile
+++ b/x11/kdelibs4/Makefile
@@ -79,6 +79,10 @@ FONTENCOD= ${X11BASE}/lib/X11/fonts/encodings/encodings.dir
LIB_DEPENDS+= bz2.1:${PORTSDIR}/archivers/bzip2
.endif # !exists(/usr/bin/bzip2)
+.if !exists(/usr/bin/pgrep)
+RUN_DEPENDS+= pgrep:${PORTSDIR}/sysutils/pkill
+.endif # !exists(/usr/bin/pgrep)
+
.if ${X_WINDOW_SYSTEM:L} != xorg
BUILD_DEPENDS+= mkfontdir:${X_CLIENTS_PORT}
RUN_DEPENDS+= iceauth:${X_CLIENTS_PORT}
diff --git a/x11/kdelibs4/files/patch-kdeprint_cups_cupsdconf2 b/x11/kdelibs4/files/patch-kdeprint_cups_cupsdconf2
new file mode 100644
index 000000000000..b38391e67123
--- /dev/null
+++ b/x11/kdelibs4/files/patch-kdeprint_cups_cupsdconf2
@@ -0,0 +1,65 @@
+--- kdeprint/cups/cupsdconf2/cupsddialog.cpp Tue Sep 11 09:26:39 2007
++++ kdeprint/cups/cupsdconf2/cupsddialog.cpp Tue Sep 11 14:38:28 2007
+@@ -44,6 +44,7 @@
+ #include <kio/passdlg.h>
+ #include <kguiitem.h>
+ #include <kprocess.h>
++#include <qprocess.h>
+
+ #include <signal.h>
+ #include <cups/cups.h>
+@@ -69,24 +70,38 @@
+
+ int getServerPid()
+ {
+- QDir dir("/proc",QString::null,QDir::Name,QDir::Dirs);
+- for (uint i=0;i<dir.count();i++)
+- {
+- if (dir[i] == "." || dir[i] == ".." || dir[i] == "self") continue;
+- QFile f("/proc/" + dir[i] + "/cmdline");
+- if (f.exists() && f.open(IO_ReadOnly))
++ // /proc doesn't work the same in FreeBSD. The simplest way to get cupsd's pid is via pgrep.
++ #if defined(__FreeBSD__)
++ QProcess *proc = new QProcess();
++ proc->addArgument("pgrep");
++ proc->addArgument("cupsd");
++ proc->start();
++ while (proc->isRunning()); //Wait for process to exit
++ QString pidString = proc->readLineStdout();
++ bool ok;
++ int pid = pidString.toInt(&ok);
++ if (ok) return pid;
++ return (-1);
++ #else
++ QDir dir("/proc",QString::null,QDir::Name,QDir::Dirs);
++ for (uint i=0;i<dir.count();i++)
+ {
+- QTextStream t(&f);
+- QString line;
+- t >> line;
+- f.close();
+- if (line.right(5) == "cupsd" ||
+- line.right(6).left(5) == "cupsd") // second condition for 2.4.x kernels
+- // which add a null byte at the end
+- return dir[i].toInt();
++ if (dir[i] == "." || dir[i] == ".." || dir[i] == "self") continue;
++ QFile f("/proc/" + dir[i] + "/cmdline");
++ if (f.exists() && f.open(IO_ReadOnly))
++ {
++ QTextStream t(&f);
++ QString line;
++ t >> line;
++ f.close();
++ if (line.right(5) == "cupsd" ||
++ line.right(6).left(5) == "cupsd") // second condition for 2.4.x kernels
++ // which add a null byte at the end
++ return dir[i].toInt();
++ }
+ }
+- }
+- return (-1);
++ return (-1);
++ #endif
+ }
+
+ const char* getPassword(const char*)