Line data Source code
1 : #pragma once
2 :
3 : #include <QDialog>
4 : #include "data/CalendarModels.h"
5 :
6 : class QLabel;
7 : class QLineEdit;
8 : class QComboBox;
9 : class QCheckBox;
10 : class QDateEdit;
11 : class QTextEdit;
12 : class QPushButton;
13 :
14 : // Sprint 39 – T-536: Dialog for creating and editing tasks.
15 : class TaskEditDialog : public QDialog {
16 94 : Q_OBJECT
17 : public:
18 : explicit TaskEditDialog(QWidget *parent = nullptr);
19 :
20 : /// Set available calendars
21 : void setCalendars(const QList<CalendarInfo> &calendars);
22 :
23 : /// Populate fields from existing task (Edit mode)
24 : void setTask(const CalendarTask &task);
25 :
26 : /// Return the constructed task
27 : CalendarTask result() const;
28 :
29 : /// True if creating a new task
30 2 : bool isNewTask() const { return m_isNew; }
31 :
32 : /// True if the calendar was changed in edit mode (Sprint 56)
33 0 : bool calendarChanged() const { return m_calendarChanged; }
34 :
35 : private:
36 : void setupUi();
37 :
38 : void changeEvent(QEvent *event) override;
39 : void retranslateUi();
40 :
41 : QLabel *m_titleLabel = nullptr;
42 : QLabel *m_calendarLabel = nullptr;
43 : QLabel *m_dueLabel = nullptr;
44 : QLabel *m_priorityLabel = nullptr;
45 : QLabel *m_descriptionLabel = nullptr;
46 :
47 : QLineEdit *m_titleEdit = nullptr;
48 : QComboBox *m_calendarCombo = nullptr;
49 : QCheckBox *m_dueEnabled = nullptr;
50 : QDateEdit *m_dueDate = nullptr;
51 : QComboBox *m_priorityCombo = nullptr;
52 : QTextEdit *m_descEdit = nullptr;
53 : QPushButton *m_saveBtn = nullptr;
54 : QPushButton *m_cancelBtn = nullptr;
55 : QLabel *m_headerLabel = nullptr;
56 :
57 : CalendarTask m_originalTask;
58 : QList<CalendarInfo> m_calendars;
59 : bool m_isNew = true;
60 : bool m_calendarChanged = false;
61 : };
|