File indexing completed on 2024-12-29 04:54:40
0001 /* 0002 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 #pragma once 0007 0008 #include "ksieveui_private_export.h" 0009 #include <QWidget> 0010 0011 class QComboBox; 0012 class QLineEdit; 0013 class QStackedWidget; 0014 class KDateComboBox; 0015 class KTimeComboBox; 0016 namespace KSieveUi 0017 { 0018 class SieveDateSpinBox; 0019 class KSIEVEUI_TESTS_EXPORT SelectDateWidget : public QWidget 0020 { 0021 Q_OBJECT 0022 public: 0023 enum DateType { Year = 0, Month, Day, Date, Julian, Hour, Minute, Second, Time, Iso8601, Std11, Zone, Weekday }; 0024 explicit SelectDateWidget(QWidget *parent = nullptr); 0025 ~SelectDateWidget() override; 0026 0027 [[nodiscard]] QString code() const; 0028 void setCode(const QString &type, const QString &value); 0029 0030 Q_SIGNALS: 0031 void valueChanged(); 0032 0033 private: 0034 void slotDateTypeActivated(int); 0035 SelectDateWidget::DateType dateTypeFromString(const QString &str); 0036 void initialize(); 0037 QString dateType(DateType type) const; 0038 QString dateValue(DateType type) const; 0039 QComboBox *mDateType = nullptr; 0040 QLineEdit *mDateLineEdit = nullptr; 0041 SieveDateSpinBox *mDateValue = nullptr; 0042 KDateComboBox *mDateEdit = nullptr; 0043 KTimeComboBox *mTimeEdit = nullptr; 0044 QStackedWidget *mStackWidget = nullptr; 0045 }; 0046 } 0047 Q_DECLARE_METATYPE(KSieveUi::SelectDateWidget::DateType)