Commit 38a05e93 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make sure helper apps we start are in path

parent 4330eb71
Pipeline #132237 passed with stage
in 3 minutes and 57 seconds
......@@ -215,7 +215,7 @@ void AccountsPageReceivingTab::slotAddMailAccount()
const QStringList lst = {QStringLiteral("--type"), QStringLiteral("message/rfc822")};
const QString path = QStandardPaths::findExecutable(QStringLiteral("accountwizard"));
if (!QProcess::startDetached(path, lst)) {
if (path.isEmpty() || !QProcess::startDetached(path, lst)) {
KMessageBox::error(this,
i18n("Could not start the account wizard. "
"Please make sure you have AccountWizard properly installed."),
......
......@@ -3717,9 +3717,15 @@ void KMComposerWin::slotRecipientLineIconClicked(MessageComposer::RecipientLineN
const auto data = line->data().dynamicCast<MessageComposer::Recipient>();
if (!data->key().isNull()) {
QProcess::startDetached(
QStringLiteral("kleopatra"),
{QStringLiteral("--query"), QString::fromLatin1(data->key().primaryFingerprint()), QStringLiteral("--parent-windowid"), QString::number(winId())});
const QString exec = QStandardPaths::findExecutable(QStringLiteral("kleopatra"));
if (exec.isEmpty()
|| !QProcess::startDetached(exec,
{QStringLiteral("--query"),
QString::fromLatin1(data->key().primaryFingerprint()),
QStringLiteral("--parent-windowid"),
QString::number(winId())})) {
qCWarning(KMAIL_LOG) << "Unable to execute kleopatra";
}
}
}
......
......@@ -83,7 +83,8 @@ void KMLaunchExternalComponent::slotConfigureFollowupReminder()
void KMLaunchExternalComponent::slotStartCertManager()
{
if (!QProcess::startDetached(QStringLiteral("kleopatra"), QStringList())) {
const QString exec = QStandardPaths::findExecutable(QStringLiteral("kleopatra"));
if (exec.isEmpty() || !QProcess::startDetached(exec, QStringList())) {
KMessageBox::error(mParentWidget,
i18n("Could not start certificate manager; "
"please make sure you have Kleopatra properly installed."),
......@@ -94,7 +95,7 @@ void KMLaunchExternalComponent::slotStartCertManager()
void KMLaunchExternalComponent::slotImportWizard()
{
const QString path = QStandardPaths::findExecutable(QStringLiteral("akonadiimportwizard"));
if (!QProcess::startDetached(path, QStringList())) {
if (path.isEmpty() || !QProcess::startDetached(path, QStringList())) {
KMessageBox::error(mParentWidget,
i18n("Could not start the import wizard. "
"Please make sure you have ImportWizard properly installed."),
......@@ -105,7 +106,7 @@ void KMLaunchExternalComponent::slotImportWizard()
void KMLaunchExternalComponent::slotExportData()
{
const QString path = QStandardPaths::findExecutable(QStringLiteral("pimdataexporter"));
if (!QProcess::startDetached(path, QStringList())) {
if (path.isEmpty() || !QProcess::startDetached(path, QStringList())) {
KMessageBox::error(mParentWidget,
i18n("Could not start \"PIM Data Exporter\" program. "
"Please check your installation."),
......@@ -125,7 +126,7 @@ void KMLaunchExternalComponent::slotImport()
{
const QStringList lst = {QStringLiteral("--mode"), QStringLiteral("manual")};
const QString path = QStandardPaths::findExecutable(QStringLiteral("akonadiimportwizard"));
if (!QProcess::startDetached(path, lst)) {
if (path.isEmpty() || !QProcess::startDetached(path, lst)) {
KMessageBox::error(mParentWidget,
i18n("Could not start the ImportWizard. "
"Please make sure you have ImportWizard properly installed."),
......@@ -138,7 +139,7 @@ void KMLaunchExternalComponent::slotAccountWizard()
const QStringList lst = {QStringLiteral("--type"), QStringLiteral("message/rfc822")};
const QString path = QStandardPaths::findExecutable(QStringLiteral("accountwizard"));
if (!QProcess::startDetached(path, lst)) {
if (path.isEmpty() || !QProcess::startDetached(path, lst)) {
KMessageBox::error(mParentWidget,
i18n("Could not start the account wizard. "
"Please make sure you have AccountWizard properly installed."),
......
......@@ -307,7 +307,7 @@ KMMainWidget::KMMainWidget(QWidget *parent, KXMLGUIClient *aGUIClient, KActionCo
KGuiItem(i18nc("@action:button", "Do Not Import"), QStringLiteral("dialog-cancel")));
if (answer == KMessageBox::Yes) {
const QString path = QStandardPaths::findExecutable(QStringLiteral("akonadiimportwizard"));
if (!QProcess::startDetached(path, QStringList())) {
if (path.isEmpty() || !QProcess::startDetached(path, QStringList())) {
KMessageBox::error(this,
i18n("Could not start the import wizard. "
"Please check your installation."),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment