1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

TextEditor: Ask the user before closing a dirty (modified) document

It's a little unfortunate that we have two separate code paths that can
lead to asking the user about this. Longer-term we should find a way to
unify these things.

Fixes #491.
This commit is contained in:
Andreas Kling 2019-08-27 20:37:41 +02:00
parent c4b1456c88
commit b1763238d7
3 changed files with 19 additions and 4 deletions

View file

@ -12,6 +12,12 @@ int main(int argc, char** argv)
auto* text_widget = new TextEditorWidget();
window->set_main_widget(text_widget);
window->on_close_request = [&]() -> GWindow::CloseRequestDecision {
if (text_widget->request_close())
return GWindow::CloseRequestDecision::Close;
return GWindow::CloseRequestDecision::StayOpen;
};
if (argc >= 2)
text_widget->open_sesame(argv[1]);