diff --git a/src/plugins/axivion/axivionoutputpane.cpp b/src/plugins/axivion/axivionoutputpane.cpp index 79c90936cf4..d66468590bf 100644 --- a/src/plugins/axivion/axivionoutputpane.cpp +++ b/src/plugins/axivion/axivionoutputpane.cpp @@ -235,7 +235,7 @@ public: }).link; Project *project = ProjectManager::startupProject(); FilePath baseDir = project ? project->projectDirectory() : FilePath{}; - link.targetFilePath = baseDir.resolvePath(link.targetFilePath); + link.targetFilePath = findFileForIssuePath(link.targetFilePath); if (link.targetFilePath.exists()) EditorManager::openEditorAt(link); } diff --git a/src/plugins/axivion/axivionplugin.cpp b/src/plugins/axivion/axivionplugin.cpp index fa455c07eb9..0f4686e403c 100644 --- a/src/plugins/axivion/axivionplugin.cpp +++ b/src/plugins/axivion/axivionplugin.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -236,6 +237,7 @@ public: TaskTreeRunner m_taskTreeRunner; std::unordered_map> m_docMarksTrees; TaskTreeRunner m_issueInfoRunner; + FileInProjectFinder m_fileFinder; // FIXME maybe obsolete when path mapping is implemented }; static AxivionPluginPrivate *dd = nullptr; @@ -337,10 +339,17 @@ void AxivionPluginPrivate::onStartupProjectChanged(Project *project) m_currentProjectInfo = {}; updateDashboard(); - if (!m_project) + if (!m_project) { + m_fileFinder.setProjectDirectory({}); + m_fileFinder.setProjectFiles({}); return; + } - connect(m_project, &Project::fileListChanged, this, &AxivionPluginPrivate::handleOpenedDocs); + m_fileFinder.setProjectDirectory(m_project->projectDirectory()); + connect(m_project, &Project::fileListChanged, this, [this]{ + m_fileFinder.setProjectFiles(m_project->files(Project::AllFiles)); + handleOpenedDocs(); + }); const AxivionProjectSettings *projSettings = AxivionProjectSettings::projectSettings(m_project); fetchProjectInfo(projSettings->dashboardProjectName()); } @@ -961,7 +970,7 @@ void AxivionPluginPrivate::handleAnchorClicked(const QUrl &url) return; Link link; if (const QString path = query.queryItemValue("filename", QUrl::FullyDecoded); !path.isEmpty()) - link.targetFilePath = m_project->projectDirectory().pathAppended(path); + link.targetFilePath = findFileForIssuePath(FilePath::fromUserInput(path)); if (const QString line = query.queryItemValue("line"); !line.isEmpty()) link.targetLine = line.toInt(); // column entry is wrong - so, ignore it @@ -1040,6 +1049,15 @@ const std::optional currentDashboardInfo() return dd->m_dashboardInfo; } +Utils::FilePath findFileForIssuePath(const Utils::FilePath &issuePath) +{ + QTC_ASSERT(dd, return {}); + const FilePaths result = dd->m_fileFinder.findFile(QUrl::fromLocalFile(issuePath.toString())); + if (result.size() == 1) + return dd->m_project->projectDirectory().resolvePath(result.first()); + return {}; +} + } // Axivion::Internal #include "axivionplugin.moc" diff --git a/src/plugins/axivion/axivionplugin.h b/src/plugins/axivion/axivionplugin.h index db2f8494cb0..059e950ecc4 100644 --- a/src/plugins/axivion/axivionplugin.h +++ b/src/plugins/axivion/axivionplugin.h @@ -79,5 +79,7 @@ void fetchIssueInfo(const QString &id); const std::optional currentDashboardInfo(); +Utils::FilePath findFileForIssuePath(const Utils::FilePath &issuePath); + } // Axivion::Internal