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.0icc-effect-5.14.5
parent
0c5d47f3ae
commit
75d0b8403f
|
@ -26,11 +26,14 @@ DEALINGS IN THE SOFTWARE.
|
||||||
#include <kapplication.h>
|
#include <kapplication.h>
|
||||||
#include <kmessagebox.h>
|
#include <kmessagebox.h>
|
||||||
#include <klocale.h>
|
#include <klocale.h>
|
||||||
|
#include <kauth.h>
|
||||||
|
#include <kdebug.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <QX11Info>
|
#include <QX11Info>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
@ -75,8 +78,20 @@ int main(int argc, char* argv[])
|
||||||
QStringList lst;
|
QStringList lst;
|
||||||
lst << hostname << "kill" << QString::number(pid);
|
lst << hostname << "kill" << QString::number(pid);
|
||||||
QProcess::startDetached("xon", lst);
|
QProcess::startDetached("xon", lst);
|
||||||
} else
|
} else {
|
||||||
::kill(pid, SIGKILL);
|
if (::kill(pid, SIGKILL) && errno == EPERM) {
|
||||||
XKillClient(QX11Info::display(), id);
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue