diff options
-rw-r--r-- | board.cpp | 1 | ||||
-rw-r--r-- | fetchtopicsaction.cpp | 14 | ||||
-rw-r--r-- | forummodel.cpp | 8 | ||||
-rw-r--r-- | global.h | 2 | ||||
-rw-r--r-- | topicmodel.cpp | 4 |
5 files changed, 16 insertions, 13 deletions
@@ -603,6 +603,7 @@ void Board::initializeSmilies() _smilies[":O"] = "image://theme/icon-s-messaging-smiley-surprised"; _smilies["O_O"] = "image://theme/icon-s-messaging-smiley-surprised"; _smilies["O_o"] = "image://theme/icon-s-messaging-smiley-surprised"; + _smilies[":shock:"] = "image://theme/icon-s-messaging-smiley-surprised"; _smilies[":evil:"] = "image://theme/icon-s-messaging-smiley-evil"; // Let's construct a single regular expression that will cover all smilies diff --git a/fetchtopicsaction.cpp b/fetchtopicsaction.cpp index d8ea173..4617280 100644 --- a/fetchtopicsaction.cpp +++ b/fetchtopicsaction.cpp @@ -1,4 +1,5 @@ #include <QtCore/QDateTime> +#include <QtCore/QSet> #include <QtCore/QDebug> #include <QtSql/QSqlDatabase> #include <QtSql/QSqlQuery> @@ -43,7 +44,7 @@ void FetchTopicsAction::execute() int end = _end; if (end == FetchAllTopics) { // Fetch topics in blocks of size 50. - end = _start + MAX_FORUM_PAGE_SIZE; + end = _start + MAX_FORUM_PAGE_SIZE - 1; // After finishing this action, a new one will be enqueued with the next 50. } @@ -63,9 +64,9 @@ void FetchTopicsAction::handleFinishedCall() db.transaction(); const int total_topic_num = map["total_topic_num"].toInt(); - int expected_end = _end == FetchAllTopics ? _start + MAX_FORUM_PAGE_SIZE : _end; - QList<int> current_topics = getCurrentDbTopics(_start, expected_end); - QList<int> unchanged_topics = current_topics; + int expected_end = _end == FetchAllTopics ? _start + MAX_FORUM_PAGE_SIZE - 1 : _end; + QSet<int> current_topics = QSet<int>::fromList(getCurrentDbTopics(_start, expected_end)); + QSet<int> unchanged_topics = current_topics; if (_start >= total_topic_num) { // Workaround an issue where the service always returns one post. @@ -119,12 +120,9 @@ void FetchTopicsAction::handleFinishedCall() goto finish; } - unchanged_topics.removeOne(topic_id); + unchanged_topics.remove(topic_id); } - // "position" would now point to "_end + 1", if we had gotten as - // many topics as we requested. - int fetched_end = position - 1; bool eof = fetched_end < expected_end; if (eof) { diff --git a/forummodel.cpp b/forummodel.cpp index 7408f32..ea54f8e 100644 --- a/forummodel.cpp +++ b/forummodel.cpp @@ -158,7 +158,9 @@ void ForumModel::refresh() QDateTime ForumModel::parseDateTime(const QVariant &v) { QString s = v.toString(); - return QDateTime::fromString(s, Qt::ISODate); + QDateTime dt = QDateTime::fromString(s, Qt::ISODate); + dt.setTimeSpec(Qt::UTC); + return dt; } QDateTime ForumModel::oldestPostUpdate(const QList<Topic> &topics) @@ -282,10 +284,10 @@ void ForumModel::handleForumTopicsChanged(int forumId, int start, int end) void ForumModel::handleForumTopicChanged(int forumId, int topicId) { - if (forumId == _forumId) {qDebug() << "Me topic cha"; + if (forumId == _forumId) { for (int i = 0; i < _data.size(); i++) { Topic& topic = _data[i]; - if (topic.topic_id == topicId) {qDebug() << "Me topic cha cha"; + if (topic.topic_id == topicId) { // Need to refresh this topic QList<Topic> topics = loadTopics(i, i); if (topics.size() == 1) { @@ -10,7 +10,7 @@ #define BOARD_LIST_TTL 2 /** Time we should consider the most recent topics in a forum up to date, in seconds. */ -#define FORUM_TOP_TLL 5 * 60 +#define FORUM_TOP_TLL 15 * 60 /** Time we should consider other topics in a forum up to date, in seconds. */ #define FORUM_TOPICS_TLL 15 * 60 diff --git a/topicmodel.cpp b/topicmodel.cpp index c7932aa..4188784 100644 --- a/topicmodel.cpp +++ b/topicmodel.cpp @@ -210,7 +210,9 @@ void TopicModel::markAsRead() QDateTime TopicModel::parseDbDateTime(const QVariant &v) { QString s = v.toString(); - return QDateTime::fromString(s, Qt::ISODate); + QDateTime dt = QDateTime::fromString(s, Qt::ISODate); + dt.setTimeSpec(Qt::UTC); + return dt; } QDateTime TopicModel::oldestPostUpdate(const QList<Post> &posts) |