diff --git a/gui/applicationdialog.cpp b/gui/applicationdialog.cpp index b84b1e294..fd8cf4973 100644 --- a/gui/applicationdialog.cpp +++ b/gui/applicationdialog.cpp @@ -65,16 +65,6 @@ void ApplicationDialog::Browse() if (!selectedFile.isEmpty()) { QString path(QDir::toNativeSeparators(selectedFile)); - - // In Windows we must surround paths including spaces with quotation marks. -#ifdef Q_WS_WIN - if (path.indexOf(" ") > -1) - { - path.insert(0, "\""); - path.append("\""); - } -#endif // Q_WS_WIN - mUI.mPath->setText(path); } } diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 1c9ad31af..575abdd54 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -705,7 +705,20 @@ void ResultsTree::StartApplication(QStandardItem *target, int application) params.replace("(message)", data["message"].toString(), Qt::CaseInsensitive); params.replace("(severity)", data["severity"].toString(), Qt::CaseInsensitive); - const QString program = mApplications->GetApplicationPath(application); + QString program = mApplications->GetApplicationPath(application); + + // In Windows we must surround paths including spaces with quotation marks. +#ifdef Q_WS_WIN + if (program.indexOf(" ") > -1) + { + if (!program.startsWith('"') && !program.endsWith('"')) + { + program.insert(0, "\""); + program.append("\""); + } + } +#endif // Q_WS_WIN + const QString cmdLine = QString("%1 %2").arg(program).arg(params); bool success = QProcess::startDetached(cmdLine);