mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
parent
284d200361
commit
0a09ce0f75
2 changed files with 17 additions and 0 deletions
|
@ -154,8 +154,11 @@ private:
|
|||
TimelineEvent findFirstViewableEvent(const std::vector<TimelineEvent> &events);
|
||||
TimelineEvent findLastViewableEvent(const std::vector<TimelineEvent> &events);
|
||||
|
||||
//! Mark the last event as read.
|
||||
void readLastEvent() const;
|
||||
//! Whether or not the scrollbar is visible (non-zero height).
|
||||
bool isScrollbarActivated() { return scroll_area_->verticalScrollBar()->value() != 0; }
|
||||
//! Retrieve the event id of the last item.
|
||||
QString getLastEventId() const;
|
||||
QString getEventSender(const mtx::events::collections::TimelineEvents &event) const;
|
||||
mtx::events::EventType getEventType(
|
||||
|
|
|
@ -753,6 +753,20 @@ TimelineView::removeEvent(const QString &event_id)
|
|||
prevLabel->deleteLater();
|
||||
}
|
||||
|
||||
// If we deleted the last item in the timeline...
|
||||
if (!nextItem && prevItem)
|
||||
lastSender_ = prevItem->descriptionMessage().userid;
|
||||
|
||||
// If we deleted the first item in the timeline...
|
||||
if (!prevItem && nextItem)
|
||||
firstSender_ = nextItem->descriptionMessage().userid;
|
||||
|
||||
// If we deleted the only item in the timeline...
|
||||
if (!prevItem && !nextItem) {
|
||||
firstSender_.clear();
|
||||
lastSender_.clear();
|
||||
}
|
||||
|
||||
// Finally remove the event.
|
||||
removedItem->deleteLater();
|
||||
eventIds_.remove(event_id);
|
||||
|
|
Loading…
Reference in a new issue