diff options
Diffstat (limited to 'fetchtopicsaction.cpp')
-rw-r--r-- | fetchtopicsaction.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/fetchtopicsaction.cpp b/fetchtopicsaction.cpp index 5661da8..dd59b4d 100644 --- a/fetchtopicsaction.cpp +++ b/fetchtopicsaction.cpp @@ -13,6 +13,19 @@ FetchTopicsAction::FetchTopicsAction(int forumId, int start, int end, Board *boa { } +bool FetchTopicsAction::isSupersetOf(Action *action) const +{ + FetchTopicsAction *other = qobject_cast<FetchTopicsAction*>(action); + if (other) { + if (other->_forumId == _forumId) { + if (_start <= other->_start && _end >= other->_end) { + return true; + } + } + } + return false; +} + void FetchTopicsAction::execute() { _call = _board->service()->asyncCall("get_topic", @@ -20,8 +33,6 @@ void FetchTopicsAction::execute() connect(_call, SIGNAL(finished(XmlRpcPendingCall*)), SLOT(handleFinishedCall())); } -// forum_id INTEGER, topic_id INTEGER PRIMARY KEY, topic_title TEXT, topic_author_id INTEGER, topic_author_name TEXT, is_subscribed BOOL, is_closed BOOL, icon_url TEXT, last_reply_time TEXT, new_post BOOL - void FetchTopicsAction::handleFinishedCall() { XmlRpcReply<QVariantMap> result(_call); @@ -40,12 +51,12 @@ void FetchTopicsAction::handleFinishedCall() bool ok = false; int forum_id = topic["forum_id"].toInt(&ok); if (!ok) { - qWarning() << "No forum_id in" << topic; - continue; + // Not fatal, just use the one we expected. + forum_id = _forumId; } int topic_id = topic["topic_id"].toInt(&ok); if (!ok) { - qWarning() << "No parent_id in" << topic; + qWarning() << "No topic_id in" << topic; continue; } @@ -72,6 +83,8 @@ void FetchTopicsAction::handleFinishedCall() if (topics.size() > 0) { _board->notifyForumTopicsChanged(_forumId, _start, _start + topics.size() - 1); + } else { + qWarning() << "Asked for topics, got none..."; } } else { qWarning() << "Could not fetch topics"; |