diff --git a/plasmoid/contents/ui/main.qml b/plasmoid/contents/ui/main.qml index 093346f..91ba383 100644 --- a/plasmoid/contents/ui/main.qml +++ b/plasmoid/contents/ui/main.qml @@ -24,6 +24,16 @@ PlasmoidItem { } } + FolderDialog { + id: newSessionFolderDialog + title: "Choose working directory for new session" + currentFolder: dbus.activeCwd ? "file://" + dbus.activeCwd : StandardPaths.writableLocation(StandardPaths.HomeLocation) + onAccepted: { + let path = selectedFolder.toString().replace("file://", "") + dbus.createSession(path) + } + } + // On the desktop (Planar), the widget has plenty of room so Plasma will // automatically use fullRepresentation. In a panel, the available space // is smaller than switchWidth/switchHeight so compactRepresentation is used. @@ -122,7 +132,7 @@ PlasmoidItem { PlasmaComponents.ToolButton { icon.name: "list-add" - onClicked: dbus.createSession("") + onClicked: newSessionFolderDialog.open() PlasmaComponents.ToolTip { text: "New session" } } } diff --git a/plasmoid/plugin/olliedbusclient.cpp b/plasmoid/plugin/olliedbusclient.cpp index 4708f83..fe8b1ea 100644 --- a/plasmoid/plugin/olliedbusclient.cpp +++ b/plasmoid/plugin/olliedbusclient.cpp @@ -304,7 +304,7 @@ void OllieDBusClient::onChatUpdated(const QString &session_id, qlonglong offset, // Append directly from the signal — no need to poll if (offset == m_chatOffset) { m_chatText += new_text; - m_chatOffset += new_text.size(); + m_chatOffset += new_text.toUtf8().size(); emit chatTextChanged(); } else { // Offset mismatch — do a full fetch