ActionsHandler poperties
Make sure that all low level components get ActionsHandler through actual properties rather than magically
This commit is contained in:
@@ -50,6 +50,14 @@ QQC2.Control {
|
|||||||
|
|
||||||
property NeoChatConnection connection
|
property NeoChatConnection connection
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 list of actions in the ChatBar.
|
* @brief The list of actions in the ChatBar.
|
||||||
*
|
*
|
||||||
@@ -478,7 +486,7 @@ QQC2.Control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function postMessage() {
|
function postMessage() {
|
||||||
actionsHandler.handleMessageEvent(_private.chatBarCache);
|
root.actionsHandler.handleMessageEvent(_private.chatBarCache);
|
||||||
repeatTimer.stop()
|
repeatTimer.stop()
|
||||||
root.currentRoom.markAllMessagesAsRead();
|
root.currentRoom.markAllMessagesAsRead();
|
||||||
textField.clear();
|
textField.clear();
|
||||||
|
|||||||
@@ -38,6 +38,14 @@ ColumnLayout {
|
|||||||
|
|
||||||
required property NeoChatConnection connection
|
required property NeoChatConnection connection
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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 A message has been sent from the chat bar.
|
* @brief A message has been sent from the chat bar.
|
||||||
*/
|
*/
|
||||||
@@ -75,6 +83,7 @@ ColumnLayout {
|
|||||||
Layout.preferredHeight: Math.round(implicitHeight)
|
Layout.preferredHeight: Math.round(implicitHeight)
|
||||||
|
|
||||||
currentRoom: root.currentRoom
|
currentRoom: root.currentRoom
|
||||||
|
actionsHandler: root.actionsHandler
|
||||||
|
|
||||||
FontMetrics {
|
FontMetrics {
|
||||||
id: chatBarFontMetrics
|
id: chatBarFontMetrics
|
||||||
|
|||||||
@@ -18,6 +18,14 @@ QQC2.TextArea {
|
|||||||
_private.chatBarCache.relationIdChanged.connect(_private.updateEditText)
|
_private.chatBarCache.relationIdChanged.connect(_private.updateEditText)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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
|
||||||
|
|
||||||
property string messageId
|
property string messageId
|
||||||
|
|
||||||
property var minimumHeight: editButtons.height + topPadding + bottomPadding
|
property var minimumHeight: editButtons.height + topPadding + bottomPadding
|
||||||
@@ -137,7 +145,7 @@ QQC2.TextArea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function postEdit() {
|
function postEdit() {
|
||||||
actionsHandler.handleMessageEvent(_private.chatBarCache);
|
root.actionsHandler.handleMessageEvent(_private.chatBarCache);
|
||||||
root.clear();
|
root.clear();
|
||||||
_private.chatBarCache.editId = "";
|
_private.chatBarCache.editId = "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,13 @@ Kirigami.Page {
|
|||||||
*/
|
*/
|
||||||
property MediaMessageFilterModel mediaMessageFilterModel: RoomManager.mediaMessageFilterModel
|
property MediaMessageFilterModel mediaMessageFilterModel: RoomManager.mediaMessageFilterModel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The ActionsHandler object to use.
|
||||||
|
*/
|
||||||
|
property ActionsHandler actionsHandler: ActionsHandler {
|
||||||
|
room: root.currentRoom
|
||||||
|
}
|
||||||
|
|
||||||
property bool loading: !root.currentRoom || (root.currentRoom.timelineSize === 0 && !root.currentRoom.allHistoryLoaded)
|
property bool loading: !root.currentRoom || (root.currentRoom.timelineSize === 0 && !root.currentRoom.allHistoryLoaded)
|
||||||
|
|
||||||
/// Disable cancel shortcut. Used by the separate window since it provides its own cancel implementation.
|
/// Disable cancel shortcut. Used by the separate window since it provides its own cancel implementation.
|
||||||
@@ -114,6 +121,7 @@ Kirigami.Page {
|
|||||||
currentRoom: root.currentRoom
|
currentRoom: root.currentRoom
|
||||||
messageEventModel: root.messageEventModel
|
messageEventModel: root.messageEventModel
|
||||||
messageFilterModel: root.messageFilterModel
|
messageFilterModel: root.messageFilterModel
|
||||||
|
actionsHandler: root.actionsHandler
|
||||||
onFocusChatBox: {
|
onFocusChatBox: {
|
||||||
if (chatBoxLoader.item) {
|
if (chatBoxLoader.item) {
|
||||||
chatBoxLoader.item.forceActiveFocus()
|
chatBoxLoader.item.forceActiveFocus()
|
||||||
@@ -155,6 +163,7 @@ Kirigami.Page {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
currentRoom: root.currentRoom
|
currentRoom: root.currentRoom
|
||||||
connection: root.connection
|
connection: root.connection
|
||||||
|
actionsHandler: root.actionsHandler
|
||||||
onMessageSent: {
|
onMessageSent: {
|
||||||
if (!timelineViewLoader.item.atYEnd) {
|
if (!timelineViewLoader.item.atYEnd) {
|
||||||
timelineViewLoader.item.goToLastMessage();
|
timelineViewLoader.item.goToLastMessage();
|
||||||
@@ -180,11 +189,6 @@ Kirigami.Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionsHandler {
|
|
||||||
id: actionsHandler
|
|
||||||
room: root.currentRoom
|
|
||||||
}
|
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequence: StandardKey.Cancel
|
sequence: StandardKey.Cancel
|
||||||
onActivated: {
|
onActivated: {
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ MessageDelegate {
|
|||||||
active: visible
|
active: visible
|
||||||
sourceComponent: MessageEditComponent {
|
sourceComponent: MessageEditComponent {
|
||||||
room: currentRoom
|
room: currentRoom
|
||||||
|
actionsHandler: root.ListView.view.actionsHandler
|
||||||
messageId: root.eventId
|
messageId: root.eventId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,14 @@ QQC2.ScrollView {
|
|||||||
*/
|
*/
|
||||||
required property MessageFilterModel messageFilterModel
|
required property MessageFilterModel messageFilterModel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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
|
||||||
|
|
||||||
readonly property bool atYEnd: messageListView.atYEnd
|
readonly property bool atYEnd: messageListView.atYEnd
|
||||||
|
|
||||||
/// Used to determine if scrolling to the bottom should mark the message as unread
|
/// Used to determine if scrolling to the bottom should mark the message as unread
|
||||||
@@ -52,6 +60,8 @@ QQC2.ScrollView {
|
|||||||
id: messageListView
|
id: messageListView
|
||||||
// So that delegates can access the current room properly.
|
// So that delegates can access the current room properly.
|
||||||
readonly property NeoChatRoom currentRoom: root.currentRoom
|
readonly property NeoChatRoom currentRoom: root.currentRoom
|
||||||
|
// So that delegates can access the actionsHandler properly.
|
||||||
|
readonly property ActionsHandler actionsHandler: root.actionsHandler
|
||||||
|
|
||||||
readonly property int largestVisibleIndex: count > 0 ? indexAt(contentX + (width / 2), contentY + height - 1) : -1
|
readonly property int largestVisibleIndex: count > 0 ? indexAt(contentX + (width / 2), contentY + height - 1) : -1
|
||||||
readonly property var sectionBannerItem: contentHeight >= height ? itemAtIndex(sectionBannerIndex()) : undefined
|
readonly property var sectionBannerItem: contentHeight >= height ? itemAtIndex(sectionBannerIndex()) : undefined
|
||||||
|
|||||||
Reference in New Issue
Block a user