diff --git a/Userland/Applications/Calendar/AddEventDialog.cpp b/Userland/Applications/Calendar/AddEventDialog.cpp index c099122e69..dbd144fc1c 100644 --- a/Userland/Applications/Calendar/AddEventDialog.cpp +++ b/Userland/Applications/Calendar/AddEventDialog.cpp @@ -66,10 +66,6 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, EventManager& event_man auto& starting_minute_input = *widget->find_descendant_of_type_named("start_minute"); starting_minute_input.set_value(m_start_date_time.minute()); - auto& starting_meridiem_input = *widget->find_descendant_of_type_named("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("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("end_minute"); ending_minute_input.set_value(m_end_date_time.minute()); - auto& ending_meridiem_input = *widget->find_descendant_of_type_named("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("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 AddEventDialog::add_event_to_calendar() return {}; } -int AddEventDialog::MeridiemListModel::row_count(const GUI::ModelIndex&) const -{ - return 2; -} - -ErrorOr 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 {}; -} - } diff --git a/Userland/Applications/Calendar/AddEventDialog.gml b/Userland/Applications/Calendar/AddEventDialog.gml index 0f560aaa29..9cbe0fe01d 100644 --- a/Userland/Applications/Calendar/AddEventDialog.gml +++ b/Userland/Applications/Calendar/AddEventDialog.gml @@ -60,12 +60,6 @@ min: 1 max: 59 } - - @GUI::ComboBox { - name: "start_meridiem" - model_only: true - fixed_size: [55, 20] - } } @GUI::Widget { @@ -106,12 +100,6 @@ min: 1 max: 59 } - - @GUI::ComboBox { - name: "end_meridiem" - model_only: true - fixed_size: [55, 20] - } } @GUI::Layout::Spacer {} diff --git a/Userland/Applications/Calendar/AddEventDialog.h b/Userland/Applications/Calendar/AddEventDialog.h index 52871097e1..0240a1b29f 100644 --- a/Userland/Applications/Calendar/AddEventDialog.h +++ b/Userland/Applications/Calendar/AddEventDialog.h @@ -31,25 +31,6 @@ private: ErrorOr add_event_to_calendar(); - class MeridiemListModel final : public GUI::Model { - public: - enum Column { - Meridiem, - __Count, - }; - - static NonnullRefPtr create() { return adopt_ref(*new MeridiemListModel); } - virtual ~MeridiemListModel() override = default; - - virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; - virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual ErrorOr column_name(int) const override; - virtual GUI::Variant data(const GUI::ModelIndex&, GUI::ModelRole) const override; - - private: - MeridiemListModel() = default; - }; - Core::DateTime m_start_date_time; Core::DateTime m_end_date_time; EventManager& m_event_manager;