Rework ActionsHandler

Rework ActionsHandler as static helper functions.

The functions are now invoked from ChatBarCache so there is no need to pass an actions handler object around qml simplifying the code.
This commit is contained in:
James Graham
2024-10-05 13:44:53 +00:00
parent ac9bfbff78
commit 4bd4bd6f22
12 changed files with 73 additions and 164 deletions

View File

@@ -51,14 +51,6 @@ QQC2.Control {
*/
required property var contentModel
/**
* @brief The ActionsHandler object to use.
*
* This is expected to have the correct room set otherwise messages will be sent
* to the wrong room.
*/
property ActionsHandler actionsHandler
/**
* @brief Whether the bubble background should be shown.
*/
@@ -107,7 +99,6 @@ QQC2.Control {
delegate: MessageComponentChooser {
room: root.room
index: root.index
actionsHandler: root.actionsHandler
timeline: root.timeline
maxContentWidth: root.maxContentWidth

View File

@@ -27,14 +27,6 @@ QQC2.TextArea {
required property ChatBarCache chatBarCache
onChatBarCacheChanged: documentHandler.chatBarCache = chatBarCache
/**
* @brief The ActionsHandler object to use.
*
* This is expected to have the correct room set otherwise messages will be sent
* to the wrong room.
*/
required property ActionsHandler actionsHandler
/**
* @brief The maximum width that the bubble's content can be.
*/
@@ -177,7 +169,7 @@ QQC2.TextArea {
}
function post() {
root.actionsHandler.handleMessageEvent(root.chatBarCache);
root.chatBarCache.postMessage();
root.clear();
root.chatBarCache.clearRelations();
}

View File

@@ -22,14 +22,6 @@ DelegateChooser {
*/
required property var index
/**
* @brief The ActionsHandler object to use.
*
* This is expected to have the correct room set otherwise messages will be sent
* to the wrong room.
*/
required property ActionsHandler actionsHandler
/**
* @brief The timeline ListView this component is being used in.
*/
@@ -208,7 +200,6 @@ DelegateChooser {
roleValue: MessageComponentType.ChatBar
delegate: ChatBarComponent {
room: root.room
actionsHandler: root.actionsHandler
maxContentWidth: root.maxContentWidth
}
}

View File

@@ -295,7 +295,6 @@ TimelineDelegate {
} else {
return root.contentModel;
}
actionsHandler: root.ListView.view?.actionsHandler ?? null
timeline: root.ListView.view
showHighlight: root.showHighlight