Skip to content

Commit 60174cc

Browse files
david072ADKaster
authored andcommitted
Calendar/AddEventDialog: Remove meridiem selection
This removes the meridiem selection in the AddEventDialog of the calendar because it thus far didn't do anything.
1 parent 18b1f85 commit 60174cc

File tree

3 files changed

+0
-75
lines changed

3 files changed

+0
-75
lines changed

Userland/Applications/Calendar/AddEventDialog.cpp

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, EventManager& event_man
6666
auto& starting_minute_input = *widget->find_descendant_of_type_named<GUI::SpinBox>("start_minute");
6767
starting_minute_input.set_value(m_start_date_time.minute());
6868

69-
auto& starting_meridiem_input = *widget->find_descendant_of_type_named<GUI::ComboBox>("start_meridiem");
70-
starting_meridiem_input.set_model(MeridiemListModel::create());
71-
starting_meridiem_input.set_selected_index(0);
72-
7369
auto& end_date_box = *widget->find_descendant_of_type_named<GUI::TextBox>("end_date");
7470
end_date_box.set_text(MUST(m_start_date_time.to_string("%Y-%m-%d"sv)));
7571

@@ -88,27 +84,20 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, EventManager& event_man
8884
auto& ending_minute_input = *widget->find_descendant_of_type_named<GUI::SpinBox>("end_minute");
8985
ending_minute_input.set_value(m_end_date_time.minute());
9086

91-
auto& ending_meridiem_input = *widget->find_descendant_of_type_named<GUI::ComboBox>("end_meridiem");
92-
ending_meridiem_input.set_model(MeridiemListModel::create());
93-
ending_meridiem_input.set_selected_index(0);
94-
9587
auto& ok_button = *widget->find_descendant_of_type_named<GUI::Button>("ok_button");
9688
ok_button.on_click = [&](auto) {
9789
add_event_to_calendar().release_value_but_fixme_should_propagate_errors();
98-
9990
done(ExecResult::OK);
10091
};
10192

10293
auto update_starting_input_values = [&, this]() {
10394
auto hour = starting_hour_input.value();
10495
auto minute = starting_minute_input.value();
105-
10696
m_start_date_time.set_time_only(hour, minute);
10797
};
10898
auto update_ending_input_values = [&, this]() {
10999
auto hour = ending_hour_input.value();
110100
auto minute = ending_minute_input.value();
111-
112101
m_end_date_time.set_time_only(hour, minute);
113102
};
114103
starting_hour_input.on_change = [update_starting_input_values](auto) { update_starting_input_values(); };
@@ -144,37 +133,4 @@ ErrorOr<void> AddEventDialog::add_event_to_calendar()
144133
return {};
145134
}
146135

147-
int AddEventDialog::MeridiemListModel::row_count(const GUI::ModelIndex&) const
148-
{
149-
return 2;
150-
}
151-
152-
ErrorOr<String> AddEventDialog::MeridiemListModel::column_name(int column) const
153-
{
154-
switch (column) {
155-
case Column::Meridiem:
156-
return "Meridiem"_string;
157-
default:
158-
VERIFY_NOT_REACHED();
159-
}
160-
}
161-
162-
GUI::Variant AddEventDialog::MeridiemListModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
163-
{
164-
constexpr Array meridiem_names = {
165-
"AM", "PM"
166-
};
167-
168-
auto& meridiem = meridiem_names[index.row()];
169-
if (role == GUI::ModelRole::Display) {
170-
switch (index.column()) {
171-
case Column::Meridiem:
172-
return meridiem;
173-
default:
174-
VERIFY_NOT_REACHED();
175-
}
176-
}
177-
return {};
178-
}
179-
180136
}

Userland/Applications/Calendar/AddEventDialog.gml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@
6060
min: 1
6161
max: 59
6262
}
63-
64-
@GUI::ComboBox {
65-
name: "start_meridiem"
66-
model_only: true
67-
fixed_size: [55, 20]
68-
}
6963
}
7064

7165
@GUI::Widget {
@@ -106,12 +100,6 @@
106100
min: 1
107101
max: 59
108102
}
109-
110-
@GUI::ComboBox {
111-
name: "end_meridiem"
112-
model_only: true
113-
fixed_size: [55, 20]
114-
}
115103
}
116104

117105
@GUI::Layout::Spacer {}

Userland/Applications/Calendar/AddEventDialog.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,6 @@ class AddEventDialog final : public GUI::Dialog {
3131

3232
ErrorOr<void> add_event_to_calendar();
3333

34-
class MeridiemListModel final : public GUI::Model {
35-
public:
36-
enum Column {
37-
Meridiem,
38-
__Count,
39-
};
40-
41-
static NonnullRefPtr<MeridiemListModel> create() { return adopt_ref(*new MeridiemListModel); }
42-
virtual ~MeridiemListModel() override = default;
43-
44-
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
45-
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; }
46-
virtual ErrorOr<String> column_name(int) const override;
47-
virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override;
48-
49-
private:
50-
MeridiemListModel() = default;
51-
};
52-
5334
Core::DateTime m_start_date_time;
5435
Core::DateTime m_end_date_time;
5536
EventManager& m_event_manager;

0 commit comments

Comments
 (0)