diff options
author | Cătălin Badea <catalin.badea392@gmail.com> | 2012-08-10 14:03:43 (GMT) |
---|---|---|
committer | Cătălin Badea <catalin.badea392@gmail.com> | 2012-08-10 14:03:43 (GMT) |
commit | e8c8e82f7113893bcb09a10397644c846b820b57 (patch) | |
tree | c271a6ab4deb90472a2fcfcc47c8cc23b0148b75 | |
parent | 80f2cbf4d3f805cf4464a51ccd20fb647a49ff50 (diff) | |
download | swift-contrib-e8c8e82f7113893bcb09a10397644c846b820b57.zip swift-contrib-e8c8e82f7113893bcb09a10397644c846b820b57.tar.bz2 |
Fix scrolling to next day.catalinb/history
-rw-r--r-- | Swift/QtUI/QtHistoryWindow.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
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)); } |