plasmoid: folder picker for new sessions, fix chat offset encoding
- New session button opens a FolderDialog to choose the working directory before creating the session. - Fix chat truncation: use toUtf8().size() for offset tracking to match the server byte-based offsets. QString::size() (UTF-16 code units) caused drift on non-ASCII characters, leading to stalled output.
This commit is contained in:
parent
327030293b
commit
3b42c9ee25
|
|
@ -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
|
// On the desktop (Planar), the widget has plenty of room so Plasma will
|
||||||
// automatically use fullRepresentation. In a panel, the available space
|
// automatically use fullRepresentation. In a panel, the available space
|
||||||
// is smaller than switchWidth/switchHeight so compactRepresentation is used.
|
// is smaller than switchWidth/switchHeight so compactRepresentation is used.
|
||||||
|
|
@ -122,7 +132,7 @@ PlasmoidItem {
|
||||||
|
|
||||||
PlasmaComponents.ToolButton {
|
PlasmaComponents.ToolButton {
|
||||||
icon.name: "list-add"
|
icon.name: "list-add"
|
||||||
onClicked: dbus.createSession("")
|
onClicked: newSessionFolderDialog.open()
|
||||||
PlasmaComponents.ToolTip { text: "New session" }
|
PlasmaComponents.ToolTip { text: "New session" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -304,7 +304,7 @@ void OllieDBusClient::onChatUpdated(const QString &session_id, qlonglong offset,
|
||||||
// Append directly from the signal — no need to poll
|
// Append directly from the signal — no need to poll
|
||||||
if (offset == m_chatOffset) {
|
if (offset == m_chatOffset) {
|
||||||
m_chatText += new_text;
|
m_chatText += new_text;
|
||||||
m_chatOffset += new_text.size();
|
m_chatOffset += new_text.toUtf8().size();
|
||||||
emit chatTextChanged();
|
emit chatTextChanged();
|
||||||
} else {
|
} else {
|
||||||
// Offset mismatch — do a full fetch
|
// Offset mismatch — do a full fetch
|
||||||
|
|
|
||||||
Reference in New Issue