2
* This file is part of buteo-gcontact-plugin package
4
* Copyright (C) 2013 Jolla Ltd. and/or its subsidiary(-ies).
7
* Contributors: Sateesh Kavuri <sateesh.kavuri@gmail.com>
8
* Renato Araujo Oliveira Filho <renato.filho@canonical.com>
10
* This library is free software; you can redistribute it and/or
11
* modify it under the terms of the GNU Lesser General Public License
12
* version 2.1 as published by the Free Software Foundation.
14
* This library is distributed in the hope that it will be useful, but
15
* WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
* Lesser General Public License for more details.
19
* You should have received a copy of the GNU Lesser General Public
20
* License along with this library; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
34
#include <QNetworkAccessManager>
35
#include <QNetworkRequest>
36
#include <QNetworkReply>
38
class GTransportPrivate;
39
class GTransport : public QObject
42
Q_DECLARE_PRIVATE(GTransport)
53
explicit GTransport(QObject *parent = 0);
54
GTransport (QUrl url, QList<QPair<QByteArray, QByteArray> > headers);
55
GTransport (QUrl url, QList<QPair<QByteArray, QByteArray> > headers, QByteArray data);
57
virtual ~GTransport();
59
void setUrl(const QString &url);
60
void setData(QByteArray data);
62
void addHeader(const QByteArray first, const QByteArray second);
63
void setAuthToken(const QString token);
64
void setGDataVersionHeader();
65
void setProxy(QString proxyHost, QString proxyPort);
66
void request(const HTTP_REQUEST_TYPE type);
67
bool hasReply() const;
68
const QByteArray replyBody() const;
69
void setUpdatedMin(const QDateTime datetime);
70
void setMaxResults(unsigned int limit);
71
void setShowDeleted();
72
void setGroupFilter(const QString &account, const QString &groupId);
73
bool showDeleted() const;
74
void setStartIndex(const int index);
75
HTTP_REQUEST_TYPE requestType();
81
HTTP_CONTACT_CREATED = 201,
82
HTTP_PRECONDITION_FAILED = 412
85
static const QString GDATA_VERSION_HEADER;
88
void finishedRequest();
89
void error(int errorCode);
92
void requested(const QUrl &url, QByteArray *result);
95
virtual void finishedSlot(QNetworkReply* reply);
96
virtual void readyRead();
99
QScopedPointer<GTransportPrivate> d_ptr;
103
#endif // GTRANSPORT_H