mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 20:45:14 +00:00
TextEditor: Ask before opening a file if current document is dirty
This commit should be a fix of issue #892
This commit is contained in:
parent
aa0ee0e407
commit
e2dcf27a2e
Notes:
sideshowbarker
2024-07-19 10:46:51 +09:00
Author: https://github.com/Mcpg Commit: https://github.com/SerenityOS/serenity/commit/e2dcf27a2e3 Pull-request: https://github.com/SerenityOS/serenity/pull/893
1 changed files with 8 additions and 0 deletions
|
@ -153,6 +153,14 @@ TextEditorWidget::TextEditorWidget()
|
|||
if (!open_path.has_value())
|
||||
return;
|
||||
|
||||
if (m_document_dirty) {
|
||||
auto save_document_first_box = GMessageBox::construct("Save Document First?", "Warning", GMessageBox::Type::Warning, GMessageBox::InputType::OKCancel, window());
|
||||
auto save_document_first_result = save_document_first_box->exec();
|
||||
|
||||
if (save_document_first_result == GDialog::ExecResult::ExecOK)
|
||||
m_save_action->activate();
|
||||
}
|
||||
|
||||
open_sesame(open_path.value());
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue