summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCătălin Badea <catalin.badea392@gmail.com>2012-08-10 14:03:43 (GMT)
committerCătălin Badea <catalin.badea392@gmail.com>2012-08-11 15:59:13 (GMT)
commit5fc90dc3d7962bde27dc80b7a9722f6423213478 (patch)
tree5d4d41e9a69a19c9dbcc9ed7163792ee7baa977c
parent2b8f9e07d0aa0c119c6c2abf97c703008b213830 (diff)
downloadswift-contrib-5fc90dc3d7962bde27dc80b7a9722f6423213478.zip
swift-contrib-5fc90dc3d7962bde27dc80b7a9722f6423213478.tar.bz2
Fix scrolling to next day.
-rw-r--r--Swift/QtUI/QtHistoryWindow.cpp14
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));
}