File indexing completed on 2025-11-02 11:48:32
0001 /* 0002 * SPDX-FileCopyrightText: 2016 Riccardo Iaconelli <riccardo@kde.org> 0003 * SPDX-FileCopyrightText: 2018 Veluri Mithun <velurimithun38@gmail.com> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 * 0007 */ 0008 0009 #pragma once 0010 0011 #include "o2/o0baseauth.h" 0012 #include "o2/o2google.h" 0013 #include <QObject> 0014 0015 class GoogleJob : public QObject 0016 { 0017 Q_OBJECT 0018 0019 public: 0020 explicit GoogleJob(QObject *parent = nullptr); 0021 ~GoogleJob() override; 0022 void getDataFromJson(); 0023 0024 Q_SIGNALS: 0025 void extraTokensReady(const QVariantMap &extraTokens); 0026 void linkingFailed(const QString &msg = QString()); 0027 void linkingSucceeded(); 0028 0029 void loginMethodCalled(const QString &credentialToken, const QString &credentialSecret); 0030 0031 public Q_SLOTS: 0032 void doOAuth(O2::GrantFlow grantFlowType); 0033 void validateToken(); 0034 0035 private: 0036 void onLinkedChanged(); 0037 void onLinkingSucceeded(); 0038 void onOpenBrowser(const QUrl &url); 0039 void onCloseBrowser(); 0040 void onFinished(); 0041 0042 void OAuthLoginMethodParameter(); 0043 O2Google *mO2Google = nullptr; 0044 QString m_clientID; 0045 QString m_clientSecret; 0046 QString m_authUri; 0047 QString m_tokenUri; 0048 QString m_accessToken; 0049 bool m_isValidToken = false; 0050 };