summary refs log tree commit diff
path: root/src/TimelineView.cc
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-06-05 19:54:45 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-06-05 19:54:45 +0300
commit26dfbfd08ceb913fd91f123935696d253fca2035 (patch)
tree805c2540d4f006db2cb3e1d933ac2c04cf2f1ae4 /src/TimelineView.cc
parentFix scrolling flickering on backwards pagination (diff)
downloadnheko-26dfbfd08ceb913fd91f123935696d253fca2035.tar.xz
Lazy load initial timeline events
Diffstat (limited to 'src/TimelineView.cc')
-rw-r--r--src/TimelineView.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/TimelineView.cc b/src/TimelineView.cc

index 412b9520..418545a6 100644 --- a/src/TimelineView.cc +++ b/src/TimelineView.cc
@@ -76,7 +76,7 @@ void TimelineView::scrollDown() // The first time we enter the room move the scroll bar to the bottom. if (!isInitialized) { - scroll_area_->ensureVisible(0, scroll_widget_->size().height(), 0, 0); + scroll_area_->verticalScrollBar()->setValue(max); isInitialized = true; return; } @@ -226,11 +226,6 @@ int TimelineView::addEvents(const Timeline &timeline) QSettings settings; QString localUser = settings.value("auth/user_id").toString(); - if (isInitialSync) { - prev_batch_token_ = timeline.previousBatch(); - isInitialSync = false; - } - for (const auto &event : timeline.events()) { TimelineItem *item = parseMessageEvent(event.toObject(), TimelineDirection::Bottom); auto sender = event.toObject().value("sender").toString(); @@ -243,6 +238,13 @@ int TimelineView::addEvents(const Timeline &timeline) } } + if (isInitialSync) { + prev_batch_token_ = timeline.previousBatch(); + isInitialSync = false; + + client_->messages(room_id_, prev_batch_token_); + } + return message_count; }