1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-05 13:17:36 +00:00

LibGUI: Add input types to GMessageBox.

Currently the two available input types are:

- GMessageBox::InputType::OK (default)
- GMessageBox::InputType::OKCancel

Based on your choice, GMessageBox::exec() will return ExecOK or ExecCancel.
This commit is contained in:
Andreas Kling 2019-07-16 21:32:10 +02:00
parent 62335c5f0c
commit a17fbd98e7
8 changed files with 63 additions and 26 deletions

View file

@ -294,7 +294,7 @@ void VBForm::load_from_file(const String& path)
{
CFile file(path);
if (!file.open(CIODevice::ReadOnly)) {
GMessageBox::show(String::format("Could not open '%s' for reading", path.characters()), "Error", GMessageBox::Type::Error, window());
GMessageBox::show(String::format("Could not open '%s' for reading", path.characters()), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window());
return;
}
@ -302,7 +302,7 @@ void VBForm::load_from_file(const String& path)
auto form_json = JsonValue::from_string(file_contents);
if (!form_json.is_object()) {
GMessageBox::show(String::format("Could not parse '%s'", path.characters()), "Error", GMessageBox::Type::Error, window());
GMessageBox::show(String::format("Could not parse '%s'", path.characters()), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window());
return;
}
@ -329,7 +329,7 @@ void VBForm::write_to_file(const String& path)
{
CFile file(path);
if (!file.open(CIODevice::WriteOnly)) {
GMessageBox::show(String::format("Could not open '%s' for writing", path.characters()), "Error", GMessageBox::Type::Error, window());
GMessageBox::show(String::format("Could not open '%s' for writing", path.characters()), "Error", GMessageBox::Type::Error, GMessageBox::InputType::OK, window());
return;
}