diff --git a/projectbuilders/makebuilder/makebuilderconfig.kcfg b/projectbuilders/makebuilder/makebuilderconfig.kcfg --- a/projectbuilders/makebuilder/makebuilderconfig.kcfg +++ b/projectbuilders/makebuilder/makebuilderconfig.kcfg @@ -14,7 +14,7 @@ false - + false diff --git a/projectbuilders/makebuilder/makeconfig.ui b/projectbuilders/makebuilder/makeconfig.ui --- a/projectbuilders/makebuilder/makeconfig.ui +++ b/projectbuilders/makebuilder/makeconfig.ui @@ -11,12 +11,21 @@ - - 0 - QFormLayout::AllNonFixedFieldsGrow + + 0 + + + 0 + + + 0 + + + 0 + @@ -95,6 +104,9 @@ false + + true + kdesu @@ -107,7 +119,7 @@ - sudo + gksu @@ -152,7 +164,7 @@ - + 0 @@ -322,6 +334,22 @@ + kcfg_installAsRoot + toggled(bool) + kcfg_suCommand + setEnabled(bool) + + + 516 + 74 + + + 195 + 97 + + + + kcfg_overrideNumberOfJobs clicked(bool) kcfg_numberOfJobs diff --git a/projectbuilders/makebuilder/makejob.cpp b/projectbuilders/makebuilder/makejob.cpp --- a/projectbuilders/makebuilder/makejob.cpp +++ b/projectbuilders/makebuilder/makejob.cpp @@ -177,19 +177,48 @@ bool runAsRoot = builderGroup.readEntry( "Install As Root", false ); if ( runAsRoot && m_command == InstallCommand ) { - int suCommand = builderGroup.readEntry( "Su Command", 0 ); - QStringList arguments; - QString suCommandName; - switch( suCommand ) { - case 1: - return QStringList() << QStringLiteral("kdesudo") << QStringLiteral("-t"); - - case 2: - return QStringList() << QStringLiteral("sudo"); - - default: - return QStringList() << QStringLiteral("kdesu") << QStringLiteral("-t"); + QString suCommand = builderGroup.readEntry( "Su Command", QString() ); + bool suCommandIsDigit; + QStringList suCommandWithArg; + int suCommandNum = suCommand.toInt(&suCommandIsDigit); + /* + * "if(suCommandIsDigit)" block exists only because of backwards compatibility + * reasons, In earlier versions of KDevelop, suCommand's type was + * int, if a user upgrades to current version from an older version, + * suCommandIsDigit will become "true" and we will set suCommand according + * to the stored config entry. + */ + if(suCommandIsDigit) + { + switch(suCommandNum) + { + case 1: + { + suCommand = QStringLiteral("kdesudo"); + break; + } + case 2: + { + suCommand = QStringLiteral("sudo"); + break; + } + default: + suCommand = QStringLiteral("kdesu"); + } + + builderGroup.writeEntry("Su Command", suCommand); + //so that suCommandIsDigit becomes false next time + //project is opened. } + + QRegExp regEx(" "); + suCommandWithArg = suCommand.split(regEx); + if( suCommandWithArg.isEmpty() ) + { + suCommandWithArg << QStringLiteral("kdesu") << QStringLiteral("-t"); + } + + return suCommandWithArg; } return QStringList(); }