File indexing completed on 2024-06-16 04:42:41
0001 /* 0002 SPDX-FileCopyrightText: 2018-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "googleauthenticationinterface.h" 0008 #include "ddpapi/ddpclient.h" 0009 #include "googleauthenticationplugin_debug.h" 0010 #include "googlejob.h" 0011 #include "rocketchataccount.h" 0012 0013 GoogleAuthenticationInterface::GoogleAuthenticationInterface(QObject *parent) 0014 : PluginAuthenticationInterface(parent) 0015 { 0016 } 0017 0018 GoogleAuthenticationInterface::~GoogleAuthenticationInterface() 0019 { 0020 } 0021 0022 void GoogleAuthenticationInterface::login() 0023 { 0024 GoogleJob *api = new GoogleJob(this); 0025 api->doOAuth(O2::GrantFlowAuthorizationCode); 0026 0027 // When this signal is emitted from google.cpp it means it has called the login 'method' 0028 // by sending credentialToken and credentialSecret 0029 connect(api, &GoogleJob::loginMethodCalled, this, &GoogleAuthenticationInterface::slotLoginProvider); 0030 connect(api, &GoogleJob::linkingFailed, this, &GoogleAuthenticationInterface::loginFailed); 0031 } 0032 0033 void GoogleAuthenticationInterface::slotLoginProvider(const QString &credentialToken, const QString &credentialSecret) 0034 { 0035 mAccount->ddp()->authenticationManager()->loginOAuth(credentialToken, credentialSecret); 0036 } 0037 0038 #include "moc_googleauthenticationinterface.cpp"