From 705935352003399fc9e8f61e8ad291ca70546ed0 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 26 Sep 2014 13:42:22 +0200 Subject: Perforce: Disable actions when outside a repository. Task-number: QTCREATORBUG-13092 Change-Id: I3d059af748f0160ebfc97bebbd43de9210f17250 Reviewed-by: Christian Stenger --- src/plugins/perforce/perforceplugin.cpp | 44 ++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 14 deletions(-) (limited to 'src/plugins/perforce') diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index 76d4f86d2f..eb01750ed5 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -781,13 +781,37 @@ void PerforcePlugin::filelog(const QString &workingDir, const QString &fileName, void PerforcePlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as) { - if (!enableMenuAction(as, m_menuAction)) { - m_commandLocator->setEnabled(false); + const bool menuActionEnabled = enableMenuAction(as, m_menuAction); + const bool enableActions = currentState().hasTopLevel() && menuActionEnabled; + m_commandLocator->setEnabled(enableActions); + m_logRepositoryAction->setEnabled(enableActions); + m_editAction->setEnabled(enableActions); + m_addAction->setEnabled(enableActions); + m_deleteAction->setEnabled(enableActions); + m_openedAction->setEnabled(enableActions); + m_revertFileAction->setEnabled(enableActions); + m_diffFileAction->setEnabled(enableActions); + m_diffProjectAction->setEnabled(enableActions); + m_updateProjectAction->setEnabled(enableActions); + m_revertProjectAction->setEnabled(enableActions); + m_revertUnchangedAction->setEnabled(enableActions); + m_diffAllAction->setEnabled(enableActions); + m_submitProjectAction->setEnabled(enableActions); + m_pendingAction->setEnabled(enableActions); + m_describeAction->setEnabled(enableActions); + m_annotateCurrentAction->setEnabled(enableActions); + m_annotateAction->setEnabled(enableActions); + m_filelogCurrentAction->setEnabled(enableActions); + m_filelogAction->setEnabled(enableActions); + m_logProjectAction->setEnabled(enableActions); + m_logRepositoryAction->setEnabled(enableActions); + m_submitCurrentLogAction->setEnabled(enableActions); + m_updateAllAction->setEnabled(enableActions); + m_diffSelectedFiles->setEnabled(enableActions); + m_undoAction->setEnabled(enableActions); + m_redoAction->setEnabled(enableActions); + if (!menuActionEnabled) return; - } - const bool hasTopLevel = currentState().hasTopLevel(); - m_commandLocator->setEnabled(hasTopLevel); - m_logRepositoryAction->setEnabled(hasTopLevel); const QString fileName = currentState().currentFileName(); m_editAction->setParameter(fileName); @@ -805,14 +829,6 @@ void PerforcePlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as) m_submitProjectAction->setParameter(projectName); m_revertProjectAction->setParameter(projectName); m_revertUnchangedAction->setParameter(projectName); - - m_diffAllAction->setEnabled(true); - m_openedAction->setEnabled(true); - m_describeAction->setEnabled(true); - m_annotateAction->setEnabled(true); - m_filelogAction->setEnabled(true); - m_pendingAction->setEnabled(true); - m_updateAllAction->setEnabled(true); } bool PerforcePlugin::managesDirectory(const QString &directory, QString *topLevel /* = 0 */) -- cgit v1.2.1