mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Merge pull request #1532 from Nheko-Reborn/issue1512
Add mark room as read option
This commit is contained in:
commit
b2b8945f22
3 changed files with 22 additions and 2 deletions
|
@ -726,6 +726,11 @@ Page {
|
||||||
destroyOnClose(roomWindow);
|
destroyOnClose(roomWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Platform.MenuItem {
|
||||||
|
text: qsTr("Mark as read")
|
||||||
|
onTriggered: Rooms.getRoomById(roomContextMenu.roomid).markRoomAsRead()
|
||||||
|
}
|
||||||
|
|
||||||
Platform.MenuItem {
|
Platform.MenuItem {
|
||||||
text: qsTr("Room settings")
|
text: qsTr("Room settings")
|
||||||
|
|
||||||
|
|
|
@ -1283,14 +1283,21 @@ TimelineModel::updateLastMessage()
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineModel::setCurrentIndex(int index)
|
TimelineModel::setCurrentIndex(int index)
|
||||||
|
{
|
||||||
|
setCurrentIndex(index, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimelineModel::setCurrentIndex(int index, bool ignoreInactiveState)
|
||||||
{
|
{
|
||||||
auto oldIndex = idToIndex(currentId);
|
auto oldIndex = idToIndex(currentId);
|
||||||
currentId = indexToId(index);
|
currentId = indexToId(index);
|
||||||
if (index != oldIndex)
|
if (index != oldIndex)
|
||||||
emit currentIndexChanged(index);
|
emit currentIndexChanged(index);
|
||||||
|
|
||||||
if (!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->isActive() ||
|
if (!ignoreInactiveState &&
|
||||||
MainWindow::instance()->windowForRoom(roomId()) != QGuiApplication::focusWindow())
|
(!QGuiApplication::focusWindow() || !QGuiApplication::focusWindow()->isActive() ||
|
||||||
|
MainWindow::instance()->windowForRoom(roomId()) != QGuiApplication::focusWindow()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!currentId.startsWith('m')) {
|
if (!currentId.startsWith('m')) {
|
||||||
|
@ -1561,6 +1568,12 @@ TimelineModel::markEventsAsRead(const std::vector<QString> &event_ids)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimelineModel::markRoomAsRead()
|
||||||
|
{
|
||||||
|
setCurrentIndex(0, true);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineModel::updateLastReadId(const QString ¤tRoomId)
|
TimelineModel::updateLastReadId(const QString ¤tRoomId)
|
||||||
{
|
{
|
||||||
|
|
|
@ -386,9 +386,11 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setCurrentIndex(int index);
|
void setCurrentIndex(int index);
|
||||||
|
void setCurrentIndex(int index, bool ignoreInactiveState);
|
||||||
int currentIndex() const { return idToIndex(currentId); }
|
int currentIndex() const { return idToIndex(currentId); }
|
||||||
void eventShown();
|
void eventShown();
|
||||||
void markEventsAsRead(const std::vector<QString> &event_ids);
|
void markEventsAsRead(const std::vector<QString> &event_ids);
|
||||||
|
void markRoomAsRead();
|
||||||
void updateLastReadId(const QString ¤tRoomId);
|
void updateLastReadId(const QString ¤tRoomId);
|
||||||
void lastReadIdOnWindowFocus();
|
void lastReadIdOnWindowFocus();
|
||||||
void checkAfterFetch();
|
void checkAfterFetch();
|
||||||
|
|
Loading…
Reference in a new issue