From 92a4c0d38a007f778893f7b971f747e1a803eac3 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 18 Jun 2020 00:04:17 +0300 Subject: VCS: Pass links to the correct VCS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current implementation requires each VCS to connect to the referenceClicked signal. Only Git does it, but this is conceptually wrong. If other VCSs would connect to the same signal, all of them will act upon clicking a link, which can result in multiple editors, most of them are likely to be invalid anyway. By default executes vcsDescribe. Can be extended or modified by subclasses. Change-Id: Ib953009efd77446a4b2963f0aa8a2f3f3d26509f Reviewed-by: Artur Shepilko Reviewed-by: André Hartmann --- src/plugins/git/gitplugin.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/plugins/git') diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index d256ff4e2f4..6a17e89f088 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -271,6 +271,15 @@ public: GitClient::addChangeActions(menu, workingDirectory, reference); } + bool handleLink(const QString &workingDirectory, const QString &reference) final + { + if (reference.contains("..")) + GitClient::instance()->log(workingDirectory, {}, false, {reference}); + else + GitClient::instance()->show(workingDirectory, reference); + return true; + } + RepoUrl getRepoUrl(const QString &location) const override; QStringList additionalToolsPath() const final; @@ -1001,16 +1010,6 @@ GitPluginPrivate::GitPluginPrivate() m_gerritPlugin->updateActions(currentState()); m_gerritPlugin->addToLocator(m_commandLocator); - connect(VcsOutputWindow::instance(), &VcsOutputWindow::referenceClicked, - this, [this](const QString &name) { - const VcsBasePluginState state = currentState(); - QTC_ASSERT(state.hasTopLevel(), return); - if (name.contains("..")) - m_gitClient.log(state.topLevel(), {}, false, {name}); - else - m_gitClient.show(state.topLevel(), name); - }); - } void GitPluginPrivate::diffCurrentFile() -- cgit v1.2.3