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 QTimeEdit;
12 : class QPlainTextEdit;
13 : class QPushButton;
14 :
15 : // Sprint 39 – T-531: Dialog for creating and editing calendar events.
16 : // Nextcloud-style QFormLayout with all relevant VEVENT fields.
17 : class EventEditDialog : public QDialog {
18 256 : Q_OBJECT
19 : public:
20 : explicit EventEditDialog(QWidget *parent = nullptr);
21 :
22 : /// Set available calendars (for new event creation, combo box)
23 : void setCalendars(const QList<CalendarInfo> &calendars);
24 :
25 : /// Populate fields from existing event (Edit mode)
26 : void setEvent(const CalendarEvent &event);
27 :
28 : /// Pre-fill date/time for new event (Create mode)
29 : void setNewEventDefaults(const QDate &date,
30 : const QTime &startTime = {},
31 : const QTime &endTime = {});
32 :
33 : /// Return the constructed event (after exec()==Accepted)
34 : CalendarEvent result() const;
35 :
36 : /// True if creating a new event (no existing UID set)
37 2 : bool isNewEvent() const { return m_isNew; }
38 :
39 : private:
40 : void setupUi();
41 : void onAllDayToggled(bool checked);
42 : void setTitleInvalid(bool invalid);
43 :
44 : void changeEvent(QEvent *event) override;
45 : void retranslateUi();
46 :
47 : QLabel *m_headerLabel = nullptr;
48 : QLabel *m_titleLabel = nullptr;
49 : QLabel *m_calendarLabel = nullptr;
50 : QLabel *m_startLabel = nullptr;
51 : QLabel *m_endLabel = nullptr;
52 : QLabel *m_locationLabel = nullptr;
53 : QLabel *m_descriptionLabel = nullptr;
54 : QLabel *m_recurrenceLabel = nullptr;
55 :
56 : QLineEdit *m_titleEdit = nullptr;
57 : QComboBox *m_calendarCombo = nullptr;
58 : QCheckBox *m_allDayCheck = nullptr;
59 : QDateEdit *m_startDate = nullptr;
60 : QTimeEdit *m_startTime = nullptr;
61 : QDateEdit *m_endDate = nullptr;
62 : QTimeEdit *m_endTime = nullptr;
63 : QLineEdit *m_locationEdit = nullptr;
64 : QPlainTextEdit *m_descriptionEdit = nullptr;
65 : QComboBox *m_repeatCombo = nullptr;
66 : QPushButton *m_saveBtn = nullptr;
67 : QPushButton *m_cancelBtn = nullptr;
68 :
69 : CalendarEvent m_originalEvent;
70 : QList<CalendarInfo> m_calendars;
71 : bool m_isNew = true;
72 : };
|