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
This commit is contained in:
Martin Gräßlin 2011-03-07 18:03:28 +01:00
parent 0c5d47f3ae
commit 75d0b8403f

View file

@ -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";
}
}
}
}
}