gui: add 'Open Workdir' context menu for sessions and agents

- Add openDirectory() method using QDesktopServices::openUrl
- Session context menu: opens session cwd
- Agent context menu: opens agent's effective cwd
This commit is contained in:
Levi Neely 2026-10-08 13:38:29 +02:00
parent af21dfa770
commit 491f5ff2ae
3 changed files with 26 additions and 0 deletions

View File

@ -160,6 +160,15 @@ Item {
tree.sessionSettingsRequested(tree.killTargetSessionName)
}
}
MenuItem {
text: "Open Workdir"
onClicked: {
if (tree.killTargetSessionName) {
var cfg = ollie.readSessionConfig(tree.killTargetSessionName)
if (cfg.cwd) ollie.openDirectory(cfg.cwd)
}
}
}
MenuItem {
text: "New Agent..."
onClicked: {
@ -196,6 +205,15 @@ Item {
tree.agentSettingsRequested(tree.killTargetAgentSessionId, tree.killTargetAgentId)
}
}
MenuItem {
text: "Open Workdir"
onClicked: {
if (tree.killTargetAgentSessionId && tree.killTargetAgentId) {
var cfg = ollie.readAgentConfig(tree.killTargetAgentSessionId, tree.killTargetAgentId)
if (cfg.cwd) ollie.openDirectory(cfg.cwd)
}
}
}
MenuItem {
text: "Kill"
onClicked: {

View File

@ -1,6 +1,7 @@
#include "ollie9pclient.h"
#include "lib9pstreamer.h"
#include <QDesktopServices>
#include <QDir>
#include <QSet>
#include <QStandardPaths>
@ -964,6 +965,12 @@ QString Ollie9pClient::procOutput(const QString &sessionId, const QString &agent
return QString::fromUtf8(out);
}
void Ollie9pClient::openDirectory(const QString &path)
{
if (path.isEmpty()) return;
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
}
// --- Root data loading (lazy) ---
void Ollie9pClient::ensureRootDataLoaded()

View File

@ -100,6 +100,7 @@ public:
Q_INVOKABLE bool procTerm(const QString &sessionId, const QString &agentId, int pid);
Q_INVOKABLE bool procKill(const QString &sessionId, const QString &agentId, int pid);
Q_INVOKABLE QString procOutput(const QString &sessionId, const QString &agentId, int pid);
Q_INVOKABLE void openDirectory(const QString &path);
Q_INVOKABLE QString lastError() const { return m_9p ? m_9p->lastError() : QString(); }
signals: