1 /****************************************************************************
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
5 **
6 ** This file is part of the QtLocation module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL3$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see http://www.qt.io/terms-conditions. For further
15 ** information use the contact form at http://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPLv3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or later as published by the Free
28 ** Software Foundation and appearing in the file LICENSE.GPL included in
29 ** the packaging of this file. Please review the following information to
30 ** ensure the GNU General Public License version 2.0 requirements will be
31 ** met: http://www.gnu.org/licenses/gpl-2.0.html.
32 **
33 ** $QT_END_LICENSE$
34 **
35 ****************************************************************************/
36 
37 #ifndef UNSUPPORTEDREPLIES_P_H
38 #define UNSUPPORTEDREPLIES_P_H
39 
40 //
41 //  W A R N I N G
42 //  -------------
43 //
44 // This file is not part of the Qt API.  It exists purely as an
45 // implementation detail.  This header file may change from version to
46 // version without notice, or even be removed.
47 //
48 // We mean it.
49 //
50 
51 #include <QtLocation/private/qlocationglobal_p.h>
52 #include "qplacedetailsreply.h"
53 #include "qplacecontentreply.h"
54 #include "qplacesearchreply.h"
55 #include "qplacesearchsuggestionreply.h"
56 #include "qplaceidreply.h"
57 
58 #include "qplacematchreply.h"
59 #include "qplacemanagerengine.h"
60 
61 class Q_LOCATION_PRIVATE_EXPORT QPlaceDetailsReplyUnsupported : public QPlaceDetailsReply
62 {
63     Q_OBJECT
64 
65 public:
QPlaceDetailsReplyUnsupported(QPlaceManagerEngine * parent)66     QPlaceDetailsReplyUnsupported(QPlaceManagerEngine *parent)
67     :   QPlaceDetailsReply(parent)
68     {
69         setError(QPlaceReply::UnsupportedError,
70                  QStringLiteral("Getting place details is not supported."));
71         setFinished(true);
72         QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
73                                   Q_ARG(QPlaceReply::Error, error()),
74                                   Q_ARG(QString, errorString()));
75         QMetaObject::invokeMethod(parent, "error", Qt::QueuedConnection,
76                                   Q_ARG(QPlaceReply *, this),
77                                   Q_ARG(QPlaceReply::Error, error()),
78                                   Q_ARG(QString, errorString()));
79         QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
80         QMetaObject::invokeMethod(parent, "finished", Qt::QueuedConnection,
81                                   Q_ARG(QPlaceReply *, this));
82     }
83 };
84 
85 class Q_LOCATION_PRIVATE_EXPORT QPlaceContentReplyUnsupported : public QPlaceContentReply
86 {
87     Q_OBJECT
88 
89 public:
QPlaceContentReplyUnsupported(QPlaceManagerEngine * parent)90     QPlaceContentReplyUnsupported(QPlaceManagerEngine *parent)
91     :   QPlaceContentReply(parent)
92     {
93         setError(QPlaceReply::UnsupportedError,
94                  QStringLiteral("Place content is not supported."));
95         setFinished(true);
96         QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
97                                   Q_ARG(QPlaceReply::Error, error()),
98                                   Q_ARG(QString, errorString()));
99         QMetaObject::invokeMethod(parent, "error", Qt::QueuedConnection,
100                                   Q_ARG(QPlaceReply *, this),
101                                   Q_ARG(QPlaceReply::Error, error()),
102                                   Q_ARG(QString, errorString()));
103         QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
104         QMetaObject::invokeMethod(parent, "finished", Qt::QueuedConnection,
105                                   Q_ARG(QPlaceReply *, this));
106     }
107 };
108 
109 class Q_LOCATION_PRIVATE_EXPORT QPlaceSearchReplyUnsupported : public QPlaceSearchReply
110 {
111     Q_OBJECT
112 
113 public:
QPlaceSearchReplyUnsupported(QPlaceReply::Error errorCode,const QString & message,QPlaceManagerEngine * parent)114     QPlaceSearchReplyUnsupported(QPlaceReply::Error errorCode, const QString &message,
115                                  QPlaceManagerEngine *parent)
116     :   QPlaceSearchReply(parent)
117     {
118         setError(errorCode, message);
119         setFinished(true);
120         QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
121                                   Q_ARG(QPlaceReply::Error, error()),
122                                   Q_ARG(QString, errorString()));
123         QMetaObject::invokeMethod(parent, "error", Qt::QueuedConnection,
124                                   Q_ARG(QPlaceReply *, this),
125                                   Q_ARG(QPlaceReply::Error, error()),
126                                   Q_ARG(QString, errorString()));
127         QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
128         QMetaObject::invokeMethod(parent, "finished", Qt::QueuedConnection,
129                                   Q_ARG(QPlaceReply *, this));
130     }
131 };
132 
133 class Q_LOCATION_PRIVATE_EXPORT QPlaceSearchSuggestionReplyUnsupported : public QPlaceSearchSuggestionReply
134 {
135     Q_OBJECT
136 
137 public:
QPlaceSearchSuggestionReplyUnsupported(QPlaceManagerEngine * parent)138     QPlaceSearchSuggestionReplyUnsupported(QPlaceManagerEngine *parent)
139     :   QPlaceSearchSuggestionReply(parent)
140     {
141         setError(QPlaceReply::UnsupportedError,
142                  QStringLiteral("Place search suggestions are not supported."));
143         setFinished(true);
144         QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
145                                   Q_ARG(QPlaceReply::Error, error()),
146                                   Q_ARG(QString, errorString()));
147         QMetaObject::invokeMethod(parent, "error", Qt::QueuedConnection,
148                                   Q_ARG(QPlaceReply *, this),
149                                   Q_ARG(QPlaceReply::Error, error()),
150                                   Q_ARG(QString, errorString()));
151         QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
152         QMetaObject::invokeMethod(parent, "finished", Qt::QueuedConnection,
153                                   Q_ARG(QPlaceReply *, this));
154     }
155 };
156 
157 class Q_LOCATION_PRIVATE_EXPORT QPlaceIdReplyUnsupported : public QPlaceIdReply
158 {
159     Q_OBJECT
160 
161 public:
QPlaceIdReplyUnsupported(const QString & message,QPlaceIdReply::OperationType type,QPlaceManagerEngine * parent)162     QPlaceIdReplyUnsupported(const QString &message, QPlaceIdReply::OperationType type,
163                              QPlaceManagerEngine *parent)
164     :   QPlaceIdReply(type, parent)
165     {
166         setError(QPlaceReply::UnsupportedError, message);
167         setFinished(true);
168         QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
169                                   Q_ARG(QPlaceReply::Error, error()),
170                                   Q_ARG(QString, errorString()));
171         QMetaObject::invokeMethod(parent, "error", Qt::QueuedConnection,
172                                   Q_ARG(QPlaceReply *, this),
173                                   Q_ARG(QPlaceReply::Error, error()),
174                                   Q_ARG(QString, errorString()));
175         QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
176         QMetaObject::invokeMethod(parent, "finished", Qt::QueuedConnection,
177                                   Q_ARG(QPlaceReply *, this));
178     }
179 };
180 
181 class Q_LOCATION_PRIVATE_EXPORT QPlaceReplyUnsupported : public QPlaceReply
182 {
183     Q_OBJECT
184 
185 public:
QPlaceReplyUnsupported(const QString & message,QPlaceManagerEngine * parent)186     QPlaceReplyUnsupported(const QString &message, QPlaceManagerEngine *parent)
187     :   QPlaceReply(parent)
188     {
189         setError(QPlaceReply::UnsupportedError, message);
190         setFinished(true);
191         QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
192                                   Q_ARG(QPlaceReply::Error, error()),
193                                   Q_ARG(QString, errorString()));
194         QMetaObject::invokeMethod(parent, "error", Qt::QueuedConnection,
195                                   Q_ARG(QPlaceReply *, this),
196                                   Q_ARG(QPlaceReply::Error, error()),
197                                   Q_ARG(QString, errorString()));
198         QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
199         QMetaObject::invokeMethod(parent, "finished", Qt::QueuedConnection,
200                                   Q_ARG(QPlaceReply *, this));
201     }
202 };
203 
204 class Q_LOCATION_PRIVATE_EXPORT QPlaceMatchReplyUnsupported : public QPlaceMatchReply
205 {
206     Q_OBJECT
207 
208 public:
QPlaceMatchReplyUnsupported(QPlaceManagerEngine * parent)209     QPlaceMatchReplyUnsupported(QPlaceManagerEngine *parent)
210     :   QPlaceMatchReply(parent)
211     {
212         setError(QPlaceReply::UnsupportedError,
213                  QStringLiteral("Place matching is not supported."));
214         setFinished(true);
215         QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
216                                   Q_ARG(QPlaceReply::Error, error()),
217                                   Q_ARG(QString, errorString()));
218         QMetaObject::invokeMethod(parent, "error", Qt::QueuedConnection,
219                                   Q_ARG(QPlaceReply *, this),
220                                   Q_ARG(QPlaceReply::Error, error()),
221                                   Q_ARG(QString, errorString()));
222         QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
223         QMetaObject::invokeMethod(parent, "finished", Qt::QueuedConnection,
224                                   Q_ARG(QPlaceReply *, this));
225     }
226 };
227 
228 #endif
229