forked from eteran/qgmailnotifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGMailFeed.h
59 lines (45 loc) · 1.09 KB
/
GMailFeed.h
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
#ifndef GMAILFEED_20080725_H_
#define GMAILFEED_20080725_H_
#include <QMap>
#include <QObject>
#include <QString>
#include <QVector>
#include <QXmlStreamReader>
class QNetworkAccessManager;
class QNetworkReply;
class QAuthenticator;
struct GMailEntry {
QString title;
QString summary;
QString link;
QString modified;
QString issued;
QString id;
QString author_name;
QString author_email;
};
struct Credentials {
QString user;
QString pass;
};
class GMailFeed : public QObject {
Q_OBJECT
public:
GMailFeed(QObject *parent = 0);
public:
void fetch(const QString &user, const QString &pass);
const QVector<GMailEntry> &mail() const { return entries_; }
public Q_SLOTS:
void onAuthenticationRequestSlot(QNetworkReply *reply, QAuthenticator *authenticator);
void requestFinished(QNetworkReply *reply);
Q_SIGNALS:
void fetchComplete(QNetworkReply *reply);
private:
void parseXml();
private:
QXmlStreamReader xmlReader_;
QNetworkAccessManager *networkManager_;
QMap<QNetworkReply *, Credentials> credentials_;
QVector<GMailEntry> entries_;
};
#endif