summaryrefslogtreecommitdiff
path: root/fetchpostsaction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fetchpostsaction.cpp')
-rw-r--r--fetchpostsaction.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/fetchpostsaction.cpp b/fetchpostsaction.cpp
index dbfaf41..d293129 100644
--- a/fetchpostsaction.cpp
+++ b/fetchpostsaction.cpp
@@ -83,7 +83,7 @@ void FetchPostsAction::handleFinishedCall()
// Not fatal, just assume it's the one we requested
topic_id = _topicId;
}
- const QString topic_title = unencodePostText(map["topic_title"]);
+ const QString topic_title = decodePostText(map["topic_title"]);
const int unread_position = map["position"].toInt() - 1;
const int total_post_num = map["total_post_num"].toInt();
@@ -126,13 +126,13 @@ void FetchPostsAction::handleFinishedCall()
query.bindValue(":topic_id", topic_id);
query.bindValue(":post_id", post_id);
- query.bindValue(":post_title", unencodePostTitle(post["post_title"], topic_title));
- query.bindValue(":post_content", unencodePostContent(post["post_content"]));
+ query.bindValue(":post_title", decodePostTitle(post["post_title"], topic_title));
+ query.bindValue(":post_content", decodePostContent(post["post_content"]));
query.bindValue(":post_author_id", post["post_author_id"].toInt());
- query.bindValue(":post_author_name", unencodePostText(post["post_author_name"]));
+ query.bindValue(":post_author_name", decodePostText(post["post_author_name"]));
query.bindValue(":can_edit", post["can_edit"].toBool() ? 1 : 0);
query.bindValue(":icon_url", post["icon_url"].toString());
- query.bindValue(":post_time", unencodeDateTime(post["post_time"]));
+ query.bindValue(":post_time", post["post_time"].toDateTime().toUTC());
query.bindValue(":position", position);
query.bindValue(":last_update_time", QDateTime::currentDateTimeUtc());
@@ -176,15 +176,15 @@ void FetchPostsAction::handleFinishedCall()
_call->deleteLater();
}
-QString FetchPostsAction::unencodePostText(const QVariant &v)
+QString FetchPostsAction::decodePostText(const QVariant &v)
{
QByteArray ba = v.toByteArray();
return QString::fromUtf8(ba.constData(), ba.length());
}
-QString FetchPostsAction::unencodePostTitle(const QVariant &v, const QString &topicTitle)
+QString FetchPostsAction::decodePostTitle(const QVariant &v, const QString &topicTitle)
{
- QString title = unencodePostText(v);
+ QString title = decodePostText(v);
if (QString::compare(title, "Re: " + topicTitle, Qt::CaseInsensitive) == 0) {
// Hack to disable the useless "Re: $TOPIC_TITLE" post titles everywhere
return QString();
@@ -192,15 +192,8 @@ QString FetchPostsAction::unencodePostTitle(const QVariant &v, const QString &to
return title;
}
-QString FetchPostsAction::unencodePostContent(const QVariant &v)
+QString FetchPostsAction::decodePostContent(const QVariant &v)
{
- QString richText = _board->bbcodeToRichText(unencodePostText(v));
+ QString richText = _board->bbcodeToRichText(decodePostText(v));
return _board->parseSmilies(richText);
}
-
-QDateTime FetchPostsAction::unencodeDateTime(const QVariant &v)
-{
- QDateTime dt = v.toDateTime();
- dt.setTimeSpec(Qt::UTC);
- return dt;
-}