mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:18:13 +00:00
LibWeb: Require parent window argument for MessageBox
Since the vast majority of message boxes should be modal, require the parent window to be passed in, which can be nullptr for the rare case that they don't. By it being the first argument, the default arguments also don't need to be explicitly stated in most cases, and it encourages passing in a parent window handle. Fix up several message boxes that should have been modal.
This commit is contained in:
parent
6568765e8f
commit
27bd2eab22
30 changed files with 109 additions and 135 deletions
|
@ -98,14 +98,14 @@ void QSWidget::navigate(Directions direction)
|
|||
size_t index = current_index.value();
|
||||
if (direction == Directions::Back) {
|
||||
if (index == 0) {
|
||||
GUI::MessageBox::show(String::format("This is the first file.", index), "Cannot open image", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, window());
|
||||
GUI::MessageBox::show(window(), String::format("This is the first file.", index), "Cannot open image", GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
index--;
|
||||
} else if (direction == Directions::Forward) {
|
||||
if (index == m_files_in_same_dir.size() - 1) {
|
||||
GUI::MessageBox::show(String::format("This is the last file.", index), "Cannot open image", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, window());
|
||||
GUI::MessageBox::show(window(), String::format("This is the last file.", index), "Cannot open image", GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -249,7 +249,7 @@ void QSWidget::load_from_file(const String& path)
|
|||
{
|
||||
auto bitmap = Gfx::Bitmap::load_from_file(path);
|
||||
if (!bitmap) {
|
||||
GUI::MessageBox::show(String::format("Failed to open %s", path.characters()), "Cannot open image", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, window());
|
||||
GUI::MessageBox::show(window(), String::format("Failed to open %s", path.characters()), "Cannot open image", GUI::MessageBox::Type::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue