Update ChatDocumentHandler so RoomManger is no longer required for saving text

Update `ChatDocumentHandler` so `RoomManger` is no longer required for saving the text in the chatbar between room switches. This is achieved by allowing `ChatDocumentHandler` to get the correct `ChatBarChache` itself rather than having to have it passed from `ChatBar.qml`. This avoids any race conditions.
This commit is contained in:
James Graham
2025-08-02 10:56:20 +01:00
parent 401cf29ca8
commit dc32f2f947
10 changed files with 117 additions and 84 deletions

View File

@@ -422,7 +422,6 @@ QQC2.Control {
QtObject {
id: _private
property ChatBarCache chatBarCache
onChatBarCacheChanged: documentHandler.chatBarCache = chatBarCache
function postMessage() {
_private.chatBarCache.postMessage();
@@ -484,15 +483,14 @@ QQC2.Control {
ChatDocumentHandler {
id: documentHandler
type: ChatBarType.Room
room: root.currentRoom
document: textField.textDocument
cursorPosition: textField.cursorPosition
selectionStart: textField.selectionStart
selectionEnd: textField.selectionEnd
mentionColor: Kirigami.Theme.linkColor
errorColor: Kirigami.Theme.negativeTextColor
Component.onCompleted: {
RoomManager.chatDocumentHandler = documentHandler;
}
}
Component {