From 220ca90b3e3be1dc700a2ac9a915701c144aedc7 Mon Sep 17 00:00:00 2001 From: Xiaofeng Wang Date: Sat, 16 Mar 2019 22:07:02 +0800 Subject: [PATCH] ProjectExplorer: level-up m_openTerminalHere action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Christian Stenger Reviewed-by: André Hartmann Reviewed-by: Orgad Shaneh --- src/plugins/projectexplorer/projectexplorer.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index d458c6bd7f8..160b0cb65eb 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -807,11 +807,13 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er mfileContextMenu->appendGroup(Constants::G_PROJECT_TREE); // Open Terminal submenu +#if !defined(Q_OS_UNIX) || QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) ActionContainer * const openTerminal = ActionManager::createMenu(ProjectExplorer::Constants::M_OPENTERMINALCONTEXT); openTerminal->setOnAllDisabledBehavior(ActionContainer::Show); dd->m_openTerminalMenu = openTerminal->menu(); dd->m_openTerminalMenu->setTitle(FileUtils::msgTerminalAction()); +#endif // "open with" submenu ActionContainer * const openWith = @@ -879,6 +881,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN); mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES); +#if !defined(Q_OS_UNIX) || QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) // Open Terminal Here menu mfileContextMenu->addMenu(openTerminal, Constants::G_FILE_OPEN); 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, projecTreeContext); 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_openTerminalHereRunEnv = new QAction(tr("Run Environment"), this);