1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:07:45 +00:00

Calendar: Add ability to view events

This commit is contained in:
Sanil 2024-02-04 17:46:11 +05:30 committed by Andrew Kaster
parent 0d41f6cf89
commit 433fe3dc26
7 changed files with 179 additions and 1 deletions

View file

@ -7,6 +7,7 @@
#include "CalendarWidget.h"
#include "AddEventDialog.h"
#include "ViewEventDialog.h"
#include <AK/JsonParser.h>
#include <AK/LexicalPath.h>
#include <LibConfig/Client.h>
@ -298,8 +299,17 @@ ErrorOr<NonnullRefPtr<GUI::Action>> CalendarWidget::create_open_settings_action(
void CalendarWidget::create_on_tile_doubleclick()
{
m_event_calendar->on_tile_doubleclick = [&] {
for (const auto& event : m_event_calendar->event_manager().events()) {
auto start = event.start;
auto selected_date = m_event_calendar->selected_date();
if (start.year() == selected_date.year() && start.month() == selected_date.month() && start.day() == selected_date.day()) {
ViewEventDialog::show(selected_date, m_event_calendar->event_manager(), window());
return;
}
}
AddEventDialog::show(m_event_calendar->selected_date(), m_event_calendar->event_manager(), window());
};
}
}