Don't load backlog until read marker
This is bad if there are a lot of unread messages
This commit is contained in:
@@ -64,21 +64,6 @@ MessageEventModel::MessageEventModel(QObject *parent)
|
|||||||
qmlRegisterAnonymousType<FileTransferInfo>("org.kde.neochat", 1);
|
qmlRegisterAnonymousType<FileTransferInfo>("org.kde.neochat", 1);
|
||||||
qRegisterMetaType<FileTransferInfo>();
|
qRegisterMetaType<FileTransferInfo>();
|
||||||
|
|
||||||
QTimer::singleShot(0, this, [this]() {
|
|
||||||
if (!m_currentRoom) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_currentRoom->getPreviousContent(50);
|
|
||||||
connect(this, &QAbstractListModel::rowsInserted, this, [this]() {
|
|
||||||
if (m_currentRoom->readMarkerEventId().isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const auto it = m_currentRoom->findInTimeline(m_currentRoom->readMarkerEventId());
|
|
||||||
if (it == m_currentRoom->historyEdge()) {
|
|
||||||
m_currentRoom->getPreviousContent(50);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
connect(static_cast<QGuiApplication *>(QGuiApplication::instance()), &QGuiApplication::paletteChanged, this, [this] {
|
connect(static_cast<QGuiApplication *>(QGuiApplication::instance()), &QGuiApplication::paletteChanged, this, [this] {
|
||||||
Q_EMIT dataChanged(index(0, 0), index(rowCount() - 1, 0), {AuthorRole, ReplyRole});
|
Q_EMIT dataChanged(index(0, 0), index(rowCount() - 1, 0), {AuthorRole, ReplyRole});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user