fix(PinnedMessagesPopup): “Jump to” button doesn’t work pinned messages popup

This was never implemented, eventhough a similar approach is used with
the global AppSearch. Expose the method `scrollToMessage(messageId)` so
that it can be called from QML directly.

Fixes #7375
This commit is contained in:
Lukáš Tinkl 2022-09-19 10:40:02 +02:00 committed by Lukáš Tinkl
parent 8a9a23a89e
commit 9addf1221b
6 changed files with 14 additions and 7 deletions

View File

@ -165,4 +165,7 @@ QtObject:
proc refreshAMessageUserRespondedTo(self: View, msgId: string) {.signal.}
proc emitRefreshAMessageUserRespondedToSignal*(self: View, msgId: string) =
self.refreshAMessageUserRespondedTo(msgId)
self.refreshAMessageUserRespondedTo(msgId)
proc jumpToMessage*(self: View, messageId: string) {.slot.} =
self.delegate.scrollToMessage(messageId)

View File

@ -15,6 +15,7 @@ StatusDialog {
property var store
property var messageStore
property var messagesModule
property var pinnedMessagesModel //this doesn't belong to the messageStore, it is a part of the ChatContentStore, but we didn't introduce it yet.
property string messageToPin
property string messageToUnpin
@ -150,6 +151,10 @@ StatusDialog {
onOpenProfileClicked: {
Global.openProfilePopup(publicKey, null, state)
}
onJumpToMessage: {
root.messagesModule.jumpToMessage(messageId);
}
}
}

View File

@ -95,6 +95,7 @@ ColumnLayout {
Global.openPopup(Global.pinnedMessagesPopup, {
store: rootStore,
messageStore: messageStore,
messagesModule: chatContentModule.messagesModule,
pinnedMessagesModel: chatContentModule.pinnedMessagesModel,
messageToPin: messageId
})

View File

@ -291,12 +291,13 @@ RowLayout {
onPinnedMessagesCountClicked: {
if(!chatContentModule) {
console.debug("error on open pinned messages - chat content module is not set")
console.warn("error on open pinned messages - chat content module is not set")
return
}
Global.openPopup(Global.pinnedMessagesPopup, {
store: rootStore,
messageStore: root.rootStore.messageStore,
messagesModule: chatContentModule.messagesModule,
pinnedMessagesModel: chatContentModule.pinnedMessagesModel,
messageToPin: ""
})

View File

@ -7,6 +7,7 @@ import QtGraphicalEffects 1.13
import QtQuick.Dialogs 1.3
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Components 0.1
@ -19,11 +20,6 @@ import shared.status 1.0
import shared.controls 1.0
import shared.views.chat 1.0
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import "../controls"
Item {

View File

@ -744,6 +744,7 @@ Loader {
Global.openPopup(Global.pinnedMessagesPopup, {
store: root.rootStore,
messageStore: messageStore,
messagesModule: chatContentModule.messagesModule,
pinnedMessagesModel: chatContentModule.pinnedMessagesModel,
messageToPin: root.messageId
});