mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:27:35 +00:00
Calendar/AddEventDialog: Remove meridiem selection
This removes the meridiem selection in the AddEventDialog of the calendar because it thus far didn't do anything.
This commit is contained in:
parent
18b1f856e5
commit
60174cc9aa
3 changed files with 0 additions and 75 deletions
|
@ -66,10 +66,6 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, EventManager& event_man
|
|||
auto& starting_minute_input = *widget->find_descendant_of_type_named<GUI::SpinBox>("start_minute");
|
||||
starting_minute_input.set_value(m_start_date_time.minute());
|
||||
|
||||
auto& starting_meridiem_input = *widget->find_descendant_of_type_named<GUI::ComboBox>("start_meridiem");
|
||||
starting_meridiem_input.set_model(MeridiemListModel::create());
|
||||
starting_meridiem_input.set_selected_index(0);
|
||||
|
||||
auto& end_date_box = *widget->find_descendant_of_type_named<GUI::TextBox>("end_date");
|
||||
end_date_box.set_text(MUST(m_start_date_time.to_string("%Y-%m-%d"sv)));
|
||||
|
||||
|
@ -88,27 +84,20 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, EventManager& event_man
|
|||
auto& ending_minute_input = *widget->find_descendant_of_type_named<GUI::SpinBox>("end_minute");
|
||||
ending_minute_input.set_value(m_end_date_time.minute());
|
||||
|
||||
auto& ending_meridiem_input = *widget->find_descendant_of_type_named<GUI::ComboBox>("end_meridiem");
|
||||
ending_meridiem_input.set_model(MeridiemListModel::create());
|
||||
ending_meridiem_input.set_selected_index(0);
|
||||
|
||||
auto& ok_button = *widget->find_descendant_of_type_named<GUI::Button>("ok_button");
|
||||
ok_button.on_click = [&](auto) {
|
||||
add_event_to_calendar().release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
done(ExecResult::OK);
|
||||
};
|
||||
|
||||
auto update_starting_input_values = [&, this]() {
|
||||
auto hour = starting_hour_input.value();
|
||||
auto minute = starting_minute_input.value();
|
||||
|
||||
m_start_date_time.set_time_only(hour, minute);
|
||||
};
|
||||
auto update_ending_input_values = [&, this]() {
|
||||
auto hour = ending_hour_input.value();
|
||||
auto minute = ending_minute_input.value();
|
||||
|
||||
m_end_date_time.set_time_only(hour, minute);
|
||||
};
|
||||
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()
|
|||
return {};
|
||||
}
|
||||
|
||||
int AddEventDialog::MeridiemListModel::row_count(const GUI::ModelIndex&) const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
ErrorOr<String> AddEventDialog::MeridiemListModel::column_name(int column) const
|
||||
{
|
||||
switch (column) {
|
||||
case Column::Meridiem:
|
||||
return "Meridiem"_string;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
GUI::Variant AddEventDialog::MeridiemListModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
|
||||
{
|
||||
constexpr Array meridiem_names = {
|
||||
"AM", "PM"
|
||||
};
|
||||
|
||||
auto& meridiem = meridiem_names[index.row()];
|
||||
if (role == GUI::ModelRole::Display) {
|
||||
switch (index.column()) {
|
||||
case Column::Meridiem:
|
||||
return meridiem;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue