File indexing completed on 2024-12-01 04:46:45
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 <QWidget> 0010 0011 #include "confirmbeforedeleting_private_export.h" 0012 class QLineEdit; 0013 class QComboBox; 0014 class KMAILCONFIRMBEFOREDELETING_TESTS_EXPORT ConfirmBeforeDeletingCreateRuleWidget : public QWidget 0015 { 0016 Q_OBJECT 0017 public: 0018 struct ConfirmBeforeDeletingInfo { 0019 ConfirmBeforeDeletingInfo(const QString &p, const QString &type) 0020 : pattern(p) 0021 , ruleType(type) 0022 { 0023 } 0024 QString pattern; 0025 QString ruleType; 0026 [[nodiscard]] bool operator==(const ConfirmBeforeDeletingInfo &other) const; 0027 [[nodiscard]] bool operator!=(const ConfirmBeforeDeletingInfo &other) const; 0028 }; 0029 explicit ConfirmBeforeDeletingCreateRuleWidget(QWidget *parent = nullptr); 0030 ~ConfirmBeforeDeletingCreateRuleWidget() override; 0031 [[nodiscard]] ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo info() const; 0032 0033 void setInfo(const ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo &info); 0034 0035 Q_SIGNALS: 0036 void updateOkButton(bool enabled); 0037 0038 private: 0039 void slotRuleTypeChanged(int index); 0040 void fillComboBox(); 0041 QLineEdit *const mPatternLineEdit; 0042 QComboBox *const mRuleTypeComboBox; 0043 };