File indexing completed on 2024-12-22 04:45:37

0001 /*
0002    SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QDebug>
0010 #include <QWidget>
0011 
0012 #include "libruqolawidgets_private_export.h"
0013 class QCheckBox;
0014 class QLineEdit;
0015 class LIBRUQOLAWIDGETS_TESTS_EXPORT AdministratorOauthEditWidget : public QWidget
0016 {
0017     Q_OBJECT
0018 public:
0019     struct OauthEditInfo {
0020         QString applicationName;
0021         QString redirectUrl;
0022         QString clientId;
0023         QString clientSecret;
0024         QString authorizationUrl;
0025         QString accessTokenUrl;
0026         bool active = false;
0027         [[nodiscard]] bool isValid() const;
0028     };
0029     explicit AdministratorOauthEditWidget(QWidget *parent = nullptr);
0030     ~AdministratorOauthEditWidget() override;
0031 
0032     [[nodiscard]] OauthEditInfo oauthInfo() const;
0033     void setOauthInfo(const OauthEditInfo &info);
0034 Q_SIGNALS:
0035     void enableOkButton(bool enabled);
0036 
0037 private:
0038     LIBRUQOLAWIDGETS_NO_EXPORT void slotTextChanged();
0039     QCheckBox *const mActiveCheckBox;
0040     QLineEdit *const mApplicationName;
0041     QLineEdit *const mRedirectUrl;
0042     QLineEdit *const mClientId;
0043     QLineEdit *const mClientSecret;
0044     QLineEdit *const mAuthorizationUrl;
0045     QLineEdit *const mAccessTokenUrl;
0046 };
0047 LIBRUQOLAWIDGETS_EXPORT QDebug operator<<(QDebug d, const AdministratorOauthEditWidget::OauthEditInfo &t);
0048 Q_DECLARE_TYPEINFO(AdministratorOauthEditWidget::OauthEditInfo, Q_RELOCATABLE_TYPE);