mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 14:07:43 +00:00
TextEditor: Use GUI::MessageBox::ask_about_unsaved_changes()
This commit is contained in:
parent
8e336d3404
commit
c08872f5da
1 changed files with 3 additions and 3 deletions
|
@ -252,7 +252,7 @@ MainWidget::MainWidget()
|
||||||
|
|
||||||
m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) {
|
m_new_action = GUI::Action::create("&New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/new.png").release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) {
|
||||||
if (editor().document().is_modified()) {
|
if (editor().document().is_modified()) {
|
||||||
auto save_document_first_result = GUI::MessageBox::show(window(), "Save changes to current document first?", "Warning", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNoCancel);
|
auto save_document_first_result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path);
|
||||||
if (save_document_first_result == GUI::Dialog::ExecResult::ExecYes)
|
if (save_document_first_result == GUI::Dialog::ExecResult::ExecYes)
|
||||||
m_save_action->activate();
|
m_save_action->activate();
|
||||||
if (save_document_first_result != GUI::Dialog::ExecResult::ExecNo && editor().document().is_modified())
|
if (save_document_first_result != GUI::Dialog::ExecResult::ExecNo && editor().document().is_modified())
|
||||||
|
@ -274,7 +274,7 @@ MainWidget::MainWidget()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editor().document().is_modified()) {
|
if (editor().document().is_modified()) {
|
||||||
auto save_document_first_result = GUI::MessageBox::show(window(), "Save changes to current document first?", "Warning", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNoCancel);
|
auto save_document_first_result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path);
|
||||||
if (save_document_first_result == GUI::Dialog::ExecResult::ExecYes)
|
if (save_document_first_result == GUI::Dialog::ExecResult::ExecYes)
|
||||||
m_save_action->activate();
|
m_save_action->activate();
|
||||||
if (save_document_first_result != GUI::Dialog::ExecResult::ExecNo && editor().document().is_modified())
|
if (save_document_first_result != GUI::Dialog::ExecResult::ExecNo && editor().document().is_modified())
|
||||||
|
@ -719,7 +719,7 @@ bool MainWidget::request_close()
|
||||||
{
|
{
|
||||||
if (!editor().document().is_modified())
|
if (!editor().document().is_modified())
|
||||||
return true;
|
return true;
|
||||||
auto result = GUI::MessageBox::show(window(), "The document has been modified. Would you like to save?", "Unsaved changes", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::YesNoCancel);
|
auto result = GUI::MessageBox::ask_about_unsaved_changes(window(), m_path);
|
||||||
|
|
||||||
if (result == GUI::MessageBox::ExecYes) {
|
if (result == GUI::MessageBox::ExecYes) {
|
||||||
m_save_action->activate();
|
m_save_action->activate();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue