forked from qt-creator/qt-creator
ProjectExplorer: create provideAskPassEntry(Environment &) convenience
... to centrally set SUDO_ASKPASS unless present. To be used for 'Run as root' Change-Id: I85bac939e6a7fba0b2299fd17edfe73577bfa5ad Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -50,6 +50,8 @@
|
|||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
|
#include <ssh/sshsettings.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
@@ -1067,6 +1069,15 @@ bool RunControl::showPromptToStopDialog(const QString &title,
|
|||||||
return close;
|
return close;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunControl::provideAskPassEntry(Environment &env)
|
||||||
|
{
|
||||||
|
if (env.value("SUDO_ASKPASS").isEmpty()) {
|
||||||
|
const FilePath askpass = QSsh::SshSettings::askpassFilePath();
|
||||||
|
if (askpass.exists())
|
||||||
|
env.set("SUDO_ASKPASS", askpass.toUserOutput());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool RunControlPrivate::isAllowedTransition(RunControlState from, RunControlState to)
|
bool RunControlPrivate::isAllowedTransition(RunControlState from, RunControlState to)
|
||||||
{
|
{
|
||||||
switch (from) {
|
switch (from) {
|
||||||
|
@@ -250,6 +250,8 @@ public:
|
|||||||
const QString &cancelButtonText = QString(),
|
const QString &cancelButtonText = QString(),
|
||||||
bool *prompt = nullptr);
|
bool *prompt = nullptr);
|
||||||
|
|
||||||
|
static void provideAskPassEntry(Utils::Environment &env);
|
||||||
|
|
||||||
RunWorker *createWorker(Utils::Id workerId);
|
RunWorker *createWorker(Utils::Id workerId);
|
||||||
|
|
||||||
bool createMainWorker();
|
bool createMainWorker();
|
||||||
|
Reference in New Issue
Block a user