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:
hjk
2023-01-18 14:23:23 +01:00
parent 128b21c959
commit 6c8afcde88
7 changed files with 81 additions and 78 deletions

View File

@@ -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);