1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:17:34 +00:00

Calendar: Implement saving, loading, and displaying of calendars

The user can now save, load, and view calendars. A calendar is made up
of an array of events which are saved in a JSON file. In the future we
should implement the iCalendar standard instead of using a custom
format.
This commit is contained in:
Monroe Clinton 2023-06-28 19:17:31 -06:00 committed by Andrew Kaster
parent db3e1b128c
commit 1b5b1e4153
17 changed files with 696 additions and 176 deletions

View file

@ -1,30 +1,35 @@
/*
* Copyright (c) 2019-2020, Ryan Grieb <ryan.m.grieb@gmail.com>
* Copyright (c) 2022, the SerenityOS developers.
* Copyright (c) 2022-2023, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "EventManager.h"
#include <LibGUI/Calendar.h>
#include <LibGUI/Dialog.h>
#include <LibGUI/Model.h>
#include <LibGUI/Window.h>
namespace Calendar {
class AddEventDialog final : public GUI::Dialog {
C_OBJECT(AddEventDialog)
public:
virtual ~AddEventDialog() override = default;
static void show(Core::DateTime date_time, Window* parent_window = nullptr)
static void show(Core::DateTime date_time, EventManager& event_manager, Window* parent_window = nullptr)
{
auto dialog = AddEventDialog::construct(date_time, parent_window);
auto dialog = AddEventDialog::construct(date_time, event_manager, parent_window);
dialog->exec();
}
private:
AddEventDialog(Core::DateTime date_time, Window* parent_window = nullptr);
AddEventDialog(Core::DateTime date_time, EventManager& event_manager, Window* parent_window = nullptr);
ErrorOr<void> add_event_to_calendar();
class MonthListModel final : public GUI::Model {
public:
@ -65,4 +70,7 @@ private:
};
Core::DateTime m_date_time;
EventManager& m_event_manager;
};
}