1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibGUI: Add a MessageBox type to reveal a file

This will be used by Ladybird to open a screenshot's containing folder.
This commit is contained in:
Timothy Flynn 2024-01-06 09:55:46 -05:00 committed by Sam Atkins
parent cc88a2657d
commit 9218b2f3ce
3 changed files with 12 additions and 1 deletions

View file

@ -130,7 +130,7 @@ ErrorOr<RefPtr<Gfx::Bitmap>> MessageBox::icon() const
bool MessageBox::should_include_ok_button() const
{
return m_input_type == InputType::OK || m_input_type == InputType::OKCancel;
return m_input_type == InputType::OK || m_input_type == InputType::OKCancel || m_input_type == InputType::OKReveal;
}
bool MessageBox::should_include_cancel_button() const
@ -148,6 +148,11 @@ bool MessageBox::should_include_no_button() const
return should_include_yes_button();
}
bool MessageBox::should_include_reveal_button() const
{
return m_input_type == InputType::OKReveal;
}
ErrorOr<void> MessageBox::build()
{
auto main_widget = set_main_widget<Widget>();
@ -188,6 +193,8 @@ ErrorOr<void> MessageBox::build()
m_no_button = add_button("No"_string, ExecResult::No);
if (should_include_cancel_button())
m_cancel_button = add_button("Cancel"_string, ExecResult::Cancel);
if (should_include_reveal_button())
m_reveal_button = add_button("Open folder"_string, ExecResult::Reveal);
button_container.add_spacer();
return {};