mirror-kde-plasma-desktop/kcms/runners/plugininstaller/AbstractJob.cpp
Kai Uwe Broulik dbe076acf5 Build with QT_NO_CONTEXTLESS_CONNECT
Disables the 3-argument connect without a context object. Not providing a context
object can cause issues when the sending object is still alive but the receiver
or an object refered to in the lambda is not.
2026-03-28 11:17:58 +00:00

35 lines
1,022 B
C++

/*
SPDX-FileCopyrightText: 2020 Alexander Lohnau <alexander.lohnau@gmx.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "AbstractJob.h"
#include <KLocalizedString>
#include <KTerminalLauncherJob>
void AbstractJob::runScriptInTerminal(const QString &script, const QString &pwd)
{
auto job = new KTerminalLauncherJob(script);
job->setWorkingDirectory(pwd);
connect(job, &KJob::result, this, [this, job]() {
if (job->error()) {
Q_EMIT error(xi18nc("@info:status", "Failed to run install script in terminal <message>%1</message>", job->errorString()));
} else {
Q_EMIT finished();
}
});
job->start();
}
QString AbstractJob::terminalCloseMessage(bool install)
{
if (install) {
return i18nc("@info", "Installation executed successfully, you may now close this window");
} else {
return i18nc("@info", "Uninstallation executed successfully, you may now close this window");
}
}
#include "moc_AbstractJob.cpp"