Allow the condition for when messages are automatically marked as read to be configurable.
Title this adds a number of options for when messages should be automatically marked as read for the user to choose from.
{width=480 height=262}
This commit is contained in:
@@ -35,6 +35,11 @@ QQC2.ScrollView {
|
||||
*/
|
||||
property bool fileDropEnabled: true
|
||||
|
||||
/**
|
||||
* @brief The TimelineMarkReadCondition to use for when messages should be marked as read automatically.
|
||||
*/
|
||||
required property int markReadCondition
|
||||
|
||||
/**
|
||||
* @brief Shift the view to the given event ID.
|
||||
*/
|
||||
@@ -54,7 +59,6 @@ QQC2.ScrollView {
|
||||
* All messages will be marked as read.
|
||||
*/
|
||||
function goToLastMessage() {
|
||||
_private.room.markAllMessagesAsRead();
|
||||
messageListView.positionViewAtBeginning();
|
||||
}
|
||||
|
||||
@@ -154,8 +158,8 @@ QQC2.ScrollView {
|
||||
}
|
||||
|
||||
function onReadMarkerAdded() {
|
||||
if (messageListView.allUnreadVisible()) {
|
||||
_private.room.markAllMessagesAsRead();
|
||||
if (root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.EntryVisible && messageListView.allUnreadVisible()) {
|
||||
root.room.markAllMessagesAsRead();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,6 +167,20 @@ QQC2.ScrollView {
|
||||
messageListView.positionViewAtBeginning();
|
||||
_private.room.markAllMessagesAsRead();
|
||||
}
|
||||
|
||||
function onRoomAboutToChange(oldRoom, newRoom) {
|
||||
if (root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.Exit ||
|
||||
(root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.ExitVisible && messageListView.allUnreadVisible())
|
||||
) {
|
||||
oldRoom.markAllMessagesAsRead();
|
||||
}
|
||||
}
|
||||
|
||||
function onRoomChanged(oldRoom, newRoom) {
|
||||
if (root.markReadCondition == LibNeoChat.TimelineMarkReadCondition.Entry) {
|
||||
newRoom.markAllMessagesAsRead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onAtYEndChanged: if (atYEnd && _private.hasScrolledUpBefore) {
|
||||
|
||||
Reference in New Issue
Block a user