diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-05-13 13:10:27 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-05-13 16:27:43 +0200 |
commit | cdffe556c8fcca034b10cf91f0b05c17d835bc7b (patch) | |
tree | 189cbd59652eee1b2783a8323a7194100c78fd07 /Userland/Libraries | |
parent | 1f82beded3ae3664265f1ddf6075f64ca5a08cde (diff) | |
download | serenity-cdffe556c8fcca034b10cf91f0b05c17d835bc7b.zip |
LibGUI+Userland: Make Dialog::ExecResult an enum class
Diffstat (limited to 'Userland/Libraries')
21 files changed, 64 insertions, 64 deletions
diff --git a/Userland/Libraries/LibGUI/AboutDialog.cpp b/Userland/Libraries/LibGUI/AboutDialog.cpp index 63858aeac6..d40c9523d3 100644 --- a/Userland/Libraries/LibGUI/AboutDialog.cpp +++ b/Userland/Libraries/LibGUI/AboutDialog.cpp @@ -82,7 +82,7 @@ AboutDialog::AboutDialog(StringView name, Gfx::Bitmap const* icon, Window* paren auto& ok_button = button_container.add<Button>("OK"); ok_button.set_fixed_width(80); ok_button.on_click = [this](auto) { - done(Dialog::ExecOK); + done(ExecResult::OK); }; } diff --git a/Userland/Libraries/LibGUI/ColorInput.cpp b/Userland/Libraries/LibGUI/ColorInput.cpp index 0cf960adea..2a0d8ee23c 100644 --- a/Userland/Libraries/LibGUI/ColorInput.cpp +++ b/Userland/Libraries/LibGUI/ColorInput.cpp @@ -72,7 +72,7 @@ void ColorInput::mouseup_event(MouseEvent& event) if (is_color_rect_click) { auto dialog = GUI::ColorPicker::construct(m_color, window(), m_color_picker_title); dialog->set_color_has_alpha_channel(m_color_has_alpha_channel); - if (dialog->exec() == GUI::Dialog::ExecOK) + if (dialog->exec() == GUI::Dialog::ExecResult::OK) set_color(dialog->color()); event.accept(); return; diff --git a/Userland/Libraries/LibGUI/ColorPicker.cpp b/Userland/Libraries/LibGUI/ColorPicker.cpp index 3711d7858e..07d2975902 100644 --- a/Userland/Libraries/LibGUI/ColorPicker.cpp +++ b/Userland/Libraries/LibGUI/ColorPicker.cpp @@ -236,14 +236,14 @@ void ColorPicker::build_ui() ok_button.set_fixed_width(80); ok_button.set_text("OK"); ok_button.on_click = [this](auto) { - done(ExecOK); + done(ExecResult::OK); }; auto& cancel_button = button_container.add<Button>(); cancel_button.set_fixed_width(80); cancel_button.set_text("Cancel"); cancel_button.on_click = [this](auto) { - done(ExecCancel); + done(ExecResult::Cancel); }; } @@ -464,7 +464,7 @@ void ColorButton::doubleclick_event(GUI::MouseEvent&) { click(); m_selected = true; - m_picker.done(Dialog::ExecOK); + m_picker.done(Dialog::ExecResult::OK); } void ColorButton::paint_event(PaintEvent& event) diff --git a/Userland/Libraries/LibGUI/CommandPalette.cpp b/Userland/Libraries/LibGUI/CommandPalette.cpp index 2f5a096c19..d28ba7e74c 100644 --- a/Userland/Libraries/LibGUI/CommandPalette.cpp +++ b/Userland/Libraries/LibGUI/CommandPalette.cpp @@ -288,7 +288,7 @@ void CommandPalette::finish_with_index(GUI::ModelIndex const& filter_index) auto* action = static_cast<GUI::Action*>(action_index.internal_data()); VERIFY(action); m_selected_action = action; - done(ExecOK); + done(ExecResult::OK); } } diff --git a/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp b/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp index 556f216023..0e009dd077 100644 --- a/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp +++ b/Userland/Libraries/LibGUI/ConnectionToWindowServer.cpp @@ -184,7 +184,7 @@ void ConnectionToWindowServer::key_down(i32 window_id, u32 code_point, u32 key, bool focused_widget_accepts_emoji_input = window->focused_widget() && window->focused_widget()->accepts_emoji_input(); if (focused_widget_accepts_emoji_input && (modifiers == (Mod_Ctrl | Mod_Alt)) && key == Key_Space) { auto emoji_input_dialog = EmojiInputDialog::construct(window); - if (emoji_input_dialog->exec() != EmojiInputDialog::ExecOK) + if (emoji_input_dialog->exec() != EmojiInputDialog::ExecResult::OK) return; key_event->m_key = Key_Invalid; key_event->m_modifiers = 0; @@ -203,7 +203,7 @@ void ConnectionToWindowServer::key_down(i32 window_id, u32 code_point, u32 key, if (accepts_command_palette && !m_in_command_palette && modifiers == (Mod_Ctrl | Mod_Shift) && key == Key_A) { auto command_palette = CommandPalette::construct(*window); TemporaryChange change { m_in_command_palette, true }; - if (command_palette->exec() != GUI::Dialog::ExecOK) + if (command_palette->exec() != GUI::Dialog::ExecResult::OK) return; auto* action = command_palette->selected_action(); VERIFY(action); diff --git a/Userland/Libraries/LibGUI/Dialog.cpp b/Userland/Libraries/LibGUI/Dialog.cpp index d4e7e65631..7dcba9cd7f 100644 --- a/Userland/Libraries/LibGUI/Dialog.cpp +++ b/Userland/Libraries/LibGUI/Dialog.cpp @@ -20,7 +20,7 @@ Dialog::Dialog(Window* parent_window, ScreenPosition screen_position) set_minimizable(false); } -int Dialog::exec() +Dialog::ExecResult Dialog::exec() { VERIFY(!m_event_loop); m_event_loop = make<Core::EventLoop>(); @@ -87,16 +87,16 @@ int Dialog::exec() m_event_loop = nullptr; dbgln("{}: Event loop returned with result {}", *this, result); remove_from_parent(); - return result; + return static_cast<ExecResult>(result); } -void Dialog::done(int result) +void Dialog::done(ExecResult result) { if (!m_event_loop) return; m_result = result; - dbgln("{}: Quit event loop with result {}", *this, result); - m_event_loop->quit(result); + dbgln("{}: Quit event loop with result {}", *this, to_underlying(result)); + m_event_loop->quit(to_underlying(result)); } void Dialog::event(Core::Event& event) @@ -104,7 +104,7 @@ void Dialog::event(Core::Event& event) if (event.type() == Event::KeyUp || event.type() == Event::KeyDown) { auto& key_event = static_cast<KeyEvent&>(event); if (key_event.key() == KeyCode::Key_Escape) { - done(ExecCancel); + done(ExecResult::Cancel); event.accept(); return; } @@ -116,7 +116,7 @@ void Dialog::event(Core::Event& event) void Dialog::close() { Window::close(); - done(ExecCancel); + done(ExecResult::Cancel); } } diff --git a/Userland/Libraries/LibGUI/Dialog.h b/Userland/Libraries/LibGUI/Dialog.h index 259e346261..52146c8dc3 100644 --- a/Userland/Libraries/LibGUI/Dialog.h +++ b/Userland/Libraries/LibGUI/Dialog.h @@ -15,12 +15,12 @@ namespace GUI { class Dialog : public Window { C_OBJECT(Dialog) public: - enum ExecResult { - ExecOK = 0, - ExecCancel = 1, - ExecAborted = 2, - ExecYes = 3, - ExecNo = 4, + enum class ExecResult { + OK = 0, + Cancel = 1, + Aborted = 2, + Yes = 3, + No = 4, }; enum ScreenPosition { CenterWithinParent = 0, @@ -40,10 +40,10 @@ public: virtual ~Dialog() override = default; - int exec(); + ExecResult exec(); - int result() const { return m_result; } - void done(int result); + ExecResult result() const { return m_result; } + void done(ExecResult); virtual void event(Core::Event&) override; @@ -54,7 +54,7 @@ protected: private: OwnPtr<Core::EventLoop> m_event_loop; - int m_result { ExecAborted }; + ExecResult m_result { ExecResult::Aborted }; int m_screen_position { CenterWithinParent }; }; diff --git a/Userland/Libraries/LibGUI/EmojiInputDialog.cpp b/Userland/Libraries/LibGUI/EmojiInputDialog.cpp index bc59774c66..e43168517c 100644 --- a/Userland/Libraries/LibGUI/EmojiInputDialog.cpp +++ b/Userland/Libraries/LibGUI/EmojiInputDialog.cpp @@ -85,7 +85,7 @@ EmojiInputDialog::EmojiInputDialog(Window* parent_window) button.set_button_style(Gfx::ButtonStyle::Coolbar); button.on_click = [this, button = &button](auto) { m_selected_emoji_text = button->text(); - done(ExecOK); + done(ExecResult::OK); }; } else { horizontal_container.add<Widget>(); @@ -99,7 +99,7 @@ void EmojiInputDialog::event(Core::Event& event) if (event.type() == Event::KeyDown) { auto& key_event = static_cast<KeyEvent&>(event); if (key_event.key() == Key_Escape) { - done(ExecCancel); + done(ExecResult::Cancel); return; } } diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index a22fe83c0e..f91c1c04cd 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -39,7 +39,7 @@ Optional<String> FilePicker::get_open_filepath(Window* parent_window, String con if (!window_title.is_null()) picker->set_title(window_title); - if (picker->exec() == Dialog::ExecOK) { + if (picker->exec() == ExecResult::OK) { String file_path = picker->selected_file(); if (file_path.is_null()) @@ -54,7 +54,7 @@ Optional<String> FilePicker::get_save_filepath(Window* parent_window, String con { auto picker = FilePicker::construct(parent_window, Mode::Save, String::formatted("{}.{}", title, extension), path, screen_position); - if (picker->exec() == Dialog::ExecOK) { + if (picker->exec() == ExecResult::OK) { String file_path = picker->selected_file(); if (file_path.is_null()) @@ -131,7 +131,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St auto mkdir_action = Action::create( "New directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/mkdir.png").release_value_but_fixme_should_propagate_errors(), [this](Action const&) { String value; - if (InputBox::show(this, value, "Enter name:", "New directory") == InputBox::ExecOK && !value.is_empty()) { + if (InputBox::show(this, value, "Enter name:", "New directory") == InputBox::ExecResult::OK && !value.is_empty()) { auto new_dir_path = LexicalPath::canonicalized_path(String::formatted("{}/{}", m_model->root_path(), value)); int rc = mkdir(new_dir_path.characters(), 0777); if (rc < 0) { @@ -185,7 +185,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St auto& cancel_button = *widget.find_descendant_of_type_named<GUI::Button>("cancel_button"); cancel_button.set_text("Cancel"); cancel_button.on_click = [this](auto) { - done(ExecCancel); + done(ExecResult::Cancel); }; m_filename_textbox->on_change = [&] { @@ -278,12 +278,12 @@ void FilePicker::on_file_return() if (file_exists && m_mode == Mode::Save) { auto result = MessageBox::show(this, "File already exists. Overwrite?", "Existing File", MessageBox::Type::Warning, MessageBox::InputType::OKCancel); - if (result == MessageBox::ExecCancel) + if (result == MessageBox::ExecResult::Cancel) return; } m_selected_file = path; - done(ExecOK); + done(ExecResult::OK); } void FilePicker::set_path(String const& path) diff --git a/Userland/Libraries/LibGUI/FontPicker.cpp b/Userland/Libraries/LibGUI/FontPicker.cpp index 570d42fa1c..244c430f1f 100644 --- a/Userland/Libraries/LibGUI/FontPicker.cpp +++ b/Userland/Libraries/LibGUI/FontPicker.cpp @@ -159,12 +159,12 @@ FontPicker::FontPicker(Window* parent_window, Gfx::Font const* current_font, boo auto& ok_button = *widget.find_descendant_of_type_named<GUI::Button>("ok_button"); ok_button.on_click = [this](auto) { - done(ExecOK); + done(ExecResult::OK); }; auto& cancel_button = *widget.find_descendant_of_type_named<GUI::Button>("cancel_button"); cancel_button.on_click = [this](auto) { - done(ExecCancel); + done(ExecResult::Cancel); }; set_font(current_font); diff --git a/Userland/Libraries/LibGUI/InputBox.cpp b/Userland/Libraries/LibGUI/InputBox.cpp index 3cb0577bab..f6d838c09a 100644 --- a/Userland/Libraries/LibGUI/InputBox.cpp +++ b/Userland/Libraries/LibGUI/InputBox.cpp @@ -25,7 +25,7 @@ InputBox::InputBox(Window* parent_window, String& text_value, StringView prompt, build(input_type); } -int InputBox::show(Window* parent_window, String& text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type) +Dialog::ExecResult InputBox::show(Window* parent_window, String& text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type) { auto box = InputBox::construct(parent_window, text_value, prompt, title, placeholder, input_type); box->set_resizable(false); @@ -87,7 +87,7 @@ void InputBox::build(InputType input_type) m_ok_button->on_click = [this](auto) { dbgln("GUI::InputBox: OK button clicked"); m_text_value = m_text_editor->text(); - done(ExecOK); + done(ExecResult::OK); }; m_ok_button->set_default(true); @@ -95,7 +95,7 @@ void InputBox::build(InputType input_type) m_cancel_button->set_text("Cancel"); m_cancel_button->on_click = [this](auto) { dbgln("GUI::InputBox: Cancel button clicked"); - done(ExecCancel); + done(ExecResult::Cancel); }; m_text_editor->on_escape_pressed = [this] { diff --git a/Userland/Libraries/LibGUI/InputBox.h b/Userland/Libraries/LibGUI/InputBox.h index 16593ed91c..7bcd1abcf3 100644 --- a/Userland/Libraries/LibGUI/InputBox.h +++ b/Userland/Libraries/LibGUI/InputBox.h @@ -22,7 +22,7 @@ class InputBox : public Dialog { public: virtual ~InputBox() override = default; - static int show(Window* parent_window, String& text_value, StringView prompt, StringView title, StringView placeholder = {}, InputType input_type = InputType::Text); + static ExecResult show(Window* parent_window, String& text_value, StringView prompt, StringView title, StringView placeholder = {}, InputType input_type = InputType::Text); private: explicit InputBox(Window* parent_window, String& text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type); diff --git a/Userland/Libraries/LibGUI/MessageBox.cpp b/Userland/Libraries/LibGUI/MessageBox.cpp index 5a29379ff8..a438e90928 100644 --- a/Userland/Libraries/LibGUI/MessageBox.cpp +++ b/Userland/Libraries/LibGUI/MessageBox.cpp @@ -16,7 +16,7 @@ namespace GUI { -int MessageBox::show(Window* parent_window, StringView text, StringView title, Type type, InputType input_type) +Dialog::ExecResult MessageBox::show(Window* parent_window, StringView text, StringView title, Type type, InputType input_type) { auto box = MessageBox::construct(parent_window, text, title, type, input_type); if (parent_window) @@ -24,12 +24,12 @@ int MessageBox::show(Window* parent_window, StringView text, StringView title, T return box->exec(); } -int MessageBox::show_error(Window* parent_window, StringView text) +Dialog::ExecResult MessageBox::show_error(Window* parent_window, StringView text) { return show(parent_window, text, "Error", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK); } -int MessageBox::ask_about_unsaved_changes(Window* parent_window, StringView path, Optional<Time> last_unmodified_timestamp) +Dialog::ExecResult MessageBox::ask_about_unsaved_changes(Window* parent_window, StringView path, Optional<Time> last_unmodified_timestamp) { StringBuilder builder; builder.append("Save changes to "); @@ -151,7 +151,7 @@ void MessageBox::build() constexpr int button_width = 80; int button_count = 0; - auto add_button = [&](String label, Dialog::ExecResult result) -> GUI::Button& { + auto add_button = [&](String label, ExecResult result) -> GUI::Button& { auto& button = button_container.add<Button>(); button.set_fixed_width(button_width); button.set_text(label); @@ -164,13 +164,13 @@ void MessageBox::build() button_container.layout()->add_spacer(); if (should_include_ok_button()) - m_ok_button = add_button("OK", Dialog::ExecOK); + m_ok_button = add_button("OK", ExecResult::OK); if (should_include_yes_button()) - m_yes_button = add_button("Yes", Dialog::ExecYes); + m_yes_button = add_button("Yes", ExecResult::Yes); if (should_include_no_button()) - m_no_button = add_button("No", Dialog::ExecNo); + m_no_button = add_button("No", ExecResult::No); if (should_include_cancel_button()) - m_cancel_button = add_button("Cancel", Dialog::ExecCancel); + m_cancel_button = add_button("Cancel", ExecResult::Cancel); button_container.layout()->add_spacer(); int width = (button_count * button_width) + ((button_count - 1) * button_container.layout()->spacing()) + 32; diff --git a/Userland/Libraries/LibGUI/MessageBox.h b/Userland/Libraries/LibGUI/MessageBox.h index 12d8ae72e0..2fe39754a7 100644 --- a/Userland/Libraries/LibGUI/MessageBox.h +++ b/Userland/Libraries/LibGUI/MessageBox.h @@ -32,9 +32,9 @@ public: virtual ~MessageBox() override = default; - static int show(Window* parent_window, StringView text, StringView title, Type type = Type::None, InputType input_type = InputType::OK); - static int show_error(Window* parent_window, StringView text); - static int ask_about_unsaved_changes(Window* parent_window, StringView path, Optional<Time> last_unmodified_timestamp = {}); + static ExecResult show(Window* parent_window, StringView text, StringView title, Type type = Type::None, InputType input_type = InputType::OK); + static ExecResult show_error(Window* parent_window, StringView text); + static ExecResult ask_about_unsaved_changes(Window* parent_window, StringView path, Optional<Time> last_unmodified_timestamp = {}); void set_text(String text); diff --git a/Userland/Libraries/LibGUI/PasswordInputDialog.cpp b/Userland/Libraries/LibGUI/PasswordInputDialog.cpp index 37731d27bc..a961fe4108 100644 --- a/Userland/Libraries/LibGUI/PasswordInputDialog.cpp +++ b/Userland/Libraries/LibGUI/PasswordInputDialog.cpp @@ -42,13 +42,13 @@ PasswordInputDialog::PasswordInputDialog(Window* parent_window, String title, St ok_button.on_click = [&](auto) { dbgln("GUI::PasswordInputDialog: OK button clicked"); m_password = password_box.text(); - done(ExecOK); + done(ExecResult::OK); }; auto& cancel_button = *widget.find_descendant_of_type_named<GUI::Button>("cancel_button"); cancel_button.on_click = [this](auto) { dbgln("GUI::PasswordInputDialog: Cancel button clicked"); - done(ExecCancel); + done(ExecResult::Cancel); }; password_box.on_return_pressed = [&] { @@ -60,7 +60,7 @@ PasswordInputDialog::PasswordInputDialog(Window* parent_window, String title, St password_box.set_focus(true); } -int PasswordInputDialog::show(Window* parent_window, String& text_value, String title, String server, String username) +Dialog::ExecResult PasswordInputDialog::show(Window* parent_window, String& text_value, String title, String server, String username) { auto box = PasswordInputDialog::construct(parent_window, move(title), move(server), move(username)); auto result = box->exec(); diff --git a/Userland/Libraries/LibGUI/PasswordInputDialog.h b/Userland/Libraries/LibGUI/PasswordInputDialog.h index ee3200d792..78923bd0de 100644 --- a/Userland/Libraries/LibGUI/PasswordInputDialog.h +++ b/Userland/Libraries/LibGUI/PasswordInputDialog.h @@ -17,7 +17,7 @@ class PasswordInputDialog : public Dialog { public: virtual ~PasswordInputDialog() override = default; - static int show(Window* parent_window, String& text_value, String title, String server, String username); + static ExecResult show(Window* parent_window, String& text_value, String title, String server, String username); private: explicit PasswordInputDialog(Window* parent_window, String title, String server, String username); diff --git a/Userland/Libraries/LibGUI/ProcessChooser.cpp b/Userland/Libraries/LibGUI/ProcessChooser.cpp index 2a55fbee53..6c5be287f0 100644 --- a/Userland/Libraries/LibGUI/ProcessChooser.cpp +++ b/Userland/Libraries/LibGUI/ProcessChooser.cpp @@ -65,7 +65,7 @@ ProcessChooser::ProcessChooser(StringView window_title, StringView button_label, auto& cancel_button = button_container.add<GUI::Button>("Cancel"); cancel_button.set_fixed_width(80); cancel_button.on_click = [this](auto) { - done(ExecCancel); + done(ExecResult::Cancel); }; m_process_model->update(); @@ -102,7 +102,7 @@ ProcessChooser::ProcessChooser(StringView window_title, StringView button_label, void ProcessChooser::set_pid_from_index_and_close(ModelIndex const& index) { m_pid = index.data(GUI::ModelRole::Custom).as_i32(); - done(ExecOK); + done(ExecResult::OK); } } diff --git a/Userland/Libraries/LibGUI/SettingsWindow.cpp b/Userland/Libraries/LibGUI/SettingsWindow.cpp index 2034f82b0b..23815f0b8a 100644 --- a/Userland/Libraries/LibGUI/SettingsWindow.cpp +++ b/Userland/Libraries/LibGUI/SettingsWindow.cpp @@ -81,10 +81,10 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(String title, Show auto result = MessageBox::show(window, "Apply these settings before closing?", "Unsaved changes", MessageBox::Type::Warning, MessageBox::InputType::YesNoCancel); switch (result) { - case MessageBox::ExecYes: + case MessageBox::ExecResult::Yes: window->apply_settings(); return Window::CloseRequestDecision::Close; - case MessageBox::ExecNo: + case MessageBox::ExecResult::No: window->cancel_settings(); return Window::CloseRequestDecision::Close; default: diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 9565991a8a..8ea4a8ee47 100644 --- a/Userland/Libraries/LibGUI/TextEditor.cpp +++ b/Userland/Libraries/LibGUI/TextEditor.cpp @@ -94,7 +94,7 @@ void TextEditor::create_actions() m_go_to_line_action = Action::create( "Go to line...", { Mod_Ctrl, Key_L }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-to.png").release_value_but_fixme_should_propagate_errors(), [this](auto&) { String value; - if (InputBox::show(window(), value, "Line:", "Go to line") == InputBox::ExecOK) { + if (InputBox::show(window(), value, "Line:", "Go to line") == InputBox::ExecResult::OK) { auto line_target = value.to_uint(); if (line_target.has_value()) { set_cursor_and_focus_line(line_target.value() - 1, 0); diff --git a/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp b/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp index c1d3cad741..d0c335c1c9 100644 --- a/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp +++ b/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp @@ -58,11 +58,11 @@ WizardDialog::WizardDialog(Window* parent_window) VERIFY(has_pages()); if (!current_page().can_go_next()) - return done(ExecOK); + return done(ExecResult::OK); auto next_page = current_page().next_page(); if (!next_page) - return done(ExecOK); + return done(ExecResult::OK); push_page(*next_page); }; @@ -143,7 +143,7 @@ void WizardDialog::handle_cancel() if (on_cancel) return on_cancel(); - done(ExecCancel); + done(ExecResult::Cancel); } } diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp index 28e0d18143..08f89d3151 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -329,13 +329,13 @@ void OutOfProcessWebView::notify_server_did_request_alert(Badge<WebContentClient bool OutOfProcessWebView::notify_server_did_request_confirm(Badge<WebContentClient>, String const& message) { auto confirm_result = GUI::MessageBox::show(window(), message, "Confirm", GUI::MessageBox::Type::Warning, GUI::MessageBox::InputType::OKCancel); - return confirm_result == GUI::Dialog::ExecResult::ExecOK; + return confirm_result == GUI::Dialog::ExecResult::OK; } String OutOfProcessWebView::notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_) { String response { default_ }; - if (GUI::InputBox::show(window(), response, message, "Prompt") == GUI::InputBox::ExecOK) + if (GUI::InputBox::show(window(), response, message, "Prompt") == GUI::InputBox::ExecResult::OK) return response; return {}; } |