Debian Codegraph @

online-accounts-ui/src/request.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2013 Canonical Ltd.
3 *
4 * Contact: Alberto Mardegan <[email protected]>
5 *
6 * This file is part of lomiri-online-accounts-ui
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 3, as published
10 * by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranties of
14 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include <online-accounts-common/debug.h>cxx . . $ `<file>/online-accounts-common/debug.h`/
22 // TODO #include "dialog-request.h"
23 #include <online-accounts-common/globals.h>cxx . . $ `<file>/online-accounts-common/globals.h`/
24 #include "provider-request.h"cxx . . $ `<file>/online-accounts-ui/src/provider-request.h`/
25 #include "request.h"cxx . . $ `<file>/online-accounts-ui/src/request.h`/
26 #include "signonui-request.h"cxx . . $ `<file>/online-accounts-ui/src/signonui-request.h`/
27
28 #include <QFile>
29 #include <QPointer>
30
31 using namespace OnlineAccountsUi;
32
33 static bool mapIsSupersetcxx . . $ mapIsSuperset(ffbd4694911be6dd).(const QVariantMapcxx . . $ QVariantMap# &test, const QVariantMapcxx . . $ QVariantMap# &set)
34 {
35 QMapIteratorcxx . . $ QMapIterator#<QStringcxx . . $ QString#, QVariantcxx . . $ QVariant#> itcxx . . $ QMapIterator#QMapIterator(1d85e448f11cafa).(set);
36 while (it.hasNextcxx . . $ QMapIterator#hasNext(50ce9a9e25b4a850).()) {
37 it.nextcxx . . $ QMapIterator#next(5c754f5fbc3bb3d6).();
38 if (test.valuecxx . . $ QMap#value(866b0a4e5fb46e14).(it.keycxx . . $ QMapIterator#key(ea465e50d690edfe).()) !=cxx . . $ QVariant#`operator!=`(d03696648ee9d662). it.valuecxx . . $ QMapIterator#value(bdbd05d619d62250).()) return false;
39 }
40
41 return true;
42 }
43
44 namespace OnlineAccountsUicxx . . $ OnlineAccountsUi/ {
45
46 static QListcxx . . $ QList#<Requestcxx . . $ OnlineAccountsUi/Request# *> allRequestscxx . . $ OnlineAccountsUi/allRequests.;
47
48 class RequestPrivatecxx . . $ OnlineAccountsUi/RequestPrivate#: public QObjectcxx . . $ QObject#
49 {
50 Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`!
51 Q_DECLARE_PUBLICcxx . . $ `<external>/15045578679651060896/qglobal.h:1172:9`!(Request)
52
53 public:
54 RequestPrivatecxx . . $ OnlineAccountsUi/RequestPrivate#RequestPrivate(2d74b039c48ee0c7).(const QStringcxx . . $ QString# &interface,
55 int id,
56 const QStringcxx . . $ QString# &clientProfile,
57 const QVariantMapcxx . . $ QVariantMap# &parameters,
58 Requestcxx . . $ OnlineAccountsUi/Request# *request);
59 ~cxx . . $ OnlineAccountsUi/RequestPrivate#`~RequestPrivate`(ced63f7c635d850d).RequestPrivatecxx . . $ OnlineAccountsUi/RequestPrivate#();
60
61 WIdcxx . . $ WId# windowIdcxx . . $ OnlineAccountsUi/RequestPrivate#windowId(1c5fc1fd41a99ae7).() const {
62 return m_parameterscxx . . $ OnlineAccountsUi/RequestPrivate#m_parameters.[cxx . . $ QMap#`operator[]`(bfda1f1f965926d4).OAU_KEY_WINDOW_IDcxx . . $ `online-accounts-common/globals.h:33:9`!].toUIntcxx . . $ QVariant#toUInt(870b63f89c7fb98).();
63 }
64
65 private:
66 void setWindowcxx . . $ OnlineAccountsUi/RequestPrivate#setWindow(35681b993d9a3c79).(QWindowcxx . . $ QWindow# *window);
67
68 private:
69 mutable Requestcxx . . $ OnlineAccountsUi/Request# *q_ptrcxx . . $ OnlineAccountsUi/RequestPrivate#q_ptr.;
70 QStringcxx . . $ QString# m_interfacecxx . . $ OnlineAccountsUi/RequestPrivate#m_interface.;
71 int m_idcxx . . $ OnlineAccountsUi/RequestPrivate#m_id.;
72 QVariantMapcxx . . $ QVariantMap# m_parameterscxx . . $ OnlineAccountsUi/RequestPrivate#m_parameters.;
73 QStringcxx . . $ QString# m_clientApparmorProfilecxx . . $ OnlineAccountsUi/RequestPrivate#m_clientApparmorProfile.;
74 bool m_inProgresscxx . . $ OnlineAccountsUi/RequestPrivate#m_inProgress.;
75 QPointercxx . . $ QPointer#<QWindowcxx . . $ QWindow#> m_windowcxx . . $ OnlineAccountsUi/RequestPrivate#m_window.;
76 QStringcxx . . $ QString# m_errorNamecxx . . $ OnlineAccountsUi/RequestPrivate#m_errorName.;
77 QStringcxx . . $ QString# m_errorMessagecxx . . $ OnlineAccountsUi/RequestPrivate#m_errorMessage.;
78 QVariantMapcxx . . $ QVariantMap# m_resultcxx . . $ OnlineAccountsUi/RequestPrivate#m_result.;
79 int m_delaycxx . . $ OnlineAccountsUi/RequestPrivate#m_delay.;
80 };
81
82 } // namespace
83
84 RequestPrivatecxx . . $ OnlineAccountsUi/RequestPrivate#::RequestPrivatecxx . . $ OnlineAccountsUi/RequestPrivate#RequestPrivate(2d74b039c48ee0c7).(const QStringcxx . . $ QString# &interface,
85 int id,
86 const QStringcxx . . $ QString# &clientProfile,
87 const QVariantMapcxx . . $ QVariantMap# &parameters,
88 Requestcxx . . $ OnlineAccountsUi/Request# *request):
89 QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(request),
90 q_ptrcxx . . $ OnlineAccountsUi/RequestPrivate#q_ptr.(request),
91 m_interfacecxx . . $ OnlineAccountsUi/RequestPrivate#m_interface.(interface),
92 m_idcxx . . $ OnlineAccountsUi/RequestPrivate#m_id.(id),
93 m_parameterscxx . . $ OnlineAccountsUi/RequestPrivate#m_parameters.(parameters),
94 m_clientApparmorProfilecxx . . $ OnlineAccountsUi/RequestPrivate#m_clientApparmorProfile.(clientProfile),
95 m_inProgresscxx . . $ OnlineAccountsUi/RequestPrivate#m_inProgress.(false),
96 m_windowcxx . . $ OnlineAccountsUi/RequestPrivate#m_window.(0),
97 m_delaycxx . . $ OnlineAccountsUi/RequestPrivate#m_delay.(0)
98 {
99 }
100
101 RequestPrivatecxx . . $ OnlineAccountsUi/RequestPrivate#::~cxx . . $ OnlineAccountsUi/RequestPrivate#`~RequestPrivate`(ced63f7c635d850d).RequestPrivatecxx . . $ OnlineAccountsUi/RequestPrivate#()
102 {
103 }
104
105 void RequestPrivatecxx . . $ OnlineAccountsUi/RequestPrivate#::setWindowcxx . . $ OnlineAccountsUi/RequestPrivate#setWindow(35681b993d9a3c79).(QWindowcxx . . $ QWindow# *window)
106 {
107 if (m_windowcxx . . $ OnlineAccountsUi/RequestPrivate#m_window. != 0) {
108 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Widget already set";
109 return;
110 }
111
112 m_windowcxx . . $ OnlineAccountsUi/RequestPrivate#m_window. =cxx . . $ QPointer#`operator=`(500fb76d9e491ab0). window;
113
114 if (windowIdcxx . . $ OnlineAccountsUi/RequestPrivate#windowId(1c5fc1fd41a99ae7).() != 0) {
115 DEBUGcxx . . $ `online-accounts-common/debug.h:42:13`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Requesting window reparenting";
116 QWindowcxx . . $ QWindow# *parent = QWindowcxx . . $ QWindow#::fromWinIdcxx . . $ QWindow#fromWinId(698df145cbabc72).(windowIdcxx . . $ OnlineAccountsUi/RequestPrivate#windowId(1c5fc1fd41a99ae7).());
117 window->setTransientParentcxx . . $ QWindow#setTransientParent(35681b993d9a3c79).(parent);
118 }
119 window->showcxx . . $ QWindow#show(49f6e7a06ebc5aa8).();
120 }
121
122 /* Some unit tests might need to provide a different implementation for the
123 * Request::newRequest() factory method; for this reason, we allow the method
124 * to be excluded from compilation.
125 */
126 #ifndef NO_REQUEST_FACTORY
127 Requestcxx . . $ OnlineAccountsUi/Request# *Requestcxx . . $ OnlineAccountsUi/Request#::newRequestcxx . . $ OnlineAccountsUi/Request#newRequest(e29924839cd45521).(const QStringcxx . . $ QString# &interface,
128 int id,
129 const QStringcxx . . $ QString# &clientProfile,
130 const QVariantMapcxx . . $ QVariantMap# &parameters,
131 QObjectcxx . . $ QObject# *parent)
132 {
133 /* If the supported requests types vary considerably, we can create
134 * different subclasses for handling them, and in this method we examine
135 * the @parameters argument to figure out which subclass is the most apt to
136 * handle the request. */
137 if (interface ==cxx . . $ `operator==`(5bc2975d2d751687). OAU_INTERFACEcxx . . $ `online-accounts-common/globals.h:27:9`!) {
138 return new ProviderRequestcxx . . $ OnlineAccountsUi/ProviderRequest#(interface, id, clientProfile,
139 parameters, parent);
140 } else {
141 Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!(interface == SIGNONUI_INTERFACEcxx . . $ `online-accounts-common/globals.h:53:9`!);
142 return SignOnUicxx . . $ SignOnUi/::Requestcxx . . $ SignOnUi/Request#::newRequestcxx . . $ SignOnUi/Request#newRequest(7c93cb798db8aea0).(id, clientProfile,
143 parameters, parent);
144 }
145 }
146 #endif
147
148 Requestcxx . . $ OnlineAccountsUi/Request#::Requestcxx . . $ OnlineAccountsUi/Request#Request(6cdfba8807728f9f).(const QStringcxx . . $ QString# &interface,
149 int id,
150 const QStringcxx . . $ QString# &clientProfile,
151 const QVariantMapcxx . . $ QVariantMap# &parameters,
152 QObjectcxx . . $ QObject# *parent):
153 QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(parent),
154 d_ptrcxx . . $ OnlineAccountsUi/Request#d_ptr.(new RequestPrivatecxx . . $ OnlineAccountsUi/RequestPrivate#RequestPrivate(2d74b039c48ee0c7).(interface, id, clientProfile, parameters, this))
155 {
156 allRequestscxx . . $ OnlineAccountsUi/allRequests..appendcxx . . $ QList#append(77d9f17553126ecb).(this);
157 }
158
159 Requestcxx . . $ OnlineAccountsUi/Request#::~cxx . . $ OnlineAccountsUi/Request#`~Request`(ced63f7c635d850d).Requestcxx . . $ OnlineAccountsUi/Request#()
160 {
161 allRequestscxx . . $ OnlineAccountsUi/allRequests..removeOnecxx . . $ QList#removeOne(fe1ba53999e710f3).(this);
162 }
163
164 Requestcxx . . $ OnlineAccountsUi/Request# *Requestcxx . . $ OnlineAccountsUi/Request#::findcxx . . $ OnlineAccountsUi/Request#find(330139dc3e783e0c).(const QVariantMapcxx . . $ QVariantMap# &match)
165 {
166 Q_FOREACHcxx . . $ `<external>/15045578679651060896/qglobal.h:1137:9`!(Request *r, allRequests) {
167 if (mapIsSupersetcxx . . $ mapIsSuperset(ffbd4694911be6dd).(r->parameterscxx . . $ OnlineAccountsUi/Request#parameters(9daa5a8a8d37773d).(), match)) {
168 return r;
169 }
170 }
171
172 return 0;
173 }
174
175 QStringcxx . . $ QString# Requestcxx . . $ OnlineAccountsUi/Request#::interfacecxx . . $ OnlineAccountsUi/Request#interface(6ef7b6c27b00b43d).() const
176 {
177 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const Request);
178 return dcxx . . $ QString#QString(132dd6869045752b).->m_interfacecxx . . $ OnlineAccountsUi/RequestPrivate#m_interface.;
179 }
180
181 int Requestcxx . . $ OnlineAccountsUi/Request#::idcxx . . $ OnlineAccountsUi/Request#id(455f465bc33b4cdf).() const
182 {
183 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const Request);
184 return d->m_idcxx . . $ OnlineAccountsUi/RequestPrivate#m_id.;
185 }
186
187 void Requestcxx . . $ OnlineAccountsUi/Request#::setWindowcxx . . $ OnlineAccountsUi/Request#setWindow(35681b993d9a3c79).(QWindowcxx . . $ QWindow# *window)
188 {
189 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(Request);
190 d->setWindowcxx . . $ OnlineAccountsUi/RequestPrivate#setWindow(35681b993d9a3c79).(window);
191 }
192
193 WIdcxx . . $ WId# Requestcxx . . $ OnlineAccountsUi/Request#::windowIdcxx . . $ OnlineAccountsUi/Request#windowId(1c5fc1fd41a99ae7).() const
194 {
195 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const Request);
196 return d->windowIdcxx . . $ OnlineAccountsUi/RequestPrivate#windowId(1c5fc1fd41a99ae7).();
197 }
198
199 bool Requestcxx . . $ OnlineAccountsUi/Request#::isInProgresscxx . . $ OnlineAccountsUi/Request#isInProgress(50ce9a9e25b4a850).() const
200 {
201 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const Request);
202 return d->m_inProgresscxx . . $ OnlineAccountsUi/RequestPrivate#m_inProgress.;
203 }
204
205 const QVariantMapcxx . . $ QVariantMap# &Requestcxx . . $ OnlineAccountsUi/Request#::parameterscxx . . $ OnlineAccountsUi/Request#parameters(9daa5a8a8d37773d).() const
206 {
207 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const Request);
208 return d->m_parameterscxx . . $ OnlineAccountsUi/RequestPrivate#m_parameters.;
209 }
210
211 QStringcxx . . $ QString# Requestcxx . . $ OnlineAccountsUi/Request#::clientApparmorProfilecxx . . $ OnlineAccountsUi/Request#clientApparmorProfile(6ef7b6c27b00b43d).() const
212 {
213 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const Request);
214 return dcxx . . $ QString#QString(132dd6869045752b).->m_clientApparmorProfilecxx . . $ OnlineAccountsUi/RequestPrivate#m_clientApparmorProfile.;
215 }
216
217 QWindowcxx . . $ QWindow# *Requestcxx . . $ OnlineAccountsUi/Request#::windowcxx . . $ OnlineAccountsUi/Request#window(d520c9a5ccf200dd).() const
218 {
219 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const Request);
220 return d->m_windowcxx . . $ OnlineAccountsUi/RequestPrivate#m_window.;
221 }
222
223 QVariantMapcxx . . $ QVariantMap# Requestcxx . . $ OnlineAccountsUi/Request#::resultcxx . . $ OnlineAccountsUi/Request#result(87f780dbe64191c4).() const
224 {
225 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const Request);
226 return dcxx . . $ QMap#QMap(21739d87639e1d56).->m_resultcxx . . $ OnlineAccountsUi/RequestPrivate#m_result.;
227 }
228
229 QStringcxx . . $ QString# Requestcxx . . $ OnlineAccountsUi/Request#::errorNamecxx . . $ OnlineAccountsUi/Request#errorName(6ef7b6c27b00b43d).() const
230 {
231 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const Request);
232 return dcxx . . $ QString#QString(132dd6869045752b).->m_errorNamecxx . . $ OnlineAccountsUi/RequestPrivate#m_errorName.;
233 }
234
235 QStringcxx . . $ QString# Requestcxx . . $ OnlineAccountsUi/Request#::errorMessagecxx . . $ OnlineAccountsUi/Request#errorMessage(6ef7b6c27b00b43d).() const
236 {
237 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const Request);
238 return dcxx . . $ QString#QString(132dd6869045752b).->m_errorMessagecxx . . $ OnlineAccountsUi/RequestPrivate#m_errorMessage.;
239 }
240
241 void Requestcxx . . $ OnlineAccountsUi/Request#::setDelaycxx . . $ OnlineAccountsUi/Request#setDelay(d4f767463ce0a6b3).(int delay)
242 {
243 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(Request);
244 d->m_delaycxx . . $ OnlineAccountsUi/RequestPrivate#m_delay. = delay;
245 }
246
247 int Requestcxx . . $ OnlineAccountsUi/Request#::delaycxx . . $ OnlineAccountsUi/Request#delay(455f465bc33b4cdf).() const
248 {
249 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const Request);
250 return d->m_delaycxx . . $ OnlineAccountsUi/RequestPrivate#m_delay.;
251 }
252
253 void Requestcxx . . $ OnlineAccountsUi/Request#::startcxx . . $ OnlineAccountsUi/Request#start(49f6e7a06ebc5aa8).()
254 {
255 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(Request);
256 if (d->m_inProgresscxx . . $ OnlineAccountsUi/RequestPrivate#m_inProgress.) {
257 qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Request already started!";
258 return;
259 }
260 d->m_inProgresscxx . . $ OnlineAccountsUi/RequestPrivate#m_inProgress. = true;
261 }
262
263 void Requestcxx . . $ OnlineAccountsUi/Request#::cancelcxx . . $ OnlineAccountsUi/Request#cancel(49f6e7a06ebc5aa8).()
264 {
265 setCanceledcxx . . $ OnlineAccountsUi/Request#setCanceled(49f6e7a06ebc5aa8).();
266 }
267
268 void Requestcxx . . $ OnlineAccountsUi/Request#::failcxx . . $ OnlineAccountsUi/Request#fail(c1427772cd1877b0).(const QStringcxx . . $ QString# &name, const QStringcxx . . $ QString# &message)
269 {
270 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(Request);
271
272 DEBUGcxx . . $ `online-accounts-common/debug.h:42:13`!() <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). name <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). message;
273
274 d->m_errorNamecxx . . $ OnlineAccountsUi/RequestPrivate#m_errorName. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). name;
275 d->m_errorMessagecxx . . $ OnlineAccountsUi/RequestPrivate#m_errorMessage. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). message;
276
277 Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! completedcxx . . $ OnlineAccountsUi/Request#completed(49f6e7a06ebc5aa8).();
278 }
279
280 void Requestcxx . . $ OnlineAccountsUi/Request#::setCanceledcxx . . $ OnlineAccountsUi/Request#setCanceled(49f6e7a06ebc5aa8).()
281 {
282 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(Request);
283 if (d->m_inProgresscxx . . $ OnlineAccountsUi/RequestPrivate#m_inProgress.) {
284 failcxx . . $ OnlineAccountsUi/Request#fail(c1427772cd1877b0).(OAU_ERROR_USER_CANCELEDcxx . . $ `online-accounts-common/globals.h:39:9`!, QStringLiteralcxx . . $ `<external>/2817157206922689722/qstringliteral.h:65:9`!("Canceled"));
285 d->m_inProgresscxx . . $ OnlineAccountsUi/RequestPrivate#m_inProgress. = false;
286 }
287 }
288
289 void Requestcxx . . $ OnlineAccountsUi/Request#::setResultcxx . . $ OnlineAccountsUi/Request#setResult(3e95df3e31f2cce8).(const QVariantMapcxx . . $ QVariantMap# &result)
290 {
291 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(Request);
292 if (d->m_inProgresscxx . . $ OnlineAccountsUi/RequestPrivate#m_inProgress.) {
293 DEBUGcxx . . $ `online-accounts-common/debug.h:42:13`!() <<cxx . . $ `operator<<`(d06749710cb27f7f). result;
294 d->m_resultcxx . . $ OnlineAccountsUi/RequestPrivate#m_result. =cxx . . $ QMap#`operator=`(9a30e17cbbb0999d). result;
295
296 Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! completedcxx . . $ OnlineAccountsUi/Request#completed(49f6e7a06ebc5aa8).();
297 d->m_inProgresscxx . . $ OnlineAccountsUi/RequestPrivate#m_inProgress. = false;
298 }
299 }
300
301 QStringcxx . . $ QString# Requestcxx . . $ OnlineAccountsUi/Request#::mountPointcxx . . $ OnlineAccountsUi/Request#mountPoint(6ef7b6c27b00b43d).() const
302 {
303 return qEnvironmentVariableIsSetcxx . . $ qEnvironmentVariableIsSet(ab1b0059a8051c5c).("SNAP") ?
304 QFilecxx . . $ QFile#::decodeNamecxx . . $ QFile#decodeName(4e15edac36d215be).(qgetenvcxx . . $ qgetenv(531409eeffcde449).("SNAP")) : ""cxx . . $ QString#QString(85c52e162fed56f9).;
305 }
306
307 #include "request.moc"cxx . . $ `<file>/build/online-accounts-ui/src/lomiri-online-accounts-ui_autogen/include/request.moc`/