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>
This commit is contained in:
Robert Loehning
2016-02-03 14:26:38 +01:00
parent 226eea92de
commit aa4dd98be8

View File

@@ -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();