File indexing completed on 2024-11-24 04:43:42

0001 /*
0002  * SPDX-FileCopyrightText: 2020 Shashwat Jolly <shashwat.jolly@gmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include <KJob>
0010 
0011 #include "etebaseadapter.h"
0012 #include "etesyncclientstate.h"
0013 
0014 namespace EteSyncAPI
0015 {
0016 class LoginJob : public KJob
0017 {
0018     Q_OBJECT
0019 
0020 public:
0021     explicit LoginJob(EteSyncClientState *clientState, const QString &serverUrl, const QString &username, const QString &password, QObject *parent = nullptr);
0022 
0023     void start() override;
0024 
0025     bool getLoginResult() const
0026     {
0027         return mLoginResult;
0028     }
0029 
0030     bool getAccountStatusResult() const
0031     {
0032         return mAccountStatusResult;
0033     }
0034 
0035 private:
0036     void login();
0037     void createDefaultCollection(const QString &collectionType, const QString &collectionName);
0038 
0039     EteSyncClientState *mClientState = nullptr;
0040     QString mServerUrl;
0041     QString mUsername;
0042     QString mPassword;
0043     bool mLoginResult;
0044     bool mAccountStatusResult = false;
0045     bool mUserInfoResult;
0046 };
0047 } // namespace EteSyncAPI