File indexing completed on 2024-12-22 04:56:57
0001 /* 0002 SPDX-FileCopyrightText: 2010 Tobias Koenig <tokoe@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <KDAV/Enums> 0010 0011 #include <QWizard> 0012 #include <QWizardPage> 0013 0014 class KJob; 0015 class QLineEdit; 0016 class QTextBrowser; 0017 0018 class QLabel; 0019 class QButtonGroup; 0020 class QCheckBox; 0021 class QComboBox; 0022 class QFormLayout; 0023 class QRadioButton; 0024 class KPasswordLineEdit; 0025 0026 class SetupWizard : public QWizard 0027 { 0028 Q_OBJECT 0029 0030 public: 0031 explicit SetupWizard(QWidget *parent = nullptr); 0032 0033 enum { 0034 W_CredentialsPage, 0035 W_PredefinedProviderPage, 0036 W_ServerTypePage, 0037 W_ConnectionPage, 0038 W_CheckPage, 0039 }; 0040 0041 class Url 0042 { 0043 public: 0044 using List = QList<Url>; 0045 0046 KDAV::Protocol protocol; 0047 QString url; 0048 QString userName; 0049 QString password; 0050 }; 0051 0052 Url::List urls() const; 0053 QString displayName() const; 0054 }; 0055 0056 class PredefinedProviderPage : public QWizardPage 0057 { 0058 public: 0059 explicit PredefinedProviderPage(QWidget *parent = nullptr); 0060 0061 void initializePage() override; 0062 int nextId() const override; 0063 0064 private: 0065 QLabel *const mLabel; 0066 QButtonGroup *const mProviderGroup; 0067 QRadioButton *const mUseProvider; 0068 QRadioButton *const mDontUseProvider; 0069 }; 0070 0071 class CredentialsPage : public QWizardPage 0072 { 0073 public: 0074 explicit CredentialsPage(QWidget *parent = nullptr); 0075 int nextId() const override; 0076 0077 private: 0078 QLineEdit *const mUserName; 0079 KPasswordLineEdit *const mPassword; 0080 }; 0081 0082 class ServerTypePage : public QWizardPage 0083 { 0084 Q_OBJECT 0085 0086 public: 0087 explicit ServerTypePage(QWidget *parent = nullptr); 0088 0089 bool validatePage() override; 0090 0091 private: 0092 void manualConfigToggled(bool toggled); 0093 QButtonGroup *mServerGroup = nullptr; 0094 QComboBox *mProvidersCombo = nullptr; 0095 }; 0096 0097 class ConnectionPage : public QWizardPage 0098 { 0099 Q_OBJECT 0100 0101 public: 0102 explicit ConnectionPage(QWidget *parent = nullptr); 0103 0104 void initializePage() override; 0105 void cleanupPage() override; 0106 0107 private: 0108 void urlElementChanged(); 0109 QFormLayout *mLayout = nullptr; 0110 QLineEdit *mHost = nullptr; 0111 QLineEdit *mPath = nullptr; 0112 QCheckBox *mUseSecureConnection = nullptr; 0113 QFormLayout *mPreviewLayout = nullptr; 0114 QLabel *mCalDavUrlLabel = nullptr; 0115 QLabel *mCalDavUrlPreview = nullptr; 0116 QLabel *mCardDavUrlLabel = nullptr; 0117 QLabel *mCardDavUrlPreview = nullptr; 0118 QLabel *mGroupDavUrlLabel = nullptr; 0119 QLabel *mGroupDavUrlPreview = nullptr; 0120 }; 0121 0122 class CheckPage : public QWizardPage 0123 { 0124 Q_OBJECT 0125 0126 public: 0127 explicit CheckPage(QWidget *parent = nullptr); 0128 0129 private: 0130 void checkConnection(); 0131 void onFetchDone(KJob *); 0132 QTextBrowser *const mStatusLabel; 0133 };