File indexing completed on 2024-11-24 04:44:03

0001 /*
0002     SPDX-FileCopyrightText: 2016 Daniel Vrátil <dvratil@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "passwordrequesterinterface.h"
0010 
0011 #include <QPointer>
0012 
0013 class ImapResourceBase;
0014 
0015 namespace KGAPI2
0016 {
0017 class AccountPromise;
0018 }
0019 
0020 class GmailPasswordRequester : public PasswordRequesterInterface
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit GmailPasswordRequester(ImapResourceBase *resource, QObject *parent = nullptr);
0025     ~GmailPasswordRequester() override;
0026 
0027     void requestPassword(RequestType request, const QString &serverError) override;
0028     void cancelPasswordRequests() override;
0029 
0030 private:
0031     void onTokenRequestFinished(KGAPI2::AccountPromise *promise);
0032     ImapResourceBase *const mResource;
0033     QPointer<KGAPI2::AccountPromise> mPendingPromise;
0034 };