generic: move kdesudo to kde-baseapps

this is done to avoid duplicating the translations entries into
kdelibs4 pot for which the Messages.sh script does a recursive
sources scan from the top-level directory

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-05-23 08:27:57 +00:00
parent 9e8cfa5c74
commit 7289d4d3cc
9 changed files with 0 additions and 839 deletions

View file

@ -54,14 +54,6 @@ set_package_properties(Perl PROPERTIES
PURPOSE "Needed for KIO fileshareset and KDEUI preparetips scripts" PURPOSE "Needed for KIO fileshareset and KDEUI preparetips scripts"
) )
find_package(Sudo)
set_package_properties(Sudo PROPERTIES
DESCRIPTION "Sudo allows a system administrator to delegate authority to give certain users"
URL "http://www.sudo.ws/"
TYPE RUNTIME
PURPOSE "Needed for kdesudo to operate"
)
find_package(ZLIB) find_package(ZLIB)
set_package_properties(ZLIB PROPERTIES set_package_properties(ZLIB PROPERTIES
DESCRIPTION "Support for gzip compressed files and data streams" DESCRIPTION "Support for gzip compressed files and data streams"
@ -274,7 +266,6 @@ add_subdirectory( kdcraw )
add_subdirectory( kdeclarative ) add_subdirectory( kdeclarative )
add_subdirectory( kdecore ) add_subdirectory( kdecore )
add_subdirectory( kded ) add_subdirectory( kded )
add_subdirectory( kdesudo )
add_subdirectory( kdeui ) add_subdirectory( kdeui )
if(QT_QTWEBKIT_FOUND) if(QT_QTWEBKIT_FOUND)
add_subdirectory( kdewebkit ) add_subdirectory( kdewebkit )

View file

@ -1,26 +0,0 @@
check_include_files("sys/prctl.h" HAVE_SYS_PRCTL_H)
check_symbol_exists(PR_SET_DUMPABLE "sys/prctl.h" HAVE_PR_SET_DUMPABLE)
add_feature_info("prctl-dumpable" HAVE_PR_SET_DUMPABLE "Used to disallow ptracing")
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
include_directories(
${KDE4_KDECORE_INCLUDES}
${KDE4_KDEUI_INCLUDES}
)
# set(kt4_SRC app.cpp mainwindow.cpp core.cpp view.cpp viewmodel.cpp main.cpp)
set(KDESUDO_SRC
main.cpp
kdesudo.cpp
kcookie.cpp
)
add_executable(kdesudo ${KDESUDO_SRC})
target_link_libraries(kdesudo ${KDE4_KDEUI_LIBS})
install(
TARGETS kdesudo
${INSTALL_TARGETS_DEFAULT_ARGS}
)

View file

@ -1,2 +0,0 @@
#! /usr/bin/env bash
$XGETTEXT `find . -name \*.cpp` -o $podir/kdesudo.pot

View file

@ -1,2 +0,0 @@
#cmakedefine01 HAVE_SYS_PRCTL_H
#cmakedefine01 HAVE_PR_SET_DUMPABLE

View file

@ -1,104 +0,0 @@
/* vi: ts=8 sts=4 sw=4
*
* This file is part of the KDE project, module kdesu.
* Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
*
* This is free software; you can use this library under the GNU Library
* General Public License, version 2. See the file "COPYING.LIB" for the
* exact licensing terms.
*
* kcookie.cpp: KDE authentication cookies.
*/
#include "kcookie.h"
#include <stdlib.h>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QProcess>
#include <kdebug.h>
namespace KDESu
{
namespace KDESuPrivate
{
class KCookie::KCookiePrivate
{
public:
QByteArray m_Display;
#ifdef Q_WS_X11
QByteArray m_DisplayAuth;
#endif
};
KCookie::KCookie()
: d(new KCookiePrivate)
{
#ifdef Q_WS_X11
getXCookie();
#endif
}
KCookie::~KCookie()
{
delete d;
}
QByteArray KCookie::display() const
{
return d->m_Display;
}
#ifdef Q_WS_X11
QByteArray KCookie::displayAuth() const
{
return d->m_DisplayAuth;
}
#endif
void KCookie::getXCookie()
{
#ifdef Q_WS_X11
d->m_Display = getenv("DISPLAY");
#else
d->m_Display = getenv("QWS_DISPLAY");
#endif
if (d->m_Display.isEmpty()) {
kError(900) << "$DISPLAY is not set.\n";
return;
}
#ifdef Q_WS_X11 // No need to mess with X Auth stuff
QByteArray disp = d->m_Display;
if (disp.startsWith("localhost:")) {
disp.remove(0, 9);
}
QProcess proc;
proc.start("xauth", QStringList() << "list" << disp);
if (!proc.waitForStarted()) {
kError(900) << "Could not run xauth.\n";
return;
}
proc.waitForReadyRead(100);
QByteArray output = proc.readLine().simplified();
if (output.isEmpty()) {
kWarning(900) << "No X authentication info set for display " <<
d->m_Display << endl; return;
}
QList<QByteArray> lst = output.split(' ');
if (lst.count() != 3) {
kError(900) << "parse error.\n";
return;
}
d->m_DisplayAuth = (lst[1] + ' ' + lst[2]);
proc.waitForFinished(100); // give QProcess a chance to clean up gracefully
#endif
}
}
}

View file

@ -1,57 +0,0 @@
/* vi: ts=8 sts=4 sw=4
*
* This file is part of the KDE project, module kdesu
* Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
*
* This is free software; you can use this library under the GNU Library
* General Public License, version 2. See the file "COPYING.LIB" for the
* exact licensing terms.
*/
#ifndef __KCookie_h_Included__
#define __KCookie_h_Included__
#include <QtCore/QByteArray>
namespace KDESu
{
namespace KDESuPrivate
{
/**
* Utility class to access the authentication tokens needed to run a KDE
* program (X11 cookies on X11, for instance).
* @internal
*/
class KCookie
{
public:
KCookie();
~KCookie();
/**
* Returns the X11 display.
*/
QByteArray display() const;
#ifdef Q_WS_X11
/**
* Returns the X11 magic cookie, if available.
*/
QByteArray displayAuth() const;
#endif
private:
void getXCookie();
class KCookiePrivate;
KCookiePrivate *const d;
};
}
}
#endif // __KCookie_h_Included__

View file

@ -1,387 +0,0 @@
/***************************************************************************
kdesudo.cpp - the implementation of the
admin granting sudo widget
-------------------
begin : Sam Feb 15 15:42:12 CET 2003
copyright : (C) 2003 by Robert Gruber
<rgruber@users.sourceforge.net>
(C) 2007 by Martin Böhm <martin.bohm@kubuntu.org>
Anthony Mercatante <tonio@kubuntu.org>
Canonical Ltd (Jonathan Riddell
<jriddell@ubuntu.com>)
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "kdesudo.h"
#include <QtCore/QDataStream>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QProcess>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QTemporaryFile>
#include <QtCore/QTextCodec>
#include <kapplication.h>
#include <kcmdlineargs.h>
#include <kdebug.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kpassworddialog.h>
#include <kpushbutton.h>
#include <kshell.h>
#include <kstandarddirs.h>
#include <kwindowsystem.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <cstdio>
#include <cstdlib>
#include <csignal>
KdeSudo::KdeSudo(const QString &icon, const QString &appname) :
QObject(),
m_process(0),
m_error(false),
m_pCookie(new KDESu::KDESuPrivate::KCookie)
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
bool realtime = args->isSet("r");
bool priority = args->isSet("p");
bool showCommand = (!args->isSet("d"));
bool changeUID = true;
bool noExec = false;
QString runas = args->getOption("u");
QString cmd;
int winid = -1;
bool attach = args->isSet("attach");
m_dialog = new KPasswordDialog;
m_dialog->setDefaultButton(KDialog::Ok);
if (attach) {
winid = args->getOption("attach").toInt(&attach, 0);
KWindowSystem::setMainWindow(m_dialog, (WId)winid);
}
if (!args->isSet("c") && !args->count()) {
KMessageBox::information(0, i18n("No command arguments supplied!\n"
"Usage: kdesudo [-u <runas>] <command>\n"
"KdeSudo will now exit...")
);
noExec = true;
}
m_process = new QProcess;
/* load the icon */
m_dialog->setPixmap(icon);
// Parsins args
/* Get the comment out of cli args */
QByteArray commentBytes = args->getOption("comment").toUtf8();
QTextCodec *tCodecConv = QTextCodec::codecForLocale();
QString comment = tCodecConv->toUnicode(commentBytes, commentBytes.size());
if (args->isSet("f")) {
// If file is writeable, do not change uid
QString file = args->getOption("f");
if (!file.isEmpty()) {
if (file.at(0) != '/') {
KStandardDirs dirs;
file = dirs.findResource("config", file);
if (file.isEmpty()) {
kWarning(1206) << "Config file not found: " << file << "\n";
exit(1);
}
}
QFileInfo fi(file);
if (!fi.exists()) {
kWarning(1206) << "File does not exist: " << file << "\n";
exit(1);
}
if (fi.isWritable()) {
changeUID = false;
}
}
}
connect(m_process, SIGNAL(readyReadStandardOutput()),
this, SLOT(parseOutput()));
connect(m_process, SIGNAL(readyReadStandardError()),
this, SLOT(parseOutput()));
connect(m_process, SIGNAL(finished(int)),
this, SLOT(procExited(int)));
connect(m_dialog, SIGNAL(gotPassword(const QString & , bool)),
this, SLOT(pushPassword(const QString &)));
connect(m_dialog, SIGNAL(rejected()),
this, SLOT(slotCancel()));
// Generate the xauth cookie and put it in a tempfile
// set the environment variables to reflect that.
// Default cookie-timeout is 60 sec. .
// 'man xauth' for more info on xauth cookies.
QTemporaryFile *tmpFile = new QTemporaryFile("/tmp/kdesudo-XXXXXX-xauth");
tmpFile->open();
QString m_tmpName = tmpFile->fileName();
delete tmpFile;
QByteArray disp = m_pCookie->display();
// Create two processes, one for each xauth call
QProcess xauth_ext;
QProcess xauth_merge;
// This makes "xauth extract - $DISPLAY | xauth -f /tmp/kdesudo-... merge -"
xauth_ext.setStandardOutputProcess(&xauth_merge);
// Start the first
xauth_ext.start("xauth", QStringList() << "extract" << "-" << QString::fromLocal8Bit(disp), QIODevice::ReadOnly);
if (!xauth_ext.waitForStarted()) {
return;
}
// Start the second
xauth_merge.start("xauth", QStringList() << "-f" << m_tmpName << "merge" << "-", QIODevice::WriteOnly);
if (!xauth_merge.waitForStarted()) {
return;
}
// If they ended, close it all
if (!xauth_merge.waitForFinished()) {
return;
}
xauth_merge.close();
if (!xauth_ext.waitForFinished()) {
return;
}
xauth_ext.close();
// non root users need to be able to read the xauth file.
// the xauth file is deleted when kdesudo exits. security?
QFile tf;
tf.setFileName(m_tmpName);
if (!runas.isEmpty() && runas != "root" && tf.exists()) {
chmod(QFile::encodeName(m_tmpName), 0644);
}
QProcessEnvironment processEnv = QProcessEnvironment::systemEnvironment();
processEnv.insert("DISPLAY", disp);
processEnv.insert("XAUTHORITY", m_tmpName);
m_process->setProcessEnvironment(processEnv);
QStringList processArgs;
{
// Do not cache credentials to avoid security risks caused by the fact
// that kdesudo could be invoked from anyting inside the user session
// potentially in such a way that it uses the cached credentials of a
// previously kdesudo run in that same scope.
processArgs << "-k";
if (changeUID) {
processArgs << "-H" << "-S" << "-p" << "passprompt";
if (!runas.isEmpty()) {
processArgs << "-u" << runas;
}
processArgs << "--";
}
if (realtime) {
processArgs << "nice" << "-n" << "10";
m_dialog->addCommentLine(i18n("Priority:"), i18n("realtime:") +
QChar(' ') + QString("50/100"));
processArgs << "--";
} else if (priority) {
QString n = args->getOption("p");
int intn = atoi(n.toUtf8());
intn = (intn * 40 / 100) - (20 + 0.5);
QString strn;
strn.sprintf("%d", intn);
processArgs << "nice" << "-n" << strn;
m_dialog->addCommentLine(i18n("Priority:"), n + QString("/100"));
processArgs << "--";
}
if (args->isSet("c")) {
QString command = args->getOption("c");
cmd += command;
processArgs << "sh";
processArgs << "-c";
processArgs << command;
}
else if (args->count()) {
for (int i = 0; i < args->count(); i++) {
if ((!args->isSet("c")) && (i == 0)) {
QStringList argsSplit = KShell::splitArgs(args->arg(i));
for (int j = 0; j < argsSplit.count(); j++) {
processArgs << validArg(argsSplit[j]);
if (j == 0) {
cmd += validArg(argsSplit[j]) + QChar(' ');
} else {
cmd += KShell::quoteArg(validArg(argsSplit[j])) + QChar(' ');
}
}
} else {
processArgs << validArg(args->arg(i));
cmd += validArg(args->arg(i)) + QChar(' ');
}
}
}
// strcmd needs to be defined
if (showCommand && !cmd.isEmpty()) {
m_dialog->addCommentLine(i18n("Command:"), cmd);
}
}
if (comment.isEmpty()) {
QString defaultComment = "<b>%1</b> " + i18n("needs administrative privileges. ");
if (runas.isEmpty() || runas == "root") {
defaultComment += i18n("Please enter your password.");
} else {
defaultComment += i18n("Please enter password for <b>%1</b>.", runas);
}
if (!appname.isEmpty()) {
m_dialog->setPrompt(defaultComment.arg(appname));
} else {
m_dialog->setPrompt(defaultComment.arg(cmd));
}
} else {
m_dialog->setPrompt(comment);
}
m_process->setProcessChannelMode(QProcess::MergedChannels);
if (noExec) {
exit(0);
} else {
m_process->start("sudo", processArgs);
}
}
KdeSudo::~KdeSudo()
{
delete m_dialog;
}
void KdeSudo::error(const QString &msg)
{
m_error = true;
KMessageBox::error(0, msg);
KApplication::kApplication()->exit(1);
}
void KdeSudo::parseOutput()
{
QString strOut = m_process->readAllStandardOutput();
static int badpass = 0;
if (strOut.contains("try again")) {
badpass++;
if (badpass == 1) {
m_dialog->addCommentLine(i18n("<b>Warning: </b>"), i18n("<b>Incorrect password, please try again.</b>"));
m_dialog->show();
} else if (badpass == 2) {
m_dialog->show();
} else {
error(i18n("Wrong password! Exiting..."));
}
} else if (strOut.contains("command not found")) {
error(i18n("Command not found!"));
} else if (strOut.contains("is not in the sudoers file")) {
error(i18n("Your username is unknown to sudo!"));
} else if (strOut.contains("is not allowed to execute")) {
error(i18n("Your user is not allowed to run the specified command!"));
} else if (strOut.contains("is not allowed to run sudo on")) {
error(i18n("Your user is not allowed to run sudo on this host!"));
} else if (strOut.contains("may not run sudo on")) {
error(i18n("Your user is not allowed to run sudo on this host!"));
} else if ((strOut.contains("passprompt")) || (strOut.contains("PIN (CHV2)"))) {
m_dialog->setPassword(QString());
m_dialog->show();
} else {
fprintf(stdout, "%s", strOut.toLocal8Bit().constData());
}
}
void KdeSudo::procExited(int exitCode)
{
if (!m_error) {
if (!m_tmpName.isEmpty()) {
QFile::remove(m_tmpName);
}
}
KApplication::kApplication()->exit(exitCode);
}
void KdeSudo::pushPassword(const QString &pwd)
{
m_process->write(pwd.toLocal8Bit() + "\n");
}
void KdeSudo::slotCancel()
{
KApplication::kApplication()->exit(1);
}
void KdeSudo::slotUser1()
{
m_dialog->done(AsUser);
}
void KdeSudo::blockSigChild()
{
sigset_t sset;
sigemptyset(&sset);
sigaddset(&sset, SIGCHLD);
sigprocmask(SIG_BLOCK, &sset, 0L);
}
void KdeSudo::unblockSigChild()
{
sigset_t sset;
sigemptyset(&sset);
sigaddset(&sset, SIGCHLD);
sigprocmask(SIG_UNBLOCK, &sset, 0L);
}
QString KdeSudo::validArg(QString arg)
{
QChar firstChar = arg.at(0);
QChar lastChar = arg.at(arg.length() - 1);
if ((firstChar == '"' && lastChar == '"') || (firstChar == '\'' && lastChar == '\'')) {
arg = arg.remove(0, 1);
arg = arg.remove(arg.length() - 1, 1);
}
return arg;
}

View file

@ -1,93 +0,0 @@
/***************************************************************************
kdesudo.cpp - description
-------------------
begin : Sam Feb 15 15:42:12 CET 2003
copyright : (C) 2003 by Robert Gruber <rgruber@users.sourceforge.net>
(C) 2007 by Martin Böhm <martin.bohm@kubuntu.org>
Anthony Mercatante <tonio@kubuntu.org>
Canonical Ltd (Jonathan Riddell <jriddell@ubuntu.com>)
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KDESUDO_H
#define KDESUDO_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <QtCore/QProcess>
#include <QtGui/QWidget>
#include <kpassworddialog.h>
#include <knewpassworddialog.h>
#include "kcookie.h"
/*
* KdeSudo is the base class of the project
*
* @version 3.1
*/
/* buffer is used when reading from the QProcess child */
#define BUFSIZE 1024
class KdeSudo : QObject
{
Q_OBJECT
public:
KdeSudo(const QString &icon = QString(), const QString &generic = QString());
~KdeSudo();
enum ResultCodes {
AsUser = 10
};
private slots:
/**
* This slot gets executed if sudo creates some output
* -- well, in theory it should. Even though the code
* seems to be doing what the API says, it doesn't
* yet do what we need.
**/
void parseOutput();
/**
* This slot gets exectuted when sudo exits
**/
void procExited(int exitCode);
/**
* This slot overrides the slot from KPasswordDialog
* @see KPasswordDialog
**/
void pushPassword(const QString &);
void slotCancel();
void slotUser1();
QString validArg(QString arg);
private:
void error(const QString &);
QProcess *m_process;
bool m_error;
bool useTerm;
bool noExec;
QString m_tmpName;
QString iceauthorityFile;
KDESu::KDESuPrivate::KCookie *m_pCookie;
void blockSigChild();
void unblockSigChild();
KPasswordDialog *m_dialog;
};
#endif // KDESUDO_H

View file

@ -1,159 +0,0 @@
/***************************************************************************
kdesudo.cpp - description
-------------------
begin : Sam Feb 15 15:42:12 CET 2003
copyright : (C) 2003 by Robert Gruber
<rgruber@users.sourceforge.net>
(C) 2007 by Martin Böhm <martin.bohm@kubuntu.org>
Anthony Mercatante <tonio@kubuntu.org>
Canonical Ltd (Jonathan Riddell
<jriddell@ubuntu.com>)
(C) 2009-2015 by Harald Sitter <sitter@kde.org>
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kdesktopfile.h>
#include <kiconloader.h>
#include <kicontheme.h>
#include <kglobal.h>
#include <kstandarddirs.h>
#include <kdebug.h>
#include <kapplication.h>
#include <config.h>
#if HAVE_SYS_PRCTL_H
#include <sys/prctl.h>
#endif
#include "kdesudo.h"
int main(int argc, char **argv)
{
// Disable ptrace to prevent arbitrary apps reading password out of memory.
#if HAVE_PR_SET_DUMPABLE
prctl(PR_SET_DUMPABLE, 0);
#endif
KAboutData about(
"kdesudo", 0, ki18n("KdeSudo"),
"3.4.2.3", ki18n("Sudo frontend for KDE"),
KAboutData::License_GPL,
ki18n("(C) 2007 - 2008 Anthony Mercatante"),
KLocalizedString(),
"https://code.launchpad.net/kdesudo/");
about.setBugAddress("https://launchpad.net/kdesudo/+filebug");
about.addAuthor(ki18n("Robert Gruber"), KLocalizedString(),
"rgruber@users.sourceforge.net", "http://test.com");
about.addAuthor(ki18n("Anthony Mercatante"), KLocalizedString(),
"tonio@ubuntu.com");
about.addAuthor(ki18n("Martin Böhm"), KLocalizedString(),
"martin.bohm@kubuntu.org");
about.addAuthor(ki18n("Jonathan Riddell"), KLocalizedString(),
"jriddell@ubuntu.com");
about.addAuthor(ki18n("Harald Sitter"), KLocalizedString(),
"apachelogger@ubuntu.com");
KCmdLineArgs::init(argc, argv, &about);
KCmdLineOptions options;
options.add("u <runas>", ki18n("sets a runas user"));
options.add("c <command>", ki18n("The command to execute"));
options.add("s", ki18n("Fake option for compatibility"));
options.add("i <icon name>", ki18n("Specify icon to use in the password"
" dialog"));
options.add("d", ki18n("Do not show the command to be run in the dialog"));
options.add("p <priority>", ki18n("Process priority, between 0 and 100,"
" 0 the lowest [50]"));
options.add("r", ki18n("Use realtime scheduling"));
options.add("f <file>", ki18n("Use target UID if <file> is not writeable"));
options.add("t", ki18n("Fake option for KDE's KdeSu compatibility"));
options.add("n", ki18n("Fake option for compatibility"));
options.add("nonewdcop", ki18n("Use existing DCOP server"));
options.add("comment <dialog text>", ki18n("The comment that should be "
"displayed in the dialog"));
options.add("noignorebutton", ki18n("Do not display « ignore » button"));
options.add("attach <winid>", ki18n("Makes the dialog transient for an X app specified by winid"));
options.add("desktop <desktop file>", ki18n("Manual override for "
"automatic desktop file detection"));
options.add("+command", ki18n("The command to execute"));
KCmdLineArgs::addCmdLineOptions(options);
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KApplication a;
QString executable, arg, command, icon;
QStringList executableList, commandlist;
KDesktopFile *desktopFile;
if (args->isSet("c")) {
executable = args->getOption("c");
}
if (args->count() && executable.isEmpty()) {
command = args->arg(0);
commandlist = command.split(" ");
executable = commandlist[0];
}
/* We have to make sure the executable is only the binary name */
executableList = executable.split(" ");
executable = executableList[0];
executableList = executable.split("/");
executable = executableList[executableList.count() - 1];
/* Kubuntu has a bug in it - this is a workaround for it */
KGlobal::dirs()->addResourceDir("apps", "/usr/share/applications/kde");
KGlobal::dirs()->addResourceDir("apps", "/usr/share/applications/kde4");
KGlobal::dirs()->addResourceDir("apps", "/usr/share/kde/services");
KGlobal::dirs()->addResourceDir("apps", "/usr/share/kde4/services");
KGlobal::dirs()->addResourceDir("apps", "/usr/share/applications");
KGlobal::dirs()->addResourceDir("apps", "/usr/share/applnk");
QString path = getenv("PATH");
QStringList pathList = path.split(":");
for (int i = 0; i < pathList.count(); i++) {
executable.remove(pathList[i]);
}
if (args->isSet("desktop")) {
desktopFile = new KDesktopFile(args->getOption("desktop"));
} else {
desktopFile = new KDesktopFile(executable + ".desktop");
}
/* icon parsing */
if (args->isSet("i")) {
icon = args->getOption("i");
} else {
QString iconName = desktopFile->readIcon();
KIconLoader *loader = KIconLoader::global();
icon = loader->iconPath(iconName, -1 * KIconLoader::StdSizes(
KIconLoader::SizeHuge), true);
}
/* generic name parsing */
QString name = desktopFile->readName();
a.setQuitOnLastWindowClosed(false);
KdeSudo kdesudo(icon, name);
return a.exec();
}