forked from qt-creator/qt-creator
Core: Make access to remote terminal easier in code
By re-routing through device hooks. Now basically a FilePath is sufficient as a handle. Change-Id: I0ee43c35096ada12114d50476d5156a6c1de1e70 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -347,19 +347,19 @@ void CorePlugin::addToPathChooserContextMenu(Utils::PathChooser *pathChooser, QM
|
||||
QList<QAction*> actions = menu->actions();
|
||||
QAction *firstAction = actions.isEmpty() ? nullptr : actions.first();
|
||||
|
||||
if (QDir().exists(pathChooser->filePath().toString())) {
|
||||
auto *showInGraphicalShell = new QAction(Core::FileUtils::msgGraphicalShellAction(), menu);
|
||||
if (pathChooser->filePath().exists()) {
|
||||
auto showInGraphicalShell = new QAction(FileUtils::msgGraphicalShellAction(), menu);
|
||||
connect(showInGraphicalShell, &QAction::triggered, pathChooser, [pathChooser] {
|
||||
Core::FileUtils::showInGraphicalShell(pathChooser, pathChooser->filePath());
|
||||
});
|
||||
menu->insertAction(firstAction, showInGraphicalShell);
|
||||
|
||||
auto *showInTerminal = new QAction(Core::FileUtils::msgTerminalHereAction(), menu);
|
||||
auto showInTerminal = new QAction(FileUtils::msgTerminalHereAction(), menu);
|
||||
connect(showInTerminal, &QAction::triggered, pathChooser, [pathChooser] {
|
||||
if (pathChooser->openTerminalHandler())
|
||||
pathChooser->openTerminalHandler()();
|
||||
else
|
||||
FileUtils::openTerminal(pathChooser->filePath());
|
||||
FileUtils::openTerminal(pathChooser->filePath(), {});
|
||||
});
|
||||
menu->insertAction(firstAction, showInTerminal);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user