ProjectExplorer: level-up m_openTerminalHere action

With Q_OS_UNIX && QT < 5.10, the m_openTerminalHereBuildEnv and
m_openTerminalHereRunEnv is disabled, there is only an action of
m_openTerminalHere in the m_openTerminalMenu, so let's just level it up.

Change-Id: Ia37364dca7f80cedd02ef89de86b6d66c70cd4af
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Xiaofeng Wang
2019-03-16 22:07:02 +08:00
parent 25f5c26306
commit 220ca90b3e

View File

@@ -807,11 +807,13 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
mfileContextMenu->appendGroup(Constants::G_PROJECT_TREE); mfileContextMenu->appendGroup(Constants::G_PROJECT_TREE);
// Open Terminal submenu // Open Terminal submenu
#if !defined(Q_OS_UNIX) || QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
ActionContainer * const openTerminal = ActionContainer * const openTerminal =
ActionManager::createMenu(ProjectExplorer::Constants::M_OPENTERMINALCONTEXT); ActionManager::createMenu(ProjectExplorer::Constants::M_OPENTERMINALCONTEXT);
openTerminal->setOnAllDisabledBehavior(ActionContainer::Show); openTerminal->setOnAllDisabledBehavior(ActionContainer::Show);
dd->m_openTerminalMenu = openTerminal->menu(); dd->m_openTerminalMenu = openTerminal->menu();
dd->m_openTerminalMenu->setTitle(FileUtils::msgTerminalAction()); dd->m_openTerminalMenu->setTitle(FileUtils::msgTerminalAction());
#endif
// "open with" submenu // "open with" submenu
ActionContainer * const openWith = ActionContainer * const openWith =
@@ -879,6 +881,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN); mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES); mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
#if !defined(Q_OS_UNIX) || QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
// Open Terminal Here menu // Open Terminal Here menu
mfileContextMenu->addMenu(openTerminal, Constants::G_FILE_OPEN); mfileContextMenu->addMenu(openTerminal, Constants::G_FILE_OPEN);
mfolderContextMenu->addMenu(openTerminal, Constants::G_FOLDER_FILES); mfolderContextMenu->addMenu(openTerminal, Constants::G_FOLDER_FILES);
@@ -887,6 +890,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
cmd = ActionManager::registerAction(dd->m_openTerminalHere, Constants::OPENTERMINALHERE, cmd = ActionManager::registerAction(dd->m_openTerminalHere, Constants::OPENTERMINALHERE,
projecTreeContext); projecTreeContext);
dd->m_openTerminalMenu->addAction(dd->m_openTerminalHere); dd->m_openTerminalMenu->addAction(dd->m_openTerminalHere);
#else
dd->m_openTerminalHere = new QAction(FileUtils::msgTerminalAction(), this);
cmd = ActionManager::registerAction(dd->m_openTerminalHere, Constants::OPENTERMINALHERE,
projecTreeContext);
mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
#endif
dd->m_openTerminalHereBuildEnv = new QAction(tr("Build Environment"), this); dd->m_openTerminalHereBuildEnv = new QAction(tr("Build Environment"), this);
dd->m_openTerminalHereRunEnv = new QAction(tr("Run Environment"), this); dd->m_openTerminalHereRunEnv = new QAction(tr("Run Environment"), this);