| 1 | /* |
| 2 | * Copyright (C) 2014 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 | #include <online-accounts-common/ipc.h>cxx . . $ `<file>/online-accounts-common/ipc.h`/ |
| 23 | #include "request.h"cxx . . $ `<file>/online-accounts-ui/src/request.h`/ |
| 24 | #include "signonui-request.h"cxx . . $ `<file>/online-accounts-ui/src/signonui-request.h`/ |
| 25 | #include "ui-server.h"cxx . . $ `<file>/online-accounts-ui/src/ui-server.h`/ |
| 26 | |
| 27 | #include <LomiriOnlineAccountsPlugin/request-handler.h>cxx . . $ `<file>/online-accounts-plugins/lib/LomiriOnlineAccountsPlugin/request-handler.h`/ |
| 28 | #include <QByteArray> |
| 29 | #include <QDataStream> |
| 30 | #include <QLocalSocket> |
| 31 | #include <QtQml> |
| 32 | #include <SignOn/uisessiondata_priv.h> |
| 33 | |
| 34 | using namespace OnlineAccountsUi; |
| 35 | |
| 36 | static UiServercxx . . $ OnlineAccountsUi/UiServer# *m_instancecxx . . $ m_instance. = 0; |
| 37 | |
| 38 | namespace OnlineAccountsUicxx . . $ OnlineAccountsUi/ { |
| 39 | |
| 40 | class UiServerPrivatecxx . . $ OnlineAccountsUi/UiServerPrivate#: public QObjectcxx . . $ QObject# |
| 41 | { |
| 42 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 43 | Q_DECLARE_PUBLICcxx . . $ `<external>/15045578679651060896/qglobal.h:1172:9`!(UiServer) |
| 44 | |
| 45 | public: |
| 46 | inline UiServerPrivatecxx . . $ OnlineAccountsUi/UiServerPrivate#UiServerPrivate(5c4413f32a6590ed).(const QStringcxx . . $ QString# &address, UiServercxx . . $ OnlineAccountsUi/UiServer# *pluginServer); |
| 47 | inline ~cxx . . $ OnlineAccountsUi/UiServerPrivate#`~UiServerPrivate`(ced63f7c635d850d).UiServerPrivatecxx . . $ OnlineAccountsUi/UiServerPrivate#(); |
| 48 | |
| 49 | bool setupSocketcxx . . $ OnlineAccountsUi/UiServerPrivate#setupSocket(c9857a73d68e59ba).(); |
| 50 | bool initcxx . . $ OnlineAccountsUi/UiServerPrivate#init(c9857a73d68e59ba).(); |
| 51 | void sendOperationcxx . . $ OnlineAccountsUi/UiServerPrivate#sendOperation(3e95df3e31f2cce8).(const QVariantMapcxx . . $ QVariantMap# &data); |
| 52 | |
| 53 | private Q_SLOTScxx . . $ `<external>/1208926524888476972/qobjectdefs.h:92:10`!: |
| 54 | void onDataReadycxx . . $ OnlineAccountsUi/UiServerPrivate#onDataReady(ce30c813b115780d).(QByteArraycxx . . $ QByteArray# &data); |
| 55 | void onRequestCompletedcxx . . $ OnlineAccountsUi/UiServerPrivate#onRequestCompleted(49f6e7a06ebc5aa8).(); |
| 56 | void registerHandlercxx . . $ OnlineAccountsUi/UiServerPrivate#registerHandler(33a36a88f472ca4b).(SignOnUicxx . . $ SignOnUi/::RequestHandlercxx . . $ SignOnUi/RequestHandler# *handler); |
| 57 | |
| 58 | private: |
| 59 | QLocalSocketcxx . . $ QLocalSocket# m_socketcxx . . $ OnlineAccountsUi/UiServerPrivate#m_socket.; |
| 60 | OnlineAccountsUicxx . . $ OnlineAccountsUi/::Ipccxx . . $ OnlineAccountsUi/Ipc# m_ipccxx . . $ OnlineAccountsUi/UiServerPrivate#m_ipc.; |
| 61 | SignOnUicxx . . $ SignOnUi/::RequestHandlerWatchercxx . . $ SignOnUi/RequestHandlerWatcher# m_handlerWatchercxx . . $ OnlineAccountsUi/UiServerPrivate#m_handlerWatcher.; |
| 62 | mutable UiServercxx . . $ OnlineAccountsUi/UiServer# *q_ptrcxx . . $ OnlineAccountsUi/UiServerPrivate#q_ptr.; |
| 63 | }; |
| 64 | |
| 65 | } // namespace |
| 66 | |
| 67 | UiServerPrivatecxx . . $ OnlineAccountsUi/UiServerPrivate#::UiServerPrivatecxx . . $ OnlineAccountsUi/UiServerPrivate#UiServerPrivate(5c4413f32a6590ed).(const QStringcxx . . $ QString# &address, |
| 68 | UiServercxx . . $ OnlineAccountsUi/UiServer# *pluginServer): |
| 69 | QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(pluginServer), |
| 70 | q_ptrcxx . . $ OnlineAccountsUi/UiServerPrivate#q_ptr.(pluginServer) |
| 71 | { |
| 72 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(158df1d9a01a3410).(&m_ipccxx . . $ OnlineAccountsUi/UiServerPrivate#m_ipc., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(dataReady(QByteArray &)), |
| 73 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(onDataReady(QByteArray &))); |
| 74 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(158df1d9a01a3410).(&m_socketcxx . . $ OnlineAccountsUi/UiServerPrivate#m_socket., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(disconnected()), |
| 75 | q_ptrcxx . . $ OnlineAccountsUi/UiServerPrivate#q_ptr., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(finished())); |
| 76 | m_socketcxx . . $ OnlineAccountsUi/UiServerPrivate#m_socket..connectToServercxx . . $ QLocalSocket#connectToServer(8f4bc4a0c00c3d3f).(address); |
| 77 | |
| 78 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(158df1d9a01a3410).(&m_handlerWatchercxx . . $ OnlineAccountsUi/UiServerPrivate#m_handlerWatcher., |
| 79 | SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(newHandler(SignOnUi::RequestHandler *)), |
| 80 | this, |
| 81 | SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(registerHandler(SignOnUi::RequestHandler *))); |
| 82 | } |
| 83 | |
| 84 | UiServerPrivatecxx . . $ OnlineAccountsUi/UiServerPrivate#::~cxx . . $ OnlineAccountsUi/UiServerPrivate#`~UiServerPrivate`(ced63f7c635d850d).UiServerPrivatecxx . . $ OnlineAccountsUi/UiServerPrivate#() |
| 85 | { |
| 86 | DEBUGcxx . . $ `online-accounts-common/debug.h:42:13`!(); |
| 87 | } |
| 88 | |
| 89 | void UiServerPrivatecxx . . $ OnlineAccountsUi/UiServerPrivate#::sendOperationcxx . . $ OnlineAccountsUi/UiServerPrivate#sendOperation(3e95df3e31f2cce8).(const QVariantMapcxx . . $ QVariantMap# &data) |
| 90 | { |
| 91 | QByteArraycxx . . $ QByteArray# bacxx . . $ QByteArray#QByteArray(ced63f7c635d850d).; |
| 92 | QDataStreamcxx . . $ QDataStream# streamcxx . . $ QDataStream#QDataStream(3ec9af543aa5ce32).(&ba, QIODevicecxx . . $ QFlags#QFlags(93d577a3e9528307).::WriteOnlycxx . . $ QIODevice#WriteOnly.); |
| 93 | stream <<cxx . . $ `operator<<`(f1cf7fb498ef14e5). data; |
| 94 | m_ipccxx . . $ OnlineAccountsUi/UiServerPrivate#m_ipc..writecxx . . $ OnlineAccountsUi/Ipc#write(45672f3c6961a244).(ba); |
| 95 | } |
| 96 | |
| 97 | void UiServerPrivatecxx . . $ OnlineAccountsUi/UiServerPrivate#::onDataReadycxx . . $ OnlineAccountsUi/UiServerPrivate#onDataReady(ce30c813b115780d).(QByteArraycxx . . $ QByteArray# &data) |
| 98 | { |
| 99 | QVariantMapcxx . . $ QVariantMap# mapcxx . . $ QMap#QMap(ced63f7c635d850d).; |
| 100 | QDataStreamcxx . . $ QDataStream# streamcxx . . $ QDataStream#QDataStream(3ec9af543aa5ce32).(&data, QIODevicecxx . . $ QFlags#QFlags(93d577a3e9528307).::ReadOnlycxx . . $ QIODevice#ReadOnly.); |
| 101 | stream >>cxx . . $ `operator>>`(44252f04a2ddbdcd). map; |
| 102 | |
| 103 | DEBUGcxx . . $ `online-accounts-common/debug.h:42:13`!() <<cxx . . $ `operator<<`(d06749710cb27f7f). map; |
| 104 | |
| 105 | QStringcxx . . $ QString# code = map.valuecxx . . $ QMap#value(866b0a4e5fb46e14).(OAU_OPERATION_CODEcxx . . $ `online-accounts-common/ipc.h:30:9`!).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).(); |
| 106 | if (code ==cxx . . $ QString#`operator==`(7d4bdb1abc417636). OAU_OPERATION_CODE_PROCESScxx . . $ `online-accounts-common/ipc.h:31:9`!) { |
| 107 | QVariantMapcxx . . $ QVariantMap# parameters = map[cxx . . $ QMap#`operator[]`(bbd415b616967878).OAU_OPERATION_DATAcxx . . $ `online-accounts-common/ipc.h:36:9`!].toMapcxx . . $ QVariant#toMap(87f780dbe64191c4).(); |
| 108 | Requestcxx . . $ OnlineAccountsUi/Request# *request = |
| 109 | Requestcxx . . $ OnlineAccountsUi/Request#::newRequestcxx . . $ OnlineAccountsUi/Request#newRequest(e29924839cd45521).(map[cxx . . $ QMap#`operator[]`(bbd415b616967878).OAU_OPERATION_INTERFACEcxx . . $ `online-accounts-common/ipc.h:38:9`!].toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).(), |
| 110 | map[cxx . . $ QMap#`operator[]`(bbd415b616967878).OAU_OPERATION_IDcxx . . $ `online-accounts-common/ipc.h:35:9`!].toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(), |
| 111 | map[cxx . . $ QMap#`operator[]`(bbd415b616967878).OAU_OPERATION_CLIENT_PROFILEcxx . . $ `online-accounts-common/ipc.h:39:9`!].toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).(), |
| 112 | parameters, |
| 113 | this); |
| 114 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(158df1d9a01a3410).(request, SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(completed()), |
| 115 | this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(onRequestCompleted())); |
| 116 | |
| 117 | /* Check if a RequestHandler has been setup to handle this request. If |
| 118 | * so, bing the request object to the handler and start the request |
| 119 | * immediately. */ |
| 120 | SignOnUicxx . . $ SignOnUi/::Requestcxx . . $ SignOnUi/Request# *signonRequest = |
| 121 | qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<SignOnUicxx . . $ SignOnUi/::Requestcxx . . $ SignOnUi/Request#*>(request); |
| 122 | if (signonRequest) { |
| 123 | SignOnUicxx . . $ SignOnUi/::RequestHandlercxx . . $ SignOnUi/RequestHandler# *handler = |
| 124 | m_handlerWatchercxx . . $ OnlineAccountsUi/UiServerPrivate#m_handlerWatcher..findMatchingcxx . . $ SignOnUi/RequestHandlerWatcher#findMatching(f85eb24b3e476fd).(parameters); |
| 125 | if (handler) { |
| 126 | signonRequest->setHandlercxx . . $ SignOnUi/Request#setHandler(33a36a88f472ca4b).(handler); |
| 127 | } |
| 128 | } |
| 129 | request->startcxx . . $ OnlineAccountsUi/Request#start(49f6e7a06ebc5aa8).(); |
| 130 | } else { |
| 131 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Invalid operation code: " <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). code; |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | void UiServerPrivatecxx . . $ OnlineAccountsUi/UiServerPrivate#::onRequestCompletedcxx . . $ OnlineAccountsUi/UiServerPrivate#onRequestCompleted(49f6e7a06ebc5aa8).() |
| 136 | { |
| 137 | Requestcxx . . $ OnlineAccountsUi/Request# *request = qobject_castcxx . . $ qobject_cast(c988cfc0ca08742e).<Requestcxx . . $ OnlineAccountsUi/Request#*>(sendercxx . . $ QObject#sender(2dbb680a34285c44).()); |
| 138 | request->disconnectcxx . . $ QObject#disconnect(105bbb4f746c4352).(this); |
| 139 | request->deleteLatercxx . . $ QObject#deleteLater(49f6e7a06ebc5aa8).(); |
| 140 | |
| 141 | if (request->errorNamecxx . . $ OnlineAccountsUi/Request#errorName(6ef7b6c27b00b43d).().isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) { |
| 142 | QVariantMapcxx . . $ QVariantMap# operationcxx . . $ QMap#QMap(ced63f7c635d850d).; |
| 143 | operation.insertcxx . . $ QMap#insert(929a1ed410fe8423).(OAU_OPERATION_CODEcxx . . $ `online-accounts-common/ipc.h:30:9`!, |
| 144 | OAU_OPERATION_CODE_REQUEST_FINISHEDcxx . . $ `online-accounts-common/ipc.h:33:9`!); |
| 145 | operation.insertcxx . . $ QMap#insert(929a1ed410fe8423).(OAU_OPERATION_IDcxx . . $ `online-accounts-common/ipc.h:35:9`!, requestcxx . . $ QVariant#QVariant(d4f767463ce0a6b3).->idcxx . . $ OnlineAccountsUi/Request#id(455f465bc33b4cdf).()); |
| 146 | operation.insertcxx . . $ QMap#insert(929a1ed410fe8423).(OAU_OPERATION_DATAcxx . . $ `online-accounts-common/ipc.h:36:9`!, requestcxx . . $ QVariant#QVariant(3e95df3e31f2cce8).->resultcxx . . $ OnlineAccountsUi/Request#result(87f780dbe64191c4).()); |
| 147 | operation.insertcxx . . $ QMap#insert(929a1ed410fe8423).(OAU_OPERATION_DELAYcxx . . $ `online-accounts-common/ipc.h:37:9`!, requestcxx . . $ QVariant#QVariant(d4f767463ce0a6b3).->delaycxx . . $ OnlineAccountsUi/Request#delay(455f465bc33b4cdf).()); |
| 148 | operation.insertcxx . . $ QMap#insert(929a1ed410fe8423).(OAU_OPERATION_INTERFACEcxx . . $ `online-accounts-common/ipc.h:38:9`!, requestcxx . . $ QVariant#QVariant(3520e46b33348bf6).->interfacecxx . . $ OnlineAccountsUi/Request#interface(6ef7b6c27b00b43d).()); |
| 149 | sendOperationcxx . . $ OnlineAccountsUi/UiServerPrivate#sendOperation(3e95df3e31f2cce8).(operation); |
| 150 | } else { |
| 151 | QVariantMapcxx . . $ QVariantMap# operationcxx . . $ QMap#QMap(ced63f7c635d850d).; |
| 152 | operation.insertcxx . . $ QMap#insert(929a1ed410fe8423).(OAU_OPERATION_CODEcxx . . $ `online-accounts-common/ipc.h:30:9`!, |
| 153 | OAU_OPERATION_CODE_REQUEST_FAILEDcxx . . $ `online-accounts-common/ipc.h:34:9`!); |
| 154 | operation.insertcxx . . $ QMap#insert(929a1ed410fe8423).(OAU_OPERATION_IDcxx . . $ `online-accounts-common/ipc.h:35:9`!, requestcxx . . $ QVariant#QVariant(d4f767463ce0a6b3).->idcxx . . $ OnlineAccountsUi/Request#id(455f465bc33b4cdf).()); |
| 155 | operation.insertcxx . . $ QMap#insert(929a1ed410fe8423).(OAU_OPERATION_INTERFACEcxx . . $ `online-accounts-common/ipc.h:38:9`!, requestcxx . . $ QVariant#QVariant(3520e46b33348bf6).->interfacecxx . . $ OnlineAccountsUi/Request#interface(6ef7b6c27b00b43d).()); |
| 156 | operation.insertcxx . . $ QMap#insert(929a1ed410fe8423).(OAU_OPERATION_ERROR_NAMEcxx . . $ `online-accounts-common/ipc.h:40:9`!, requestcxx . . $ QVariant#QVariant(3520e46b33348bf6).->errorNamecxx . . $ OnlineAccountsUi/Request#errorName(6ef7b6c27b00b43d).()); |
| 157 | operation.insertcxx . . $ QMap#insert(929a1ed410fe8423).(OAU_OPERATION_ERROR_MESSAGEcxx . . $ `online-accounts-common/ipc.h:41:9`!, requestcxx . . $ QVariant#QVariant(3520e46b33348bf6).->errorMessagecxx . . $ OnlineAccountsUi/Request#errorMessage(6ef7b6c27b00b43d).()); |
| 158 | sendOperationcxx . . $ OnlineAccountsUi/UiServerPrivate#sendOperation(3e95df3e31f2cce8).(operation); |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | bool UiServerPrivatecxx . . $ OnlineAccountsUi/UiServerPrivate#::initcxx . . $ OnlineAccountsUi/UiServerPrivate#init(c9857a73d68e59ba).() |
| 163 | { |
| 164 | if (Q_UNLIKELYcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qcompilerdetection.h:247:11`!(!m_socket.waitForConnected())) return false; |
| 165 | |
| 166 | m_ipccxx . . $ OnlineAccountsUi/UiServerPrivate#m_ipc..setChannelscxx . . $ OnlineAccountsUi/Ipc#setChannels(c7a06fe2f8c4cd06).(&m_socketcxx . . $ OnlineAccountsUi/UiServerPrivate#m_socket., &m_socketcxx . . $ OnlineAccountsUi/UiServerPrivate#m_socket.); |
| 167 | return true; |
| 168 | } |
| 169 | |
| 170 | void UiServerPrivatecxx . . $ OnlineAccountsUi/UiServerPrivate#::registerHandlercxx . . $ OnlineAccountsUi/UiServerPrivate#registerHandler(33a36a88f472ca4b).(SignOnUicxx . . $ SignOnUi/::RequestHandlercxx . . $ SignOnUi/RequestHandler# *handler) |
| 171 | { |
| 172 | QVariantMapcxx . . $ QVariantMap# operationcxx . . $ QMap#QMap(ced63f7c635d850d).; |
| 173 | operation.insertcxx . . $ QMap#insert(929a1ed410fe8423).(OAU_OPERATION_CODEcxx . . $ `online-accounts-common/ipc.h:30:9`!, |
| 174 | OAU_OPERATION_CODE_REGISTER_HANDLERcxx . . $ `online-accounts-common/ipc.h:32:9`!); |
| 175 | operation.insertcxx . . $ QMap#insert(929a1ed410fe8423).(OAU_OPERATION_HANDLER_IDcxx . . $ `online-accounts-common/ipc.h:42:9`!, handlercxx . . $ QVariant#QVariant(3520e46b33348bf6).->matchIdcxx . . $ SignOnUi/RequestHandler#matchId(6ef7b6c27b00b43d).()); |
| 176 | sendOperationcxx . . $ OnlineAccountsUi/UiServerPrivate#sendOperation(3e95df3e31f2cce8).(operation); |
| 177 | } |
| 178 | |
| 179 | UiServercxx . . $ OnlineAccountsUi/UiServer#::UiServercxx . . $ OnlineAccountsUi/UiServer#UiServer(6b24f83d17022bd9).(const QStringcxx . . $ QString# &address, QObjectcxx . . $ QObject# *parent): |
| 180 | QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(parent), |
| 181 | d_ptrcxx . . $ OnlineAccountsUi/UiServer#d_ptr.(new UiServerPrivatecxx . . $ OnlineAccountsUi/UiServerPrivate#UiServerPrivate(5c4413f32a6590ed).(address, this)) |
| 182 | { |
| 183 | m_instancecxx . . $ m_instance. = this; |
| 184 | } |
| 185 | |
| 186 | UiServercxx . . $ OnlineAccountsUi/UiServer#::~cxx . . $ OnlineAccountsUi/UiServer#`~UiServer`(ced63f7c635d850d).UiServercxx . . $ OnlineAccountsUi/UiServer#() |
| 187 | { |
| 188 | m_instancecxx . . $ m_instance. = 0; |
| 189 | } |
| 190 | |
| 191 | UiServercxx . . $ OnlineAccountsUi/UiServer# *UiServercxx . . $ OnlineAccountsUi/UiServer#::instancecxx . . $ OnlineAccountsUi/UiServer#instance(11414a558912ab13).() |
| 192 | { |
| 193 | return m_instancecxx . . $ m_instance.; |
| 194 | } |
| 195 | |
| 196 | bool UiServercxx . . $ OnlineAccountsUi/UiServer#::initcxx . . $ OnlineAccountsUi/UiServer#init(c9857a73d68e59ba).() |
| 197 | { |
| 198 | Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(UiServer); |
| 199 | return d->initcxx . . $ OnlineAccountsUi/UiServerPrivate#init(c9857a73d68e59ba).(); |
| 200 | } |
| 201 | |
| 202 | #include "ui-server.moc"cxx . . $ `<file>/build/online-accounts-ui/src/lomiri-online-accounts-ui_autogen/include/ui-server.moc`/ |