kate: add 'Start Session' context action
Available without text selection. Ensures a kate session/agent exists (reuses existing or creates new), sets cwd to the current project directory, and updates the status bar.
This commit is contained in:
parent
05fa829ec1
commit
ab8aa8d719
|
|
@ -374,6 +374,11 @@ void OllieKateView::setupContextMenu(KTextEditor::View *view)
|
|||
connect(reviewDiffAction, &QAction::triggered, this, &OllieKateView::reviewDiff);
|
||||
}
|
||||
|
||||
auto *startAction = menu->addAction(QIcon::fromTheme(QStringLiteral("system-run")),
|
||||
QStringLiteral("Ollie: Start Session"));
|
||||
startAction->setObjectName(QStringLiteral("ollie_ctx_start"));
|
||||
connect(startAction, &QAction::triggered, this, &OllieKateView::startSession);
|
||||
|
||||
if (!v->selection()) return;
|
||||
|
||||
auto *explainAction = menu->addAction(QIcon::fromTheme(QStringLiteral("help-contents")),
|
||||
|
|
@ -539,6 +544,17 @@ void OllieKateView::reviewDiff()
|
|||
m_9p->write(agentPath() + "/prompt", prompt.toUtf8());
|
||||
}
|
||||
|
||||
void OllieKateView::startSession()
|
||||
{
|
||||
ensureAgent();
|
||||
// Update cwd to current project
|
||||
QString baseDir = projectBaseDir();
|
||||
if (!baseDir.isEmpty() && !m_agentId.isEmpty()) {
|
||||
m_9p->write(agentPath() + "/ctl", ("cwd " + baseDir).toUtf8());
|
||||
}
|
||||
updateStatusLabel();
|
||||
}
|
||||
|
||||
// --- Ghost Text ---
|
||||
|
||||
void OllieKateView::setupGhostProvider()
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ private:
|
|||
void submitSelectionPrompt(const QString &action);
|
||||
void sendVerbatim();
|
||||
void reviewDiff();
|
||||
void startSession();
|
||||
|
||||
// Agent management
|
||||
void ensureAgent();
|
||||
|
|
|
|||
Reference in New Issue