From aa4dd98be85fc342f3063f8bce670c678c42a89a Mon Sep 17 00:00:00 2001 From: Robert Loehning <robert.loehning@theqtcompany.com> Date: Wed, 3 Feb 2016 14:26:38 +0100 Subject: [PATCH] Git: Always enable "Actions on Commits..." User can provide a path to the dialog so this can be handy even without an open project or file. Change-Id: I1ed96fe56b6ab76ca98f8d81ef60b217e66d0661 Reviewed-by: Orgad Shaneh <orgads@gmail.com> --- src/plugins/git/gitplugin.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index f6f01c55900..00da9a68a41 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -62,6 +62,7 @@ #include <utils/mimetypes/mimedatabase.h> #include <utils/qtcassert.h> #include <utils/parameteraction.h> +#include <utils/pathchooser.h> #include <vcsbase/basevcseditorfactory.h> #include <vcsbase/submitfilemodel.h> @@ -590,8 +591,12 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) // -------------- gitContainer->addSeparator(context); - createRepositoryAction(gitContainer, tr("Actions on Commits..."), "Git.ChangeActions", - context, false, [this] { startChangeRelatedAction("Git.ChangeActions"); }); + QAction *actionsOnCommitsAction = new QAction(tr("Actions on Commits..."), this); + Command *actionsOnCommitsCommand = ActionManager::registerAction( + actionsOnCommitsAction, "Git.ChangeActions"); + connect(actionsOnCommitsAction, &QAction::triggered, this, + [this] { startChangeRelatedAction("Git.ChangeActions"); }); + gitContainer->addAction(actionsOnCommitsCommand); QAction *createRepositoryAction = new QAction(tr("Create Repository..."), this); Command *createRepositoryCommand = ActionManager::registerAction( @@ -756,10 +761,9 @@ void GitPlugin::startRebase() void GitPlugin::startChangeRelatedAction(const Id &id) { const VcsBasePluginState state = currentState(); - if (!state.hasTopLevel()) - return; - ChangeSelectionDialog dialog(state.topLevel(), id, ICore::mainWindow()); + ChangeSelectionDialog dialog(state.hasTopLevel() ? state.topLevel() : PathChooser::homePath(), + id, ICore::mainWindow()); int result = dialog.exec(); -- GitLab