summaryrefslogtreecommitdiff
path: root/topicmodel.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-04-04 23:37:52 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-04-04 23:37:52 +0200
commit37139c96f04f781b053feefdbb5b3d28b2bcfc11 (patch)
treec6a5bd9557a0442e6b5ad6fa3bae86803339cf32 /topicmodel.cpp
parent3f3a98b7e49230aabd0e557ea59e89e20537ca8a (diff)
downloadtapasboard-37139c96f04f781b053feefdbb5b3d28b2bcfc11.tar.gz
tapasboard-37139c96f04f781b053feefdbb5b3d28b2bcfc11.zip
fix timezones on real device
Diffstat (limited to 'topicmodel.cpp')
-rw-r--r--topicmodel.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/topicmodel.cpp b/topicmodel.cpp
index d3032be..653934a 100644
--- a/topicmodel.cpp
+++ b/topicmodel.cpp
@@ -105,6 +105,8 @@ QVariant TopicModel::data(const QModelIndex &index, int role) const
case HumanDateRole:
case HumanTimeRole:
return QVariant::fromValue(QString());
+ case IconRole:
+ return QVariant::fromValue(QUrl());
case DateTimeRole:
return QVariant::fromValue(QDateTime());
case UnreadRole:
@@ -119,6 +121,8 @@ QVariant TopicModel::data(const QModelIndex &index, int role) const
return _data[row].title;
case ContentRole:
return _data[row].content;
+ case IconRole:
+ return _data[row].icon;
case PostIdRole:
return _data[row].post_id;
case UserIdRole:
@@ -130,7 +134,7 @@ QVariant TopicModel::data(const QModelIndex &index, int role) const
case HumanDateRole:
return _board->renderHumanDate(_data[row].time);
case HumanTimeRole:
- return _board->renderHumanTime(_data[row].time);
+ return _board->renderHumanDateTime(_data[row].time);
case UnreadRole:
return _firstUnread >= 0 && row >= _firstUnread;
}
@@ -168,7 +172,7 @@ void TopicModel::fetchMore(const QModelIndex &parent)
if (!posts.empty()) {
QDateTime last = oldestPostUpdate(posts);
// If the posts we got from DB are too old, refresh online.
- if (last.secsTo(QDateTime::currentDateTime()) > TOPIC_POSTS_TLL) {
+ if (last.secsTo(QDateTime::currentDateTimeUtc()) > TOPIC_POSTS_TLL) {
qDebug() << "Fetching posts because of old";
Q_ASSERT(new_end > 0);
_board->enqueueAction(new FetchPostsAction(_topicId,
@@ -211,7 +215,7 @@ QDateTime TopicModel::parseDbDateTime(const QVariant &v)
QDateTime TopicModel::oldestPostUpdate(const QList<Post> &posts)
{
- if (posts.empty()) return QDateTime::currentDateTime();
+ if (posts.empty()) return QDateTime::currentDateTimeUtc();
QDateTime min = posts.first().last_update_time;
foreach (const Post& post, posts) {
if (min < post.last_update_time) min = post.last_update_time;
@@ -374,7 +378,7 @@ void TopicModel::update()
if (!_board->service()->isAccessible()) return;
QDateTime last = lastTopPostUpdate();
if (!last.isValid() ||
- last.secsTo(QDateTime::currentDateTime()) > TOPIC_TOP_TLL) {
+ last.secsTo(QDateTime::currentDateTimeUtc()) > TOPIC_TOP_TLL) {
qDebug() << "Fetching posts because the top are old";
// Outdated or empty, refresh.
if (_board->loggedIn() && _board->getConfig("goto_unread") == "1") {