diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 60d2187c3ff5d48174136fe96432458088b1bf23..5ceaeadf2175625f8a807d52aa4b6cd565d0c218 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -110,6 +110,7 @@ GitPlugin::GitPlugin() : m_core(0), m_diffAction(0), m_diffProjectAction(0), + m_diffRepositoryAction(0), m_statusRepositoryAction(0), m_logAction(0), m_blameAction(0), @@ -270,11 +271,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffCurrentProject())); gitContainer->addAction(command); - m_statusRepositoryAction = new QAction(tr("Repository Status"), this); - command = actionManager->registerAction(m_statusRepositoryAction, "Git.StatusRepository", globalcontext); - connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository())); - gitContainer->addAction(command); - m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); command = actionManager->registerAction(m_logProjectAction, "Git.LogProject", globalcontext); command->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+K"))); @@ -282,6 +278,18 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject())); gitContainer->addAction(command); + gitContainer->addAction(createSeparator(actionManager, globalcontext, QLatin1String("Git.Sep.Repository"), this)); + + m_diffRepositoryAction = new QAction(tr("Diff Repository"), this); + command = actionManager->registerAction(m_diffRepositoryAction, "Git.DiffRepository", globalcontext); + connect(m_diffRepositoryAction, SIGNAL(triggered()), this, SLOT(diffRepository())); + gitContainer->addAction(command); + + m_statusRepositoryAction = new QAction(tr("Repository Status"), this); + command = actionManager->registerAction(m_statusRepositoryAction, "Git.StatusRepository", globalcontext); + connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository())); + gitContainer->addAction(command); + m_undoRepositoryAction = new QAction(tr("Undo Repository Changes"), this); command = actionManager->registerAction(m_undoRepositoryAction, "Git.UndoRepository", globalcontext); command->setAttribute(Core::Command::CA_UpdateText); @@ -390,6 +398,13 @@ void GitPlugin::diffCurrentProject() m_gitClient->diff(state.currentProjectTopLevel(), QStringList(), state.relativeCurrentProject()); } +void GitPlugin::diffRepository() +{ + const VCSBase::VCSBasePluginState state = currentState(); + QTC_ASSERT(state.hasTopLevel(), return) + m_gitClient->diff(state.topLevel(), QStringList(), QStringList()); +} + void GitPlugin::statusRepository() { const VCSBase::VCSBasePluginState state = currentState(); @@ -673,6 +688,7 @@ void GitPlugin::updateActions(VCSBase::VCSBasePlugin::ActionState as) m_undoRepositoryAction->setEnabled(projectEnabled); const bool repositoryEnabled = currentState().hasTopLevel(); + m_diffRepositoryAction->setEnabled(repositoryEnabled); m_statusRepositoryAction->setEnabled(repositoryEnabled); m_branchListAction->setEnabled(repositoryEnabled); m_stashListAction->setEnabled(repositoryEnabled); diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index baa46321cbd2bb34e8ccf9c34a55b0885d36ceac..924ccf9f29906a46d5eaab1892b9eb62f50610ea 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -88,6 +88,7 @@ public: private slots: void diffCurrentFile(); void diffCurrentProject(); + void diffRepository(); void submitEditorDiff(const QStringList &unstaged, const QStringList &staged); void submitCurrentLog(); void statusRepository(); @@ -121,6 +122,7 @@ private: Core::ICore *m_core; Utils::ParameterAction *m_diffAction; Utils::ParameterAction *m_diffProjectAction; + QAction *m_diffRepositoryAction; QAction *m_statusRepositoryAction; Utils::ParameterAction *m_logAction; Utils::ParameterAction *m_blameAction;