mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
Calendar: Ask about unsaved changes when closing the window :^)
The Calendar now asks about unsaved changes in the calendar when attempting to close the window.
This commit is contained in:
parent
75faa9239a
commit
b657fa6f95
3 changed files with 34 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2019-2020, Ryan Grieb <ryan.m.grieb@gmail.com>
|
||||
* Copyright (c) 2023, David Ganz <david.g.ganz@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -67,6 +68,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto calendar_widget = TRY(Calendar::CalendarWidget::create(window));
|
||||
window->set_main_widget(calendar_widget);
|
||||
|
||||
window->on_close_request = [&]() -> GUI::Window::CloseRequestDecision {
|
||||
if (calendar_widget->request_close())
|
||||
return GUI::Window::CloseRequestDecision::Close;
|
||||
return GUI::Window::CloseRequestDecision::StayOpen;
|
||||
};
|
||||
|
||||
window->show();
|
||||
|
||||
if (!filename.is_empty()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue