mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:47:35 +00:00
DisplaySettings: Revert changes unless confirmed
This commit is contained in:
parent
40f7977508
commit
9dfc96f89b
1 changed files with 7 additions and 1 deletions
|
@ -121,12 +121,18 @@ void MonitorSettingsWidget::apply_settings()
|
||||||
});
|
});
|
||||||
|
|
||||||
// If the user selects "No", closes the window or the window gets closed by the 10 seconds timer, revert the changes.
|
// If the user selects "No", closes the window or the window gets closed by the 10 seconds timer, revert the changes.
|
||||||
if (box->exec() != GUI::MessageBox::ExecYes) {
|
if (box->exec() == GUI::MessageBox::ExecYes) {
|
||||||
auto save_result = GUI::WindowServerConnection::the().save_screen_layout();
|
auto save_result = GUI::WindowServerConnection::the().save_screen_layout();
|
||||||
if (!save_result.success()) {
|
if (!save_result.success()) {
|
||||||
GUI::MessageBox::show(window(), String::formatted("Error saving settings: {}", save_result.error_msg()),
|
GUI::MessageBox::show(window(), String::formatted("Error saving settings: {}", save_result.error_msg()),
|
||||||
"Unable to save setting", GUI::MessageBox::Type::Error);
|
"Unable to save setting", GUI::MessageBox::Type::Error);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
auto restore_result = GUI::WindowServerConnection::the().set_screen_layout(current_layout, false);
|
||||||
|
if (!restore_result.success()) {
|
||||||
|
GUI::MessageBox::show(window(), String::formatted("Error restoring settings: {}", restore_result.error_msg()),
|
||||||
|
"Unable to restore setting", GUI::MessageBox::Type::Error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GUI::MessageBox::show(window(), String::formatted("Error setting screen layout: {}", result.error_msg()),
|
GUI::MessageBox::show(window(), String::formatted("Error setting screen layout: {}", result.error_msg()),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue