| 1 | /* |
| 2 | * This file is part of libOnlineAccounts |
| 3 | * |
| 4 | * Copyright (C) 2015 Canonical Ltd. |
| 5 | * |
| 6 | * Contact: Alberto Mardegan <[email protected]> |
| 7 | * |
| 8 | * This program is free software: you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU Lesser General Public License version 3, as |
| 10 | * published 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 Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public License |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "manager_p.h"cxx . . $ `<file>/online-accounts/lib/qt/LomiriOnlineAccounts/manager_p.h`/ |
| 22 | |
| 23 | #include <QDBusMessage> |
| 24 | #include <QDBusPendingCallWatcher> |
| 25 | #include <QDebug> |
| 26 | #include "pending_call_p.h"cxx . . $ `<file>/online-accounts/lib/qt/LomiriOnlineAccounts/pending_call_p.h`/ |
| 27 | |
| 28 | using namespace OnlineAccounts; |
| 29 | |
| 30 | namespace OnlineAccountscxx . . $ OnlineAccounts/ { |
| 31 | |
| 32 | class RequestAccessReplyPrivatecxx . . $ OnlineAccounts/RequestAccessReplyPrivate# |
| 33 | { |
| 34 | public: |
| 35 | inline RequestAccessReplyPrivatecxx . . $ OnlineAccounts/RequestAccessReplyPrivate#RequestAccessReplyPrivate(8feb05cfa3fd417d).(const PendingCallcxx . . $ OnlineAccounts/PendingCall# &call); |
| 36 | virtual ~cxx . . $ OnlineAccounts/RequestAccessReplyPrivate#`~RequestAccessReplyPrivate`(ced63f7c635d850d).RequestAccessReplyPrivatecxx . . $ OnlineAccounts/RequestAccessReplyPrivate#() {} |
| 37 | |
| 38 | Accountcxx . . $ OnlineAccounts/Account# *accountcxx . . $ OnlineAccounts/RequestAccessReplyPrivate#account(1a34c49ae0727a36).(); |
| 39 | |
| 40 | private: |
| 41 | friend class RequestAccessReplycxx . . $ OnlineAccounts/RequestAccessReply#; |
| 42 | PendingCallcxx . . $ OnlineAccounts/PendingCall# m_pendingCallcxx . . $ OnlineAccounts/RequestAccessReplyPrivate#m_pendingCall.; |
| 43 | AccountInfocxx . . $ OnlineAccounts/AccountInfo# m_accountInfocxx . . $ OnlineAccounts/RequestAccessReplyPrivate#m_accountInfo.; |
| 44 | Errorcxx . . $ OnlineAccounts/Error# m_errorcxx . . $ OnlineAccounts/RequestAccessReplyPrivate#m_error.; |
| 45 | }; |
| 46 | |
| 47 | } // namespace |
| 48 | |
| 49 | RequestAccessReplyPrivatecxx . . $ OnlineAccounts/RequestAccessReplyPrivate#::RequestAccessReplyPrivatecxx . . $ OnlineAccounts/RequestAccessReplyPrivate#RequestAccessReplyPrivate(8feb05cfa3fd417d).(const PendingCallcxx . . $ OnlineAccounts/PendingCall# &call): |
| 50 | m_pendingCallcxx . . $ OnlineAccounts/RequestAccessReplyPrivate#m_pendingCall.(call) |
| 51 | { |
| 52 | const PendingCallPrivatecxx . . $ OnlineAccounts/PendingCallPrivate# *pCall = call.dcxx . . $ OnlineAccounts/PendingCall#d..constDatacxx . . $ QExplicitlySharedDataPointer#constData(1016ee5406d91ab9).(); |
| 53 | |
| 54 | if (!m_pendingCallcxx . . $ OnlineAccounts/RequestAccessReplyPrivate#m_pendingCall..isFinishedcxx . . $ OnlineAccounts/PendingCall#isFinished(50ce9a9e25b4a850).()) { |
| 55 | m_pendingCallcxx . . $ OnlineAccounts/RequestAccessReplyPrivate#m_pendingCall..waitForFinishedcxx . . $ OnlineAccounts/PendingCall#waitForFinished(49f6e7a06ebc5aa8).(); |
| 56 | } |
| 57 | |
| 58 | if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(pCall->dbusCall().isError())) { |
| 59 | /* Treat all errors as permission denied. */ |
| 60 | qCWarningcxx . . $ `<external>/13903568758641964362/qloggingcategory.h:138:11`!(DBG_ONLINE_ACCOUNTS) <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Error:" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). |
| 61 | pCall->dbusCallcxx . . $ OnlineAccounts/PendingCallPrivate#dbusCall(431f9381b17f3acb).().errorcxx . . $ QDBusPendingCall#error(1d9100e4f448fa26).().messagecxx . . $ QDBusError#message(6ef7b6c27b00b43d).(); |
| 62 | m_errorcxx . . $ OnlineAccounts/RequestAccessReplyPrivate#m_error. =cxx . . $ OnlineAccounts/Error#`operator=`(58d5d5f36b50bafd). Errorcxx . . $ OnlineAccounts/Error#Error(87f22122582033ec).(Errorcxx . . $ OnlineAccounts/Error#::PermissionDeniedcxx . . $ OnlineAccounts/Error#PermissionDenied., |
| 63 | pCall->dbusCallcxx . . $ OnlineAccounts/PendingCallPrivate#dbusCall(431f9381b17f3acb).().errorcxx . . $ QDBusPendingCall#error(1d9100e4f448fa26).().messagecxx . . $ QDBusError#message(6ef7b6c27b00b43d).()); |
| 64 | return; |
| 65 | } |
| 66 | |
| 67 | PendingCallPrivatecxx . . $ OnlineAccounts/PendingCallPrivate#::InvokedMethodcxx . . $ OnlineAccounts/PendingCallPrivate#InvokedMethod# invokedMethod = pCall->invokedMethodcxx . . $ OnlineAccounts/PendingCallPrivate#invokedMethod(a18a7d14e28e6b77).(); |
| 68 | if (Q_UNLIKELYcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:247:11`!(invokedMethod != PendingCallPrivate::RequestAccess)) { |
| 69 | qFatalcxx . . $ `<external>/10450329605257866924/qlogging.h:168:9`!("Wrong invoked method %d", invokedMethod); |
| 70 | } |
| 71 | QDBusPendingReplycxx . . $ QDBusPendingReply#<AccountInfocxx . . $ OnlineAccounts/AccountInfo#,QVariantMapcxx . . $ QVariantMap#> replycxx . . $ QDBusPendingReply#QDBusPendingReply(8091e1e063dfdcb5).(pCall->dbusCallcxx . . $ OnlineAccounts/PendingCallPrivate#dbusCall(431f9381b17f3acb).()); |
| 72 | m_accountInfocxx . . $ OnlineAccounts/RequestAccessReplyPrivate#m_accountInfo. =cxx . . $ OnlineAccounts/AccountInfo#`operator=`(913117e86a44c50e). reply.argumentAtcxx . . $ QDBusPendingReply#argumentAt(62358942da73f454).<0>(); |
| 73 | } |
| 74 | |
| 75 | Accountcxx . . $ OnlineAccounts/Account# *RequestAccessReplyPrivatecxx . . $ OnlineAccounts/RequestAccessReplyPrivate#::accountcxx . . $ OnlineAccounts/RequestAccessReplyPrivate#account(1a34c49ae0727a36).() |
| 76 | { |
| 77 | ManagerPrivatecxx . . $ OnlineAccounts/ManagerPrivate# *managerPriv = m_pendingCallcxx . . $ OnlineAccounts/RequestAccessReplyPrivate#m_pendingCall..dcxx . . $ OnlineAccounts/PendingCall#d.->cxx . . $ QExplicitlySharedDataPointer#`operator->`(155dc7f103cdb9db).managercxx . . $ OnlineAccounts/PendingCallPrivate#manager(ef04733e7f789dc1).()->d_ptrcxx . . $ OnlineAccounts/Manager#d_ptr.; |
| 78 | return managerPriv->ensureAccountcxx . . $ OnlineAccounts/ManagerPrivate#ensureAccount(b284754f008b4f89).(m_accountInfocxx . . $ OnlineAccounts/RequestAccessReplyPrivate#m_accountInfo.); |
| 79 | } |
| 80 | |
| 81 | RequestAccessReplycxx . . $ OnlineAccounts/RequestAccessReply#::RequestAccessReplycxx . . $ OnlineAccounts/RequestAccessReply#RequestAccessReply(8feb05cfa3fd417d).(const PendingCallcxx . . $ OnlineAccounts/PendingCall# &call): |
| 82 | d_ptrcxx . . $ OnlineAccounts/RequestAccessReply#d_ptr.(new RequestAccessReplyPrivatecxx . . $ OnlineAccounts/RequestAccessReplyPrivate#RequestAccessReplyPrivate(8feb05cfa3fd417d).(call)) |
| 83 | { |
| 84 | } |
| 85 | |
| 86 | RequestAccessReplycxx . . $ OnlineAccounts/RequestAccessReply#::~cxx . . $ OnlineAccounts/RequestAccessReply#`~RequestAccessReply`(ced63f7c635d850d).RequestAccessReplycxx . . $ OnlineAccounts/RequestAccessReply#() |
| 87 | { |
| 88 | delete d_ptrcxx . . $ OnlineAccounts/RequestAccessReply#d_ptr.; |
| 89 | } |
| 90 | |
| 91 | Errorcxx . . $ OnlineAccounts/Error# RequestAccessReplycxx . . $ OnlineAccounts/RequestAccessReply#::errorcxx . . $ OnlineAccounts/RequestAccessReply#error(b1aaa45c8f119b6a).() const |
| 92 | { |
| 93 | Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const RequestAccessReply); |
| 94 | return d->m_errorcxx . . $ OnlineAccounts/RequestAccessReplyPrivate#m_error.; |
| 95 | } |
| 96 | |
| 97 | Accountcxx . . $ OnlineAccounts/Account# *RequestAccessReplycxx . . $ OnlineAccounts/RequestAccessReply#::accountcxx . . $ OnlineAccounts/RequestAccessReply#account(1a34c49ae0727a36).() |
| 98 | { |
| 99 | Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(RequestAccessReply); |
| 100 | return d->accountcxx . . $ OnlineAccounts/RequestAccessReplyPrivate#account(1a34c49ae0727a36).(); |
| 101 | } |