summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-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));
}