Commit b03ab1d7 authored by Friedemann Kleint's avatar Friedemann Kleint

Add command locator.

Make it possible to trigger actions from the locator bar by
registering an instance of Locator::CommandLocator by prefix.
Currently used for VCS systems.

Acked-by: con
Initial-patch-by: default avatarRoberto Raggi <roberto.raggi@nokia.com>
parent 354fd8d8
......@@ -39,6 +39,7 @@
#include <vcsbase/vcsbaseeditor.h>
#include <vcsbase/basevcssubmiteditorfactory.h>
#include <vcsbase/vcsbaseoutputwindow.h>
#include <locator/commandlocator.h>
#include <utils/synchronousprocess.h>
#include <utils/parameteraction.h>
......@@ -150,6 +151,7 @@ CVSPlugin *CVSPlugin::m_cvsPluginInstance = 0;
CVSPlugin::CVSPlugin() :
VCSBase::VCSBasePlugin(QLatin1String(CVS::Constants::CVSCOMMITEDITOR_ID)),
m_commandLocator(0),
m_addAction(0),
m_deleteAction(0),
m_revertAction(0),
......@@ -239,6 +241,10 @@ bool CVSPlugin::initialize(const QStringList & /*arguments */, QString *errorMes
addAutoReleasedObject(new CheckoutWizard);
const QString prefix = QLatin1String("cvs");
m_commandLocator = new Locator::CommandLocator(QLatin1String("CVS"), prefix, prefix);
addAutoReleasedObject(m_commandLocator);
//register actions
Core::ActionManager *ami = core->actionManager();
Core::ActionContainer *toolsContainer = ami->actionContainer(M_TOOLS);
......@@ -261,6 +267,7 @@ bool CVSPlugin::initialize(const QStringList & /*arguments */, QString *errorMes
command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+D")));
connect(m_diffCurrentAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_filelogCurrentAction,
......@@ -269,6 +276,7 @@ bool CVSPlugin::initialize(const QStringList & /*arguments */, QString *errorMes
connect(m_filelogCurrentAction, SIGNAL(triggered()), this,
SLOT(filelogCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_annotateCurrentAction,
......@@ -277,6 +285,7 @@ bool CVSPlugin::initialize(const QStringList & /*arguments */, QString *errorMes
connect(m_annotateCurrentAction, SIGNAL(triggered()), this,
SLOT(annotateCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR0, globalcontext));
......@@ -287,6 +296,7 @@ bool CVSPlugin::initialize(const QStringList & /*arguments */, QString *errorMes
command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+A")));
connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_commitCurrentAction = new Utils::ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_commitCurrentAction,
......@@ -295,6 +305,7 @@ bool CVSPlugin::initialize(const QStringList & /*arguments */, QString *errorMes
command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+C")));
connect(m_commitCurrentAction, SIGNAL(triggered()), this, SLOT(startCommitCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_deleteAction, CMD_ID_DELETE_FILE,
......@@ -302,6 +313,7 @@ bool CVSPlugin::initialize(const QStringList & /*arguments */, QString *errorMes
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_revertAction = new Utils::ParameterAction(tr("Revert..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_revertAction, CMD_ID_REVERT,
......@@ -309,6 +321,7 @@ bool CVSPlugin::initialize(const QStringList & /*arguments */, QString *errorMes
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR1, globalcontext));
......@@ -318,6 +331,7 @@ bool CVSPlugin::initialize(const QStringList & /*arguments */, QString *errorMes
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffProject()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_statusProjectAction = new Utils::ParameterAction(tr("Project Status"), tr("Status of Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_statusProjectAction, CMD_ID_STATUS,
......@@ -325,18 +339,21 @@ bool CVSPlugin::initialize(const QStringList & /*arguments */, QString *errorMes
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_statusProjectAction, SIGNAL(triggered()), this, SLOT(projectStatus()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_updateProjectAction = new Utils::ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateProject()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR2, globalcontext));
......@@ -344,18 +361,21 @@ bool CVSPlugin::initialize(const QStringList & /*arguments */, QString *errorMes
command = ami->registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext);
connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_commitAllAction = new QAction(tr("Commit All Files"), this);
command = ami->registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL,
globalcontext);
connect(m_commitAllAction, SIGNAL(triggered()), this, SLOT(startCommitAll()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
m_revertRepositoryAction = new QAction(tr("Revert Repository..."), this);
command = ami->registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL,
globalcontext);
connect(m_revertRepositoryAction, SIGNAL(triggered()), this, SLOT(revertAll()));
cvsMenu->addAction(command);
m_commandLocator->appendCommand(command);
// Actions of the submit editor
QList<int> cvscommitcontext;
......@@ -498,10 +518,14 @@ CVSSubmitEditor *CVSPlugin::openCVSSubmitEditor(const QString &fileName)
void CVSPlugin::updateActions(VCSBase::VCSBasePlugin::ActionState as)
{
if (!enableMenuAction(as, m_menuAction))
if (!enableMenuAction(as, m_menuAction)) {
m_commandLocator->setEnabled(false);
return;
}
m_logRepositoryAction->setEnabled(currentState().hasTopLevel());
const bool hasTopLevel = currentState().hasTopLevel();
m_commandLocator->setEnabled(hasTopLevel);
m_logRepositoryAction->setEnabled(hasTopLevel);
const QString currentFileName = currentState().currentFileName();
m_addAction->setParameter(currentFileName);
......@@ -518,7 +542,7 @@ void CVSPlugin::updateActions(VCSBase::VCSBasePlugin::ActionState as)
m_updateProjectAction->setParameter(currentProjectName);
m_logProjectAction->setParameter(currentProjectName);
m_commitAllAction->setEnabled(currentState().hasTopLevel());
m_commitAllAction->setEnabled(hasTopLevel);
}
void CVSPlugin::addCurrentFile()
......
......@@ -54,6 +54,10 @@ namespace VCSBase {
class VCSBaseSubmitEditor;
}
namespace Locator {
class CommandLocator;
}
namespace CVS {
namespace Internal {
......@@ -151,6 +155,7 @@ private:
QString m_commitMessageFileName;
QString m_commitRepository;
Locator::CommandLocator *m_commandLocator;
Utils::ParameterAction *m_addAction;
Utils::ParameterAction *m_deleteAction;
Utils::ParameterAction *m_revertAction;
......
This diff is collapsed.
......@@ -54,7 +54,9 @@ class ICore;
namespace Utils {
class ParameterAction;
}
namespace Locator {
class CommandLocator;
}
namespace Git {
namespace Internal {
......@@ -125,6 +127,7 @@ private:
static GitPlugin *m_instance;
Core::ICore *m_core;
Locator::CommandLocator *m_commandLocator;
Utils::ParameterAction *m_diffAction;
Utils::ParameterAction *m_diffProjectAction;
QAction *m_diffRepositoryAction;
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "commandlocator.h"
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>
#include <QtGui/QAction>
namespace Locator {
struct CommandLocatorPrivate {
CommandLocatorPrivate(const QString &prefix,
const QString &displayName) :
m_prefix(prefix), m_displayName(displayName) {}
const QString m_prefix;
const QString m_displayName;
QList<Core::Command *> commands;
};
CommandLocator::CommandLocator(const QString &prefix,
const QString &displayName,
const QString &shortCutString,
QObject *parent) :
Locator::ILocatorFilter(parent),
d(new CommandLocatorPrivate(prefix, displayName))
{
setShortcutString(shortCutString);
}
CommandLocator::~CommandLocator()
{
delete d;
}
void CommandLocator::appendCommand(Core::Command *cmd)
{
d->commands.push_back(cmd);
}
QString CommandLocator::displayName() const
{
return d->m_displayName;
}
QString CommandLocator::id() const
{
return d->m_prefix;
}
ILocatorFilter::Priority CommandLocator::priority() const
{
return Medium;
}
QList<Locator::FilterEntry> CommandLocator::matchesFor(const QString &entry)
{
QList<FilterEntry> filters;
// Get active, enabled actions matching text, store in list.
// Reference via index in extraInfo.
const QChar ampersand = QLatin1Char('&');
const int count = d->commands.size();
for (int i = 0; i < count; i++) {
if (d->commands.at(i)->isActive()) {
if (QAction *action = d->commands.at(i)->action())
if (action->isEnabled()) {
QString text = action->text();
text.remove(ampersand);
if (text.contains(entry, Qt::CaseInsensitive)) {
filters.append(FilterEntry(this, text, QVariant(i)));
}
}
}
}
return filters;
}
void CommandLocator::accept(Locator::FilterEntry entry) const
{
// Retrieve action via index.
const int index = entry.internalData.toInt();
QTC_ASSERT(index >= 0 && index < d->commands.size(), return)
QAction *action = d->commands.at(index)->action();
QTC_ASSERT(action->isEnabled(), return)
action->trigger();
}
void CommandLocator::setEnabled(bool e)
{
setHidden(!e);
}
void CommandLocator::refresh(QFutureInterface<void> &)
{
}
} // namespace Locator
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef COMMANDLOCATOR_H
#define COMMANDLOCATOR_H
#include "locator_global.h"
#include "ilocatorfilter.h"
#include <QtCore/QList>
QT_BEGIN_NAMESPACE
class QAction;
QT_END_NAMESPACE
namespace Core {
class Command;
}
namespace Locator {
/* Command locators: Provides completion for a set of
* Core::Command's by sub-string of their action's text. */
struct CommandLocatorPrivate;
class LOCATOR_EXPORT CommandLocator : public Locator::ILocatorFilter
{
Q_DISABLE_COPY(CommandLocator)
Q_OBJECT
public:
explicit CommandLocator(const QString &prefix,
const QString &displayName,
const QString &shortCutString,
QObject *parent = 0);
virtual ~CommandLocator();
void appendCommand(Core::Command *cmd);
virtual QString displayName() const;
virtual QString id() const;
virtual Priority priority() const;
virtual QList<FilterEntry> matchesFor(const QString &entry);
virtual void accept(FilterEntry selection) const;
virtual void refresh(QFutureInterface<void> &future);
public slots:
void setEnabled(bool e);
private:
CommandLocatorPrivate *d;
};
inline CommandLocator &operator<<(CommandLocator &locator, Core::Command *cmd)
{
locator.appendCommand(cmd);
return locator;
}
} // namespace Locator
#endif // COMMANDLOCATOR_H
......@@ -4,6 +4,7 @@ DEFINES += LOCATOR_LIBRARY
include(../../qtcreatorplugin.pri)
include(locator_dependencies.pri)
HEADERS += locatorplugin.h \
commandlocator.h \
locatorwidget.h \
locatorfiltersfilter.h \
settingspage.h \
......@@ -16,6 +17,7 @@ HEADERS += locatorplugin.h \
basefilefilter.h \
locator_global.h
SOURCES += locatorplugin.cpp \
commandlocator.cpp \
locatorwidget.cpp \
locatorfiltersfilter.cpp \
opendocumentsfilter.cpp \
......@@ -25,6 +27,7 @@ SOURCES += locatorplugin.cpp \
locatormanager.cpp \
basefilefilter.cpp \
ilocatorfilter.cpp
FORMS += settingspage.ui \
filesystemfilter.ui \
directoryfilter.ui
......
......@@ -49,6 +49,8 @@
#include <coreplugin/filemanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <locator/commandlocator.h>
#include <utils/parameteraction.h>
#include <utils/qtcassert.h>
......@@ -124,6 +126,8 @@ MercurialPlugin::MercurialPlugin() :
VCSBase::VCSBasePlugin(QLatin1String(Constants::COMMIT_ID)),
optionsPage(0),
m_client(0),
core(0),
m_commandLocator(0),
changeLog(0),
m_addAction(0),
m_deleteAction(0),
......@@ -172,6 +176,10 @@ bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString *
addAutoReleasedObject(new CloneWizard);
const QString prefix = QLatin1String("hg");
m_commandLocator = new Locator::CommandLocator(QLatin1String("Mercurial"), prefix, prefix);
addAutoReleasedObject(m_commandLocator);
createMenu();
createSubmitEditorActions();
......@@ -234,6 +242,7 @@ void MercurialPlugin::createFileActions(const QList<int> &context)
command->setAttribute(Core::Command::CA_UpdateText);
connect(annotateFile, SIGNAL(triggered()), this, SLOT(annotateCurrentFile()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
diffFile = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = actionManager->registerAction(diffFile, QLatin1String(Constants::DIFF), context);
......@@ -241,6 +250,7 @@ void MercurialPlugin::createFileActions(const QList<int> &context)
command->setDefaultKeySequence(QKeySequence(tr("Alt+H,Alt+D")));
connect(diffFile, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
logFile = new Utils::ParameterAction(tr("Log Current File"), tr("Log \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = actionManager->registerAction(logFile, QLatin1String(Constants::LOG), context);
......@@ -248,6 +258,7 @@ void MercurialPlugin::createFileActions(const QList<int> &context)
command->setDefaultKeySequence(QKeySequence(tr("Alt+H,Alt+L")));
connect(logFile, SIGNAL(triggered()), this, SLOT(logCurrentFile()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
statusFile = new Utils::ParameterAction(tr("Status Current File"), tr("Status \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = actionManager->registerAction(statusFile, QLatin1String(Constants::STATUS), context);
......@@ -255,6 +266,7 @@ void MercurialPlugin::createFileActions(const QList<int> &context)
command->setDefaultKeySequence(QKeySequence(tr("Alt+H,Alt+S")));
connect(statusFile, SIGNAL(triggered()), this, SLOT(statusCurrentFile()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
createSeparator(context, QLatin1String("FileDirSeperator1"));
......@@ -263,18 +275,21 @@ void MercurialPlugin::createFileActions(const QList<int> &context)
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
command = actionManager->registerAction(m_deleteAction, QLatin1String(Constants::DELETE), context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
revertFile = new Utils::ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
command = actionManager->registerAction(revertFile, QLatin1String(Constants::REVERT), context);
command->setAttribute(Core::Command::CA_UpdateText);
connect(revertFile, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
}
void MercurialPlugin::addCurrentFile()
......@@ -333,26 +348,31 @@ void MercurialPlugin::createDirectoryActions(const QList<int> &context)
command = actionManager->registerAction(action, QLatin1String(Constants::DIFFMULTI), context);
connect(action, SIGNAL(triggered()), this, SLOT(diffRepository()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Log"), this);
m_repositoryActionList.append(action);
command = actionManager->registerAction(action, QLatin1String(Constants::LOGMULTI), context);
connect(action, SIGNAL(triggered()), this, SLOT(logRepository()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Revert..."), this);
m_repositoryActionList.append(action);
command = actionManager->registerAction(action, QLatin1String(Constants::REVERTMULTI), context);
connect(action, SIGNAL(triggered()), this, SLOT(revertMulti()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Status"), this);
m_repositoryActionList.append(action);
command = actionManager->registerAction(action, QLatin1String(Constants::STATUSMULTI), context);
connect(action, SIGNAL(triggered()), this, SLOT(statusMulti()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
}
void MercurialPlugin::diffRepository()
{
const VCSBase::VCSBasePluginState state = currentState();
......@@ -393,36 +413,42 @@ void MercurialPlugin::createRepositoryActions(const QList<int> &context)
Core::Command *command = actionManager->registerAction(action, QLatin1String(Constants::PULL), context);
connect(action, SIGNAL(triggered()), this, SLOT(pull()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Push..."), this);
m_repositoryActionList.append(action);
command = actionManager->registerAction(action, QLatin1String(Constants::PUSH), context);
connect(action, SIGNAL(triggered()), this, SLOT(push()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Update..."), this);
m_repositoryActionList.append(action);
command = actionManager->registerAction(action, QLatin1String(Constants::UPDATE), context);
connect(action, SIGNAL(triggered()), this, SLOT(update()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Import..."), this);
m_repositoryActionList.append(action);
command = actionManager->registerAction(action, QLatin1String(Constants::IMPORT), context);
connect(action, SIGNAL(triggered()), this, SLOT(import()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Incoming..."), this);
m_repositoryActionList.append(action);
command = actionManager->registerAction(action, QLatin1String(Constants::INCOMING), context);
connect(action, SIGNAL(triggered()), this, SLOT(incoming()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Outgoing..."), this);
m_repositoryActionList.append(action);
command = actionManager->registerAction(action, QLatin1String(Constants::OUTGOING), context);
connect(action, SIGNAL(triggered()), this, SLOT(outgoing()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
action = new QAction(tr("Commit..."), this);
m_repositoryActionList.append(action);
......@@ -430,6 +456,7 @@ void MercurialPlugin::createRepositoryActions(const QList<int> &context)
command->setDefaultKeySequence(QKeySequence(tr("Alt+H,Alt+C")));
connect(action, SIGNAL(triggered()), this, SLOT(commit()));
mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command);
m_createRepositoryAction = new QAction(tr("Create Repository..."), this);
command = actionManager->registerAction(m_createRepositoryAction, QLatin1String(Constants::CREATE_REPOSITORY), context);
......
......@@ -60,6 +60,10 @@ namespace VCSBase {
class VCSBaseSubmitEditor;
}
namespace Locator {
class CommandLocator;
}
namespace Mercurial {
namespace Internal {
......@@ -150,6 +154,7 @@ private:
MercurialClient *m_client;
Core::ICore *core;
Locator::CommandLocator *m_commandLocator;
Core::ActionManager *actionManager;
Core::ActionContainer *mercurialContainer;
......
This diff is collapsed.
......@@ -53,6 +53,10 @@ namespace Utils {
class ParameterAction;
}
namespace Locator {
class CommandLocator;
}
namespace Perforce {
namespace Internal {
......@@ -192,6 +196,7 @@ private:
inline PerforceVersionControl *perforceVersionControl() const;