summaryrefslogtreecommitdiff
path: root/fetchpostsaction.h
blob: 6586ae6196fae90d9a59ddf6edd2f785df388086 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef FETCHPOSTSACTION_H
#define FETCHPOSTSACTION_H

#include <QtCore/QVariant>
#include <QtSql/QSqlQuery>
#include "action.h"

class XmlRpcPendingCall;

class FetchPostsAction : public Action
{
	Q_OBJECT
public:
	enum {
		/** Use as 'end' parameter; 'start' then indicates starting post. */
		FetchAllPosts = -1,
		/** Use as 'start' parameter; 'end' then indicates number of posts. */
		FetchUnreadPosts = -2
	};

	explicit FetchPostsAction(int topicId, int start, int end, Board *board);

	bool isSupersetOf(Action *action) const;

	void execute();

private slots:
	void handleFinishedCall();

private:
	static QString decodePostText(const QVariant& v);
	static QString decodePostTitle(const QVariant& v, const QString& topicTitle);
	QString decodePostContent(const QVariant& v);

private:
	XmlRpcPendingCall *_call;
	int _topicId;
	int _start;
	int _end;
};

#endif // FETCHPOSTSACTION_H