Workaround broken kdesu backward compatibility.

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1278089
This commit is contained in:
Volker Lanz 2012-02-04 10:14:13 +00:00
parent 9eef711325
commit c987402691
1 changed files with 14 additions and 2 deletions

View File

@ -84,10 +84,22 @@ bool checkPermissions()
// endless loops of calling the same non-working (kde|gk)su(do) binary again and again.
if (!suCommand().isEmpty() && !args->isSet("dontsu"))
{
if (QProcess::execute(suCommand(), QStringList() << args->allArguments().join(" ") + " --dontsu") == 0)
QStringList argList;
const QString suCmd = suCommand();
// kdesu broke backward compatibility at some point and now only works with "-c";
// kdesudo accepts either (with or without "-c"), but the gk* helpers only work
// without. kdesu maintainers won't fix their app, so we need to work around that here.
if (suCmd.startsWith("kde"))
argList << "-c";
argList << args->allArguments().join(" ") + " --dontsu";
if (QProcess::execute(suCmd, argList) == 0)
return false;
}
return KMessageBox::warningContinueCancel(NULL, i18nc("@info",
"<para><warning>You do not have administrative privileges.</warning></para>"
"<para>It is possible to run <application>%1</application> without these privileges. "