File indexing completed on 2024-12-22 04:45:38
0001 /* 0002 SPDX-FileCopyrightText: 2021-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 QLineEdit; 0014 class QCheckBox; 0015 class RoleScopeComboBox; 0016 class LIBRUQOLAWIDGETS_TESTS_EXPORT RoleEditWidget : public QWidget 0017 { 0018 Q_OBJECT 0019 public: 0020 struct RoleEditDialogInfo { 0021 QString mName; 0022 QString mDescription; 0023 QString mScope; 0024 bool mTwoFactor = false; 0025 bool mIsProtected = false; 0026 [[nodiscard]] bool isValid() const 0027 { 0028 return !mName.isEmpty(); 0029 } 0030 [[nodiscard]] bool operator==(const RoleEditDialogInfo &other) const; 0031 [[nodiscard]] bool operator!=(const RoleEditDialogInfo &other) const 0032 { 0033 return !operator==(other); 0034 } 0035 }; 0036 0037 explicit RoleEditWidget(QWidget *parent = nullptr); 0038 ~RoleEditWidget() override; 0039 0040 void setRoleEditDialogInfo(const RoleEditDialogInfo &info); 0041 [[nodiscard]] RoleEditDialogInfo roleEditDialogInfo() const; 0042 0043 Q_SIGNALS: 0044 void updateOkButton(bool enabled); 0045 0046 private: 0047 QLineEdit *const mName; 0048 QLineEdit *const mDescription; 0049 QCheckBox *const mTwoFactor; 0050 RoleScopeComboBox *const mRoleScopeComboBox; 0051 }; 0052 LIBRUQOLAWIDGETS_EXPORT QDebug operator<<(QDebug d, const RoleEditWidget::RoleEditDialogInfo &t);