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 class QLabel;
0010 class QProgressBar;
0011 #include <QProgressBar>
0012 #include <QWizard>
0013 #include <QWizardPage>
0014 
0015 #include "etesyncclientstate.h"
0016 
0017 class QLineEdit;
0018 class QCheckBox;
0019 class KPasswordLineEdit;
0020 
0021 class SetupWizard : public QWizard
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     explicit SetupWizard(EteSyncClientState *clientState, QWidget *parent = nullptr);
0027 
0028     enum {
0029         W_LoginPage,
0030     };
0031 
0032     EteSyncClientState *mClientState = nullptr;
0033 
0034 public Q_SLOTS:
0035     void manualNext();
0036 };
0037 
0038 class LoginPage : public QWizardPage
0039 {
0040 public:
0041     explicit LoginPage(QWidget *parent = nullptr);
0042     int nextId() const override;
0043     void initializePage() override;
0044     bool validatePage() override;
0045 
0046     void showProgressBar()
0047     {
0048         mProgressBar->setVisible(true);
0049     }
0050 
0051     void hideProgressBar()
0052     {
0053         mProgressBar->setVisible(false);
0054     }
0055 
0056     void setLoginResult(bool loginResult)
0057     {
0058         mLoginResult = loginResult;
0059     }
0060 
0061     void setAccountStatusResult(bool accountStatusResult)
0062     {
0063         mAccountStatusResult = accountStatusResult;
0064     }
0065 
0066     void setErrorCode(int errorCode)
0067     {
0068         mErrorCode = errorCode;
0069     }
0070 
0071     void setErrorMessage(QString errorMessage)
0072     {
0073         mErrorMessage = errorMessage;
0074     }
0075 
0076 private:
0077     QLineEdit *mUserName = nullptr;
0078     KPasswordLineEdit *mPassword = nullptr;
0079     QCheckBox *mAdvancedSettings = nullptr;
0080     QLineEdit *mServerUrl = nullptr;
0081     QLabel *mLoginLabel = nullptr;
0082     QLabel *mPasswordInfo = nullptr;
0083     QProgressBar *mProgressBar;
0084     bool mIsInitialized = false;
0085     bool mLoginResult = false;
0086     bool mAccountStatusResult = false;
0087     int mErrorCode;
0088     QString mErrorMessage;
0089 };