File indexing completed on 2025-02-02 05:08:36
0001 // SPDX-FileCopyrightText: 2023 Carl Schwan <carl@carlschwan.eu> 0002 // SPDX-License-Identifier: LGPL-2.0-or-later 0003 0004 #pragma once 0005 #include "accountconfigurationimpl.h" 0006 #include "identityimpl.h" 0007 #include "ispdb/configurationmodel.h" 0008 #include "libaccountwizard_export.h" 0009 #include <QObject> 0010 0011 class IdentityImpl; 0012 class IspdbService; 0013 0014 class LIBACCOUNTWIZARD_EXPORT SetupManager : public QObject 0015 { 0016 Q_OBJECT 0017 0018 Q_PROPERTY(QString email READ email WRITE setEmail NOTIFY emailChanged) 0019 Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged) 0020 Q_PROPERTY(QString fullName READ fullName WRITE setFullName NOTIFY fullNameChanged) 0021 Q_PROPERTY(IdentityBase *identity READ identity CONSTANT) 0022 Q_PROPERTY(ConfigurationModel *configurationModel READ configurationModel CONSTANT) 0023 Q_PROPERTY(QString searchIspdbFoundMessage MEMBER mSearchIspdbFoundMessage NOTIFY searchIspdbFoundMessageChanged) 0024 Q_PROPERTY(bool noConfigFound MEMBER mNoConfigFound NOTIFY noConfigFoundChanged) 0025 Q_PROPERTY(AccountConfigurationBase *accountConfiguration READ accountConfiguration CONSTANT) 0026 Q_PROPERTY(QString details READ details NOTIFY detailsChanged) 0027 0028 public: 0029 explicit SetupManager(QObject *parent = nullptr); 0030 ~SetupManager() override; 0031 0032 [[nodiscard]] QString fullName() const; 0033 void setFullName(const QString &fullName); 0034 0035 [[nodiscard]] QString email() const; 0036 void setEmail(const QString &email); 0037 0038 [[nodiscard]] QString password() const; 0039 void setPassword(const QString &password); 0040 0041 IdentityBase *identity() const; 0042 ConfigurationModel *configurationModel() const; 0043 AccountConfigurationBase *accountConfiguration() const; 0044 0045 Q_INVOKABLE void searchConfiguration(); 0046 Q_INVOKABLE void createAutomaticAccount(); 0047 Q_INVOKABLE void createManualAccount(); 0048 0049 [[nodiscard]] QString details() const; 0050 0051 Q_SIGNALS: 0052 void fullNameChanged(); 0053 void emailChanged(); 0054 void passwordChanged(); 0055 void searchIspdbFoundMessageChanged(); 0056 void noConfigFoundChanged(); 0057 void detailsChanged(); 0058 0059 private: 0060 LIBACCOUNTWIZARD_NO_EXPORT void setEmailProvider(const EmailProvider &emailProvider, const QString &messageInfo); 0061 LIBACCOUNTWIZARD_NO_EXPORT void clearConfiguration(); 0062 LIBACCOUNTWIZARD_NO_EXPORT void noConfigFound(); 0063 LIBACCOUNTWIZARD_NO_EXPORT void slotError(const QString &str); 0064 LIBACCOUNTWIZARD_NO_EXPORT void slotFinished(const QString &str); 0065 LIBACCOUNTWIZARD_NO_EXPORT void slotInfo(const QString &str); 0066 QString mPassword; 0067 QString mSearchIspdbFoundMessage; 0068 QString mDetails; 0069 IdentityImpl *const mIdentity; 0070 IspdbService *const mIspdbService; 0071 ConfigurationModel *const mConfigurationModel; 0072 AccountConfigurationImpl *const mAccountConfigurationImpl; 0073 bool mNoConfigFound = false; 0074 bool mAccountCreated = false; 0075 };