Make read markers a bit less confusing
This commit is contained in:
parent
fa67b5b0f8
commit
42b08257ec
@ -20,10 +20,10 @@ ListView {
|
|||||||
spacing: 4
|
spacing: 4
|
||||||
verticalLayoutDirection: ListView.BottomToTop
|
verticalLayoutDirection: ListView.BottomToTop
|
||||||
onCountChanged: {
|
onCountChanged: {
|
||||||
|
// Mark timeline as read
|
||||||
if (atYEnd)
|
if (atYEnd)
|
||||||
model.currentIndex = 0;
|
model.currentIndex = 0;
|
||||||
|
}
|
||||||
} // Mark last event as read, since we are at the bottom
|
|
||||||
|
|
||||||
ScrollHelper {
|
ScrollHelper {
|
||||||
flickable: parent
|
flickable: parent
|
||||||
|
@ -728,12 +728,14 @@ TimelineModel::updateLastMessage()
|
|||||||
void
|
void
|
||||||
TimelineModel::setCurrentIndex(int index)
|
TimelineModel::setCurrentIndex(int index)
|
||||||
{
|
{
|
||||||
|
if (!ChatPage::instance()->isActiveWindow())
|
||||||
|
return;
|
||||||
|
|
||||||
auto oldIndex = idToIndex(currentId);
|
auto oldIndex = idToIndex(currentId);
|
||||||
currentId = indexToId(index);
|
currentId = indexToId(index);
|
||||||
emit currentIndexChanged(index);
|
emit currentIndexChanged(index);
|
||||||
|
|
||||||
if ((oldIndex > index || oldIndex == -1) && !currentId.startsWith("m") &&
|
if ((oldIndex > index || oldIndex == -1) && !currentId.startsWith("m")) {
|
||||||
ChatPage::instance()->isActiveWindow()) {
|
|
||||||
readEvent(currentId.toStdString());
|
readEvent(currentId.toStdString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -896,7 +898,6 @@ TimelineModel::markEventsAsRead(const std::vector<QString> &event_ids)
|
|||||||
read.insert(id);
|
read.insert(id);
|
||||||
int idx = idToIndex(id);
|
int idx = idToIndex(id);
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
nhlog::ui()->warn("Read index out of range");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emit dataChanged(index(idx, 0), index(idx, 0));
|
emit dataChanged(index(idx, 0), index(idx, 0));
|
||||||
|
Loading…
Reference in New Issue
Block a user