1/*
2 * Copyright (C) 2011 Zeno Albisser <zeno@webkit.org>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this program; see the file COPYING.LIB.  If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 *
19 */
20
21#ifndef qquickurlschemedelegate_p_h
22#define qquickurlschemedelegate_p_h
23
24#include "qwebkitglobal.h"
25#include <QObject>
26#include <QtQuick/qquickitem.h>
27
28class QQuickNetworkRequest;
29class QQuickNetworkReply;
30class QUrl;
31
32class QWEBKIT_EXPORT QQuickUrlSchemeDelegate : public QObject {
33    Q_OBJECT
34    Q_PROPERTY(QString scheme READ scheme WRITE setScheme NOTIFY schemeChanged)
35    Q_PROPERTY(QQuickNetworkRequest* request READ request)
36    Q_PROPERTY(QQuickNetworkReply* reply READ reply)
37
38public:
39    QQuickUrlSchemeDelegate(QObject* parent = 0);
40    QString scheme() const;
41    void setScheme(const QString& scheme);
42    QQuickNetworkRequest* request() const;
43    QQuickNetworkReply* reply() const;
44
45Q_SIGNALS:
46    void schemeChanged();
47    void receivedRequest();
48
49private:
50    QString m_scheme;
51    QQuickNetworkRequest* m_request;
52    QQuickNetworkReply* m_reply;
53};
54
55QML_DECLARE_TYPE(QQuickUrlSchemeDelegate)
56
57class QQuickQrcSchemeDelegate : public QQuickUrlSchemeDelegate {
58    Q_OBJECT
59public:
60    QQuickQrcSchemeDelegate(const QUrl& url);
61    void readResourceAndSend();
62
63private:
64    QString m_fileName;
65};
66
67#endif // qquickurlschemedelegate_p_h
68
69
70