From e8c8e82f7113893bcb09a10397644c846b820b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C4=83t=C4=83lin=20Badea?= Date: Fri, 10 Aug 2012 17:03:43 +0300 Subject: Fix scrolling to next day. diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp index 932922e..e54bd51 100644 --- a/Swift/QtUI/QtHistoryWindow.cpp +++ b/Swift/QtUI/QtHistoryWindow.cpp @@ -176,14 +176,24 @@ void QtHistoryWindow::handleScrollRequested(int pos) { } void QtHistoryWindow::handleScrollReachedTop() { + if (dates_.empty()) { + return; + } + int year, month, day; - ui_.calendarWidget_->selectedDate().getDate(&year, &month, &day); + QDate firstDate = *dates_.begin(); + firstDate.getDate(&year, &month, &day); onScrollReachedTop(boost::gregorian::date(year, month, day)); } void QtHistoryWindow::handleScrollReachedBottom() { + if (dates_.empty()) { + return; + } + int year, month, day; - ui_.calendarWidget_->selectedDate().getDate(&year, &month, &day); + QDate lastDate = *dates_.rbegin(); + lastDate.getDate(&year, &month, &day); onScrollReachedBottom(boost::gregorian::date(year, month, day)); } -- cgit v0.10.2-6-g49f6