File indexing completed on 2024-05-26 05:37:11
0001 /* 0002 SPDX-FileCopyrightText: 2020 Alexander Lohnau <alexander.lohnau@gmx.de> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "AbstractJob.h" 0008 0009 #include <KLocalizedString> 0010 #include <KTerminalLauncherJob> 0011 0012 void AbstractJob::runScriptInTerminal(const QString &script, const QString &pwd) 0013 { 0014 auto job = new KTerminalLauncherJob(script); 0015 job->setWorkingDirectory(pwd); 0016 connect(job, &KJob::result, [this, job]() { 0017 if (job->error()) { 0018 Q_EMIT error(xi18nc("@info:status", "Failed to run install script in terminal <message>%1</message>", job->errorString())); 0019 } else { 0020 Q_EMIT finished(); 0021 } 0022 }); 0023 job->start(); 0024 } 0025 0026 QString AbstractJob::terminalCloseMessage(bool install) 0027 { 0028 if (install) { 0029 return i18nc("@info", "Installation executed successfully, you may now close this window"); 0030 } else { 0031 return i18nc("@info", "Uninstallation executed successfully, you may now close this window"); 0032 } 0033 }