From e514e403b4f2b65db7732bb657f6e27f95f9e5f4 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 19 Dec 2023 16:14:04 +0100 Subject: [PATCH] GitLab: Register open view action using ActionBuilder Change-Id: Id0bb3b2a3e5da266ce9014ffe2c81f9b0d0d442d Reviewed-by: Orgad Shaneh --- src/plugins/gitlab/gitlabplugin.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/plugins/gitlab/gitlabplugin.cpp b/src/plugins/gitlab/gitlabplugin.cpp index 19a6f2eb142..b87e43fd02a 100644 --- a/src/plugins/gitlab/gitlabplugin.cpp +++ b/src/plugins/gitlab/gitlabplugin.cpp @@ -30,10 +30,9 @@ #include #include +using namespace Core; + namespace GitLab { -namespace Constants { -const char GITLAB_OPEN_VIEW[] = "GitLab.OpenView"; -} // namespace Constants class GitLabPluginPrivate : public QObject { @@ -78,12 +77,11 @@ void GitLabPlugin::initialize() setupGitlabProjectPanel(); - QAction *openViewAction = new QAction(Tr::tr("GitLab..."), this); - auto gitlabCommand = Core::ActionManager::registerAction(openViewAction, - Constants::GITLAB_OPEN_VIEW); - connect(openViewAction, &QAction::triggered, this, &GitLabPlugin::openView); - Core::ActionContainer *ac = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); - ac->addAction(gitlabCommand); + ActionBuilder(this, "GitLab.OpenView") + .setText(Tr::tr("GitLab...")) + .addOnTriggered(this, &GitLabPlugin::openView) + .addToContainer(Core::Constants::M_TOOLS); + connect(ProjectExplorer::ProjectManager::instance(), &ProjectExplorer::ProjectManager::startupProjectChanged, this, &GitLabPlugin::onStartupProjectChanged);