1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/*
* qtmaildir - a Qt6 mail client for notmuch-indexed Maildirs
* Copyright (C) 2026 Danilo M. <danix@danix.xyz>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#pragma once
#include "caltypes.h"
#include <QStackedWidget>
class QCheckBox;
class QComboBox;
class QDateEdit;
class QDateTimeEdit;
class QLabel;
class QLineEdit;
class QPlainTextEdit;
class QPushButton;
class QSpinBox;
/// The calendar window's right-hand pane: a read-only page for the selected
/// event, and the edit form that replaces it (spec decision 11).
///
/// Every value from a file is shown in a Qt::PlainText label: SUMMARY,
/// DESCRIPTION, LOCATION and attendee names come from strangers once
/// invitations arrive, which is MessageDetailsDialog's rule.
class EventPane : public QStackedWidget
{
Q_OBJECT
public:
explicit EventPane(QWidget *parent = nullptr);
void showNothing();
void showDetails(const CalEvent &event, const CalCollection &collection,
const Occurrence &occurrence, bool editable);
/// Opens the form. `collections` are the writable ones, for the Calendar
/// combo; `repeatEditable` is false for a single occurrence, which has no
/// rule of its own; `collectionEditable` is false for the same reason.
void startEdit(const EventEdit &initial, const QList<CalCollection> &collections,
bool repeatEditable, bool collectionEditable,
const QString &reminderText, const QString &attendeesText);
void stopEdit();
bool isEditing() const;
bool isDirty() const;
EventEdit edit() const;
signals:
void editRequested();
void deleteRequested();
void saveRequested();
void cancelRequested();
private:
QWidget *buildDetails();
QWidget *buildForm();
QWidget *buildRepeat();
void setRepeat(const RepeatRule &rule);
RepeatRule repeat() const;
void proposeFromStart();
void refreshRepeatVisibility();
void refreshAllDay();
// Details page.
QLabel *m_title;
QLabel *m_when;
QLabel *m_repeatText;
QLabel *m_calendar;
QLabel *m_location;
QLabel *m_notes;
QLabel *m_reminder;
QLabel *m_people;
QLabel *m_notice;
QPushButton *m_editButton;
QPushButton *m_deleteButton;
// Form.
QLineEdit *m_titleEdit;
QComboBox *m_calendarBox;
QCheckBox *m_allDay;
QDateTimeEdit *m_startEdit;
QDateTimeEdit *m_endEdit;
QLineEdit *m_locationEdit;
QPlainTextEdit *m_notesEdit;
QLabel *m_formReminder;
QLabel *m_formPeople;
QLabel *m_formNotice;
// Repeat control.
QWidget *m_repeatBox;
QComboBox *m_freq; ///< None, Daily, Weekly, Monthly, Yearly, [Custom]
QSpinBox *m_interval;
QWidget *m_weekdayRow;
QList<QCheckBox *> m_weekdays; ///< Monday first, index = Qt::DayOfWeek - 1
QComboBox *m_by; ///< "on day N" / "on the Nth weekday"
QSpinBox *m_monthDay;
QComboBox *m_ordinal; ///< first..fourth, last
QComboBox *m_weekday;
QComboBox *m_month;
QComboBox *m_end; ///< never, on a date, after N times
QDateEdit *m_until;
QSpinBox *m_count;
QLabel *m_customLabel;
EventEdit m_initial;
RepeatRule m_customRule; ///< Kept when the rule read was custom.
QDateTime m_previousStart; ///< For keeping the duration as the start moves.
bool m_editing = false;
};
|