gui/plasmoid: show error dialog on CreateSession failure

Adds errorOccurred signal to OllieDBusClient, emitted when
CreateSession (or other async calls) fail. GUI shows a modal
dialog; plasmoid shows a passive notification.
This commit is contained in:
Levi Neely 2026-07-21 15:20:55 +02:00
parent 1afedfca7d
commit 10e39abc8e
4 changed files with 37 additions and 3 deletions

View File

@ -549,6 +549,24 @@ ApplicationWindow {
mainContent.panes[idx].sessionId = dbus.activeSessionId
}
}
function onErrorOccurred(message) {
errorDialog.text = message
errorDialog.open()
}
}
Dialog {
id: errorDialog
title: "Error"
modal: true
anchors.centerIn: parent
standardButtons: Dialog.Ok
property alias text: errorLabel.text
Label {
id: errorLabel
wrapMode: Text.Wrap
width: parent.width
}
}
// --- Process Manager Window ---

View File

@ -14,6 +14,13 @@ PlasmoidItem {
// Convenience alias
readonly property var dbus: Ollie.OllieDBusClient
Connections {
target: dbus
function onErrorOccurred(message) {
root.Plasmoid.showPassiveNotification(message, 5000, "Error")
}
}
FolderDialog {
id: folderDialog
title: "Choose working directory"

View File

@ -270,9 +270,17 @@ void OllieDBusClient::onFetchConfigFinished(QDBusPendingCallWatcher *watcher)
QString OllieDBusClient::createSession(const QString &cwd)
{
QString dir = cwd.isEmpty() ? QDir::homePath() : cwd;
// Use asyncCall — we'll pick up the new session via the SessionCreated signal
m_iface->asyncCall("CreateSession", dir, QString(), QString(), QString("default"), QString());
return QString(); // ID not available synchronously; signal will trigger refresh
auto *watcher = new QDBusPendingCallWatcher(
m_iface->asyncCall("CreateSession", dir, QString(), QString(), QString("default"), QString()),
this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *w) {
QDBusPendingReply<QString> reply = *w;
if (reply.isError()) {
emit errorOccurred(reply.error().message());
}
w->deleteLater();
});
return QString();
}
void OllieDBusClient::createSessionWithDialog()

View File

@ -74,6 +74,7 @@ signals:
void chatAppended(const QString &sessionId, int offset, const QString &text);
void processDetached(const QString &sessionId);
void processExited(const QString &sessionId, int pid, int exitCode);
void errorOccurred(const QString &message);
private slots:
void onSessionCreated(const QString &session_id);