forked from qt-creator/qt-creator
Add "Show in File System View" to more menus
And add a shortcut for editor manager for that, similar to "Show in Finder/Explorer" and "Open Terminal Here". Change-Id: Iddc287106e194c856501bf38e53b3c738a2aed1a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -135,6 +135,7 @@ const char ABOUT_QTCREATOR[] = "QtCreator.AboutQtCreator";
|
|||||||
const char ABOUT_PLUGINS[] = "QtCreator.AboutPlugins";
|
const char ABOUT_PLUGINS[] = "QtCreator.AboutPlugins";
|
||||||
const char S_RETURNTOEDITOR[] = "QtCreator.ReturnToEditor";
|
const char S_RETURNTOEDITOR[] = "QtCreator.ReturnToEditor";
|
||||||
const char SHOWINGRAPHICALSHELL[] = "QtCreator.ShowInGraphicalShell";
|
const char SHOWINGRAPHICALSHELL[] = "QtCreator.ShowInGraphicalShell";
|
||||||
|
const char SHOWINFILESYSTEMVIEW[] = "QtCreator.ShowInFileSystemView";
|
||||||
|
|
||||||
const char OUTPUTPANE_CLEAR[] = "Coreplugin.OutputPane.clear";
|
const char OUTPUTPANE_CLEAR[] = "Coreplugin.OutputPane.clear";
|
||||||
|
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
#include "editormanager.h"
|
#include "editormanager.h"
|
||||||
#include "editormanager_p.h"
|
#include "editormanager_p.h"
|
||||||
|
|
||||||
|
#include "../coreconstants.h"
|
||||||
#include "editorwindow.h"
|
#include "editorwindow.h"
|
||||||
|
|
||||||
#include "editorview.h"
|
#include "editorview.h"
|
||||||
@@ -421,6 +423,8 @@ EditorManagerPrivate::EditorManagerPrivate(QObject *parent) :
|
|||||||
m_closeAllEditorsExceptVisibleContextAction(new QAction(EditorManager::tr("Close All Except Visible"), this)),
|
m_closeAllEditorsExceptVisibleContextAction(new QAction(EditorManager::tr("Close All Except Visible"), this)),
|
||||||
m_openGraphicalShellAction(new QAction(FileUtils::msgGraphicalShellAction(), this)),
|
m_openGraphicalShellAction(new QAction(FileUtils::msgGraphicalShellAction(), this)),
|
||||||
m_openGraphicalShellContextAction(new QAction(FileUtils::msgGraphicalShellAction(), this)),
|
m_openGraphicalShellContextAction(new QAction(FileUtils::msgGraphicalShellAction(), this)),
|
||||||
|
m_showInFileSystemViewAction(new QAction(FileUtils::msgFileSystemAction(), this)),
|
||||||
|
m_showInFileSystemViewContextAction(new QAction(FileUtils::msgFileSystemAction(), this)),
|
||||||
m_openTerminalAction(new QAction(FileUtils::msgTerminalHereAction(), this)),
|
m_openTerminalAction(new QAction(FileUtils::msgTerminalHereAction(), this)),
|
||||||
m_findInDirectoryAction(new QAction(FileUtils::msgFindInDirectory(), this)),
|
m_findInDirectoryAction(new QAction(FileUtils::msgFindInDirectory(), this)),
|
||||||
m_filePropertiesAction(new QAction(tr("Properties..."), this)),
|
m_filePropertiesAction(new QAction(tr("Properties..."), this)),
|
||||||
@@ -538,6 +542,17 @@ void EditorManagerPrivate::init()
|
|||||||
FileUtils::showInGraphicalShell(ICore::dialogParent(), fp);
|
FileUtils::showInGraphicalShell(ICore::dialogParent(), fp);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cmd = ActionManager::registerAction(m_showInFileSystemViewAction,
|
||||||
|
Constants::SHOWINFILESYSTEMVIEW,
|
||||||
|
editManagerContext);
|
||||||
|
connect(m_showInFileSystemViewAction, &QAction::triggered, this, [] {
|
||||||
|
if (!EditorManager::currentDocument())
|
||||||
|
return;
|
||||||
|
const FilePath fp = EditorManager::currentDocument()->filePath();
|
||||||
|
if (!fp.isEmpty())
|
||||||
|
FileUtils::showInFileSystemView(fp);
|
||||||
|
});
|
||||||
|
|
||||||
//Save XXX Context Actions
|
//Save XXX Context Actions
|
||||||
connect(m_copyFilePathContextAction, &QAction::triggered,
|
connect(m_copyFilePathContextAction, &QAction::triggered,
|
||||||
this, &EditorManagerPrivate::copyFilePathFromContextMenu);
|
this, &EditorManagerPrivate::copyFilePathFromContextMenu);
|
||||||
@@ -567,6 +582,11 @@ void EditorManagerPrivate::init()
|
|||||||
return;
|
return;
|
||||||
FileUtils::showInGraphicalShell(ICore::dialogParent(), m_contextMenuEntry->fileName());
|
FileUtils::showInGraphicalShell(ICore::dialogParent(), m_contextMenuEntry->fileName());
|
||||||
});
|
});
|
||||||
|
connect(m_showInFileSystemViewContextAction, &QAction::triggered, this, [this] {
|
||||||
|
if (!m_contextMenuEntry || m_contextMenuEntry->fileName().isEmpty())
|
||||||
|
return;
|
||||||
|
FileUtils::showInFileSystemView(m_contextMenuEntry->fileName());
|
||||||
|
});
|
||||||
connect(m_openTerminalAction, &QAction::triggered, this, &EditorManagerPrivate::openTerminal);
|
connect(m_openTerminalAction, &QAction::triggered, this, &EditorManagerPrivate::openTerminal);
|
||||||
connect(m_findInDirectoryAction, &QAction::triggered,
|
connect(m_findInDirectoryAction, &QAction::triggered,
|
||||||
this, &EditorManagerPrivate::findInDirectory);
|
this, &EditorManagerPrivate::findInDirectory);
|
||||||
@@ -2876,10 +2896,12 @@ void EditorManager::addNativeDirAndOpenWithActions(QMenu *contextMenu, DocumentM
|
|||||||
d->m_contextMenuEntry = entry;
|
d->m_contextMenuEntry = entry;
|
||||||
bool enabled = entry && !entry->fileName().isEmpty();
|
bool enabled = entry && !entry->fileName().isEmpty();
|
||||||
d->m_openGraphicalShellContextAction->setEnabled(enabled);
|
d->m_openGraphicalShellContextAction->setEnabled(enabled);
|
||||||
|
d->m_showInFileSystemViewContextAction->setEnabled(enabled);
|
||||||
d->m_openTerminalAction->setEnabled(enabled);
|
d->m_openTerminalAction->setEnabled(enabled);
|
||||||
d->m_findInDirectoryAction->setEnabled(enabled);
|
d->m_findInDirectoryAction->setEnabled(enabled);
|
||||||
d->m_filePropertiesAction->setEnabled(enabled);
|
d->m_filePropertiesAction->setEnabled(enabled);
|
||||||
contextMenu->addAction(d->m_openGraphicalShellContextAction);
|
contextMenu->addAction(d->m_openGraphicalShellContextAction);
|
||||||
|
contextMenu->addAction(d->m_showInFileSystemViewContextAction);
|
||||||
contextMenu->addAction(d->m_openTerminalAction);
|
contextMenu->addAction(d->m_openTerminalAction);
|
||||||
contextMenu->addAction(d->m_findInDirectoryAction);
|
contextMenu->addAction(d->m_findInDirectoryAction);
|
||||||
contextMenu->addAction(d->m_filePropertiesAction);
|
contextMenu->addAction(d->m_filePropertiesAction);
|
||||||
|
@@ -258,6 +258,8 @@ private:
|
|||||||
QAction *m_closeAllEditorsExceptVisibleContextAction;
|
QAction *m_closeAllEditorsExceptVisibleContextAction;
|
||||||
QAction *m_openGraphicalShellAction;
|
QAction *m_openGraphicalShellAction;
|
||||||
QAction *m_openGraphicalShellContextAction;
|
QAction *m_openGraphicalShellContextAction;
|
||||||
|
QAction *m_showInFileSystemViewAction;
|
||||||
|
QAction *m_showInFileSystemViewContextAction;
|
||||||
QAction *m_openTerminalAction;
|
QAction *m_openTerminalAction;
|
||||||
QAction *m_findInDirectoryAction;
|
QAction *m_findInDirectoryAction;
|
||||||
QAction *m_filePropertiesAction = nullptr;
|
QAction *m_filePropertiesAction = nullptr;
|
||||||
|
@@ -27,17 +27,19 @@
|
|||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/documentmanager.h>
|
#include <coreplugin/documentmanager.h>
|
||||||
|
#include <coreplugin/foldernavigationwidget.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/iversioncontrol.h>
|
#include <coreplugin/iversioncontrol.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
|
#include <coreplugin/navigationwidget.h>
|
||||||
#include <coreplugin/vcsmanager.h>
|
#include <coreplugin/vcsmanager.h>
|
||||||
|
#include <utils/commandline.h>
|
||||||
#include <utils/consoleprocess.h>
|
#include <utils/consoleprocess.h>
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/commandline.h>
|
#include <utils/qtcprocess.h>
|
||||||
#include <utils/textfileformat.h>
|
#include <utils/textfileformat.h>
|
||||||
#include <utils/unixutils.h>
|
#include <utils/unixutils.h>
|
||||||
#include <utils/qtcprocess.h>
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -128,6 +130,15 @@ void FileUtils::showInGraphicalShell(QWidget *parent, const FilePath &pathIn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileUtils::showInFileSystemView(const FilePath &path)
|
||||||
|
{
|
||||||
|
QWidget *widget
|
||||||
|
= NavigationWidget::activateSubWidget(FolderNavigationWidgetFactory::instance()->id(),
|
||||||
|
Side::Left);
|
||||||
|
if (auto *navWidget = qobject_cast<FolderNavigationWidget *>(widget))
|
||||||
|
navWidget->syncWithFilePath(path);
|
||||||
|
}
|
||||||
|
|
||||||
void FileUtils::openTerminal(const FilePath &path)
|
void FileUtils::openTerminal(const FilePath &path)
|
||||||
{
|
{
|
||||||
openTerminal(path, Environment::systemEnvironment());
|
openTerminal(path, Environment::systemEnvironment());
|
||||||
|
@@ -43,6 +43,7 @@ struct CORE_EXPORT FileUtils
|
|||||||
{
|
{
|
||||||
// Helpers for common directory browser options.
|
// Helpers for common directory browser options.
|
||||||
static void showInGraphicalShell(QWidget *parent, const Utils::FilePath &path);
|
static void showInGraphicalShell(QWidget *parent, const Utils::FilePath &path);
|
||||||
|
static void showInFileSystemView(const Utils::FilePath &path);
|
||||||
static void openTerminal(const Utils::FilePath &path);
|
static void openTerminal(const Utils::FilePath &path);
|
||||||
static void openTerminal(const Utils::FilePath &path, const Utils::Environment &env);
|
static void openTerminal(const Utils::FilePath &path, const Utils::Environment &env);
|
||||||
static QString msgFindInDirectory();
|
static QString msgFindInDirectory();
|
||||||
|
@@ -3846,11 +3846,7 @@ void ProjectExplorerPluginPrivate::showInFileSystemPane()
|
|||||||
{
|
{
|
||||||
Node *currentNode = ProjectTree::currentNode();
|
Node *currentNode = ProjectTree::currentNode();
|
||||||
QTC_ASSERT(currentNode, return );
|
QTC_ASSERT(currentNode, return );
|
||||||
QWidget *widget
|
Core::FileUtils::showInFileSystemView(currentNode->filePath());
|
||||||
= NavigationWidget::activateSubWidget(FolderNavigationWidgetFactory::instance()->id(),
|
|
||||||
Side::Left);
|
|
||||||
if (auto *navWidget = qobject_cast<FolderNavigationWidget *>(widget))
|
|
||||||
navWidget->syncWithFilePath(currentNode->filePath());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPluginPrivate::openTerminalHere(const EnvironmentGetter &env)
|
void ProjectExplorerPluginPrivate::openTerminalHere(const EnvironmentGetter &env)
|
||||||
|
Reference in New Issue
Block a user