Commit 189483d8 authored by Martin Flöser's avatar Martin Flöser
Browse files

Add KAuth support to KWin process killer

See http://svn.reviewboard.kde.org/r/4460/
Thanks to Mikael Gerdin for the patch.
CCMAIL: mikael.gerdin@gmail.com
FEATURE: 129476
FIXED-IN: 4.7.0
parent aeec160e
......@@ -26,11 +26,14 @@ DEALINGS IN THE SOFTWARE.
#include <kapplication.h>
#include <kmessagebox.h>
#include <klocale.h>
#include <kauth.h>
#include <kdebug.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <QX11Info>
#include <QProcess>
#include <signal.h>
#include <errno.h>
int main(int argc, char* argv[])
{
......@@ -75,8 +78,20 @@ int main(int argc, char* argv[])
QStringList lst;
lst << hostname << "kill" << QString::number(pid);
QProcess::startDetached("xon", lst);
} else
::kill(pid, SIGKILL);
XKillClient(QX11Info::display(), id);
} else {
if (::kill(pid, SIGKILL) && errno == EPERM) {
KAuth::Action killer("org.kde.ksysguard.processlisthelper.sendsignal");
killer.setHelperID("org.kde.ksysguard.processlisthelper");
killer.addArgument("pid0", pid);
killer.addArgument("pidcount", 1);
killer.addArgument("signal", SIGKILL);
if (killer.isValid()) {
kDebug(1212) << "Using KAuth to kill pid: " << pid;
killer.execute();
} else {
kDebug(1212) << "KWin process killer action not valid";
}
}
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment