greghaynes / kdelicious

A Konqueror del.icio.us plugin

laurent Montel (author)
Thu Apr 09 00:12:54 -0700 2009
greghaynes (committer)
Thu Apr 09 00:12:54 -0700 2009
kdelicious / browser.h
100644 64 lines (49 sloc) 1.337 kb
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef QTLICIOUS_H
#define QTLICIOUS_H
 
#include "request.h"
#include "bookmarkrequest.h"
#include "postrequest.h"
 
#include <QObject>
#include <QString>
#include <QQueue>
 
static const char *delicious_api_host = "api.del.icio.us";
 
namespace QtLicious
{
 
/**
* @brief An asyncronous interface for making del.icio.us requests.
*
* Methods for requesting del.icio.us data return Request subclasses
* which are queue'd for processing. If a request is deleted before
* processing begins the request will be removed from the queue.
* Each request can be deleted after it has completed, otherwise it
* will be deleted upon destruction of the Browser instance which
* created it.
*/
class Browser
: public QObject
{
Q_OBJECT
 
public:
Browser( QObject *parent = 0 );
Browser( const QString &apiHost = delicious_api_host,
QObject *parent = 0 );
 
QHttp *http() const;
BookmarkRequest *recentBookmarks();
PostRequest *postBookmark( const QString &description,
const QString &url,
const QString &notes,
QList<QString> tags,
bool shared = true,
bool replace = true );
 
private Q_SLOTS:
void requestFinished();
void throttleTimeout();
 
private:
void enqueueRequest( Request *req );
void runRequest( Request *req );
 
bool can_req;
QQueue<Request*> requestQueue;
QHttp *m_http;
 
};
 
}
 
#endif