From 0f53e240065de915de9229ce4699a17a6f947c67 Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Sat, 14 Dec 2019 20:40:23 +0000 Subject: [PATCH] CMake: Show project name in showConfigureErrorMessage Signed-off-by: Juraj Oravec --- plugins/cmake/cmakemanager.cpp | 11 ++++++----- plugins/cmake/cmakemanager.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/cmake/cmakemanager.cpp b/plugins/cmake/cmakemanager.cpp index c075819aa8..be419a9c4c 100644 --- a/plugins/cmake/cmakemanager.cpp +++ b/plugins/cmake/cmakemanager.cpp @@ -206,7 +206,7 @@ KJob* CMakeManager::createImportJob(ProjectFolderItem* item) if (job->error() != 0) { qCWarning(CMAKE) << "couldn't load project successfully" << project->name(); m_projects.remove(project); - showConfigureErrorMessage(job->errorText()); + showConfigureErrorMessage(project->name(), job->errorText()); } }); @@ -399,7 +399,7 @@ void CMakeManager::serverResponse(KDevelop::IProject* project, const QJsonObject } else qCDebug(CMAKE) << "unhandled signal response..." << project << response; } else if (response[QStringLiteral("type")] == QLatin1String("error")) { - showConfigureErrorMessage(response[QStringLiteral("errorMessage")].toString()); + showConfigureErrorMessage(project->name(), response[QStringLiteral("errorMessage")].toString()); } else if (response[QStringLiteral("type")] == QLatin1String("reply")) { const auto inReplyTo = response[QStringLiteral("inReplyTo")]; if (inReplyTo == QLatin1String("configure")) { @@ -860,19 +860,20 @@ KTextEditor::Range CMakeManager::termRangeAtPosition(const KTextEditor::Document return KTextEditor::Range(start, end); } -void CMakeManager::showConfigureErrorMessage(const QString& errorMessage) const +void CMakeManager::showConfigureErrorMessage(const QString& projectName, const QString& errorMessage) const { if (!QApplication::activeWindow()) { // Do not show a message box if there is no active window in order not to block unit tests. return; } KMessageBox::error(QApplication::activeWindow(), i18n( - "Failed to configure the project (error message: %1)." + "Failed to configure project '%1' (error message: %2)." " As a result, KDevelop's code understanding will likely be broken.\n" "\n" "To fix this issue, please ensure that the project's CMakeLists.txt files" " are correct, and KDevelop is configured to use the correct CMake version and settings." - " Then right-click the project item in the projects tool view and click 'Reload'.", errorMessage)); + " Then right-click the project item in the projects tool view and click 'Reload'.", + projectName, errorMessage)); } QPair CMakeManager::specialLanguageObjectNavigationWidget(const QUrl& url, const KTextEditor::Cursor& position) diff --git a/plugins/cmake/cmakemanager.h b/plugins/cmake/cmakemanager.h index 43b46bba36..bba83604f0 100644 --- a/plugins/cmake/cmakemanager.h +++ b/plugins/cmake/cmakemanager.h @@ -162,7 +162,7 @@ private: KTextEditor::Range termRangeAtPosition(const KTextEditor::Document* textDocument, const KTextEditor::Cursor& position) const; - void showConfigureErrorMessage(const QString& errorMessage) const; + void showConfigureErrorMessage(const QString& projectName, const QString& errorMessage) const; private: QHash m_projects; -- GitLab