diff --git a/Userland/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp index 97dc1012eb..9d315486ab 100644 --- a/Userland/Applications/Browser/BrowserWindow.cpp +++ b/Userland/Applications/Browser/BrowserWindow.cpp @@ -438,7 +438,7 @@ void BrowserWindow::build_menus() auto custom_user_agent = GUI::Action::create_checkable("Custom...", [this](auto& action) { DeprecatedString user_agent; - if (GUI::InputBox::show(this, user_agent, "Enter User Agent:"sv, "Custom User Agent"sv, {}, GUI::InputType::NonemptyText) != GUI::InputBox::ExecResult::OK) { + if (GUI::InputBox::show(this, user_agent, "Enter User Agent:"sv, "Custom User Agent"sv, GUI::InputType::NonemptyText) != GUI::InputBox::ExecResult::OK) { m_disable_user_agent_spoofing->activate(); return; } @@ -529,7 +529,7 @@ ErrorOr BrowserWindow::load_search_engines(GUI::Menu& settings_menu) auto custom_search_engine_action = GUI::Action::create_checkable("Custom...", [&](auto& action) { DeprecatedString search_engine; - if (GUI::InputBox::show(this, search_engine, "Enter URL template:"sv, "Custom Search Engine"sv, "https://host/search?q={}"sv, GUI::InputType::NonemptyText) != GUI::InputBox::ExecResult::OK) { + if (GUI::InputBox::show(this, search_engine, "Enter URL template:"sv, "Custom Search Engine"sv, GUI::InputType::NonemptyText, "https://host/search?q={}"sv) != GUI::InputBox::ExecResult::OK) { m_disable_search_engine_action->activate(); return; } diff --git a/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp b/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp index 81e743b6e7..da568273fa 100644 --- a/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp +++ b/Userland/Applications/BrowserSettings/ContentFilterSettingsWidget.cpp @@ -119,7 +119,7 @@ ContentFilterSettingsWidget::ContentFilterSettingsWidget() m_add_new_domain_button->on_click = [&](unsigned) { DeprecatedString text; - if (GUI::InputBox::show(window(), text, "Enter domain name"sv, "Add domain to Content Filter"sv, {}, GUI::InputType::NonemptyText) == GUI::Dialog::ExecResult::OK) { + if (GUI::InputBox::show(window(), text, "Enter domain name"sv, "Add domain to Content Filter"sv, GUI::InputType::NonemptyText) == GUI::Dialog::ExecResult::OK) { m_domain_list_model->add_domain(move(text)); set_modified(true); } diff --git a/Userland/Applications/CharacterMap/CharacterMapWidget.cpp b/Userland/Applications/CharacterMap/CharacterMapWidget.cpp index f83179f3b4..fa889e6b43 100644 --- a/Userland/Applications/CharacterMap/CharacterMapWidget.cpp +++ b/Userland/Applications/CharacterMap/CharacterMapWidget.cpp @@ -70,7 +70,7 @@ CharacterMapWidget::CharacterMapWidget() m_go_to_glyph_action = GUI::Action::create("Go to glyph...", { Mod_Ctrl, Key_G }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-to.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) { DeprecatedString input; - if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv, {}, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { + if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { auto maybe_code_point = AK::StringUtils::convert_to_uint_from_hex(input); if (!maybe_code_point.has_value()) return; diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp index b20e8acb2c..d7403bdff7 100644 --- a/Userland/Applications/FileManager/DirectoryView.cpp +++ b/Userland/Applications/FileManager/DirectoryView.cpp @@ -577,7 +577,7 @@ void DirectoryView::setup_actions() { m_mkdir_action = GUI::Action::create("&New Directory...", { Mod_Ctrl | Mod_Shift, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { DeprecatedString value; - if (GUI::InputBox::show(window(), value, "Enter name:"sv, "New directory"sv, {}, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { + if (GUI::InputBox::show(window(), value, "Enter name:"sv, "New directory"sv, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { auto new_dir_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", path(), value)); int rc = mkdir(new_dir_path.characters(), 0777); if (rc < 0) { @@ -589,7 +589,7 @@ void DirectoryView::setup_actions() m_touch_action = GUI::Action::create("New &File...", { Mod_Ctrl | Mod_Shift, Key_F }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) { DeprecatedString value; - if (GUI::InputBox::show(window(), value, "Enter name:"sv, "New file"sv, {}, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { + if (GUI::InputBox::show(window(), value, "Enter name:"sv, "New file"sv, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { auto new_file_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", path(), value)); struct stat st; int rc = stat(new_file_path.characters(), &st); diff --git a/Userland/Applications/FontEditor/MainWidget.cpp b/Userland/Applications/FontEditor/MainWidget.cpp index 0ec1781c73..1f4930ec9b 100644 --- a/Userland/Applications/FontEditor/MainWidget.cpp +++ b/Userland/Applications/FontEditor/MainWidget.cpp @@ -243,7 +243,7 @@ ErrorOr MainWidget::create_actions() m_go_to_glyph_action = GUI::Action::create("&Go to Glyph...", { Mod_Ctrl, Key_G }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/go-to.png"sv)), [&](auto&) { DeprecatedString input; - if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv, {}, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { + if (GUI::InputBox::show(window(), input, "Hexadecimal:"sv, "Go to glyph"sv, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { auto maybe_code_point = AK::StringUtils::convert_to_uint_from_hex(input); if (!maybe_code_point.has_value()) return; diff --git a/Userland/Applications/HexEditor/HexEditorWidget.cpp b/Userland/Applications/HexEditor/HexEditorWidget.cpp index b0d0da2459..d152fc69f4 100644 --- a/Userland/Applications/HexEditor/HexEditorWidget.cpp +++ b/Userland/Applications/HexEditor/HexEditorWidget.cpp @@ -100,7 +100,7 @@ HexEditorWidget::HexEditorWidget() m_new_action = GUI::Action::create("New", { Mod_Ctrl, Key_N }, Gfx::Bitmap::load_from_file("/res/icons/16x16/new.png"sv).release_value_but_fixme_should_propagate_errors(), [this](const GUI::Action&) { DeprecatedString value; - if (request_close() && GUI::InputBox::show(window(), value, "Enter new file size:"sv, "New file size"sv, {}, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { + if (request_close() && GUI::InputBox::show(window(), value, "Enter new file size:"sv, "New file size"sv, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { auto file_size = value.to_uint(); if (!file_size.has_value()) { GUI::MessageBox::show(window(), "Invalid file size entered."sv, "Error"sv, GUI::MessageBox::Type::Error); @@ -243,7 +243,7 @@ HexEditorWidget::HexEditorWidget() m_fill_selection_action = GUI::Action::create("Fill &Selection...", { Mod_Ctrl, Key_B }, [&](const GUI::Action&) { DeprecatedString value; - if (GUI::InputBox::show(window(), value, "Fill byte (hex):"sv, "Fill Selection"sv, {}, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { + if (GUI::InputBox::show(window(), value, "Fill byte (hex):"sv, "Fill Selection"sv, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { auto fill_byte = strtol(value.characters(), nullptr, 16); auto result = m_editor->fill_selection(fill_byte); if (result.is_error()) diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp index 990995856e..fd4e53b418 100644 --- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp +++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp @@ -370,7 +370,7 @@ PDF::PDFErrorOr PDFViewerWidget::try_open_file(StringView path, NonnullOwn if (auto sh = document->security_handler(); sh && !sh->has_user_password()) { DeprecatedString password; while (true) { - auto result = GUI::InputBox::show(window(), password, "Password"sv, "Password required"sv, {}, GUI::InputType::Password); + auto result = GUI::InputBox::show(window(), password, "Password"sv, "Password required"sv, GUI::InputType::Password); if (result == GUI::Dialog::ExecResult::OK && document->security_handler()->try_provide_user_password(password)) break; diff --git a/Userland/Demos/WidgetGallery/GalleryWidget.cpp b/Userland/Demos/WidgetGallery/GalleryWidget.cpp index 780eb13d43..295df36d33 100644 --- a/Userland/Demos/WidgetGallery/GalleryWidget.cpp +++ b/Userland/Demos/WidgetGallery/GalleryWidget.cpp @@ -119,7 +119,7 @@ GalleryWidget::GalleryWidget() m_input_button->on_click = [&](auto) { DeprecatedString value; - if (GUI::InputBox::show(window(), value, "Enter input:"sv, "Input"sv, {}, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) + if (GUI::InputBox::show(window(), value, "Enter input:"sv, "Input"sv, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) m_text_editor->set_text(value); }; diff --git a/Userland/Games/MasterWord/main.cpp b/Userland/Games/MasterWord/main.cpp index 463279f02d..4e0edf5111 100644 --- a/Userland/Games/MasterWord/main.cpp +++ b/Userland/Games/MasterWord/main.cpp @@ -76,7 +76,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(settings_menu->try_add_action(GUI::Action::create("Set &Word Length", [&](auto&) { auto word_length = Config::read_i32("MasterWord"sv, ""sv, "word_length"sv, 5); auto word_length_string = DeprecatedString::number(word_length); - if (GUI::InputBox::show(window, word_length_string, "Word length:"sv, "MasterWord"sv, {}, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { + if (GUI::InputBox::show(window, word_length_string, "Word length:"sv, "MasterWord"sv, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { auto maybe_word_length = word_length_string.template to_uint(); if (!maybe_word_length.has_value() || maybe_word_length.value() < shortest_word || maybe_word_length.value() > longest_word) { GUI::MessageBox::show(window, DeprecatedString::formatted("Please enter a number between {} and {}.", shortest_word, longest_word), "MasterWord"sv); @@ -92,7 +92,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(settings_menu->try_add_action(GUI::Action::create("Set &Number Of Guesses", [&](auto&) { auto max_guesses = Config::read_i32("MasterWord"sv, ""sv, "max_guesses"sv, 5); auto max_guesses_string = DeprecatedString::number(max_guesses); - if (GUI::InputBox::show(window, max_guesses_string, "Maximum number of guesses:"sv, "MasterWord"sv, {}, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { + if (GUI::InputBox::show(window, max_guesses_string, "Maximum number of guesses:"sv, "MasterWord"sv, GUI::InputType::NonemptyText) == GUI::InputBox::ExecResult::OK) { auto maybe_max_guesses = max_guesses_string.template to_uint(); if (!maybe_max_guesses.has_value() || maybe_max_guesses.value() < 1 || maybe_max_guesses.value() > 20) { GUI::MessageBox::show(window, "Please enter a number between 1 and 20."sv, "MasterWord"sv); diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index f24a74d2a6..c69a823bef 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -163,7 +163,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::load_from_file("/res/icons/16x16/mkdir.png"sv).release_value_but_fixme_should_propagate_errors(), [this](Action const&) { DeprecatedString value; - if (InputBox::show(this, value, "Enter name:"sv, "New directory"sv, {}, GUI::InputType::NonemptyText) == InputBox::ExecResult::OK) { + if (InputBox::show(this, value, "Enter name:"sv, "New directory"sv, GUI::InputType::NonemptyText) == InputBox::ExecResult::OK) { auto new_dir_path = LexicalPath::canonicalized_path(DeprecatedString::formatted("{}/{}", m_model->root_path(), value)); int rc = mkdir(new_dir_path.characters(), 0777); if (rc < 0) { diff --git a/Userland/Libraries/LibGUI/InputBox.cpp b/Userland/Libraries/LibGUI/InputBox.cpp index e809a33cf6..77c0f4845f 100644 --- a/Userland/Libraries/LibGUI/InputBox.cpp +++ b/Userland/Libraries/LibGUI/InputBox.cpp @@ -15,7 +15,7 @@ namespace GUI { -InputBox::InputBox(Window* parent_window, DeprecatedString text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type) +InputBox::InputBox(Window* parent_window, DeprecatedString text_value, StringView prompt, StringView title, InputType input_type, StringView placeholder) : Dialog(parent_window) , m_text_value(move(text_value)) , m_prompt(prompt) @@ -25,9 +25,9 @@ InputBox::InputBox(Window* parent_window, DeprecatedString text_value, StringVie build(input_type); } -Dialog::ExecResult InputBox::show(Window* parent_window, DeprecatedString& text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type) +Dialog::ExecResult InputBox::show(Window* parent_window, DeprecatedString& text_value, StringView prompt, StringView title, InputType input_type, StringView placeholder) { - auto box = InputBox::construct(parent_window, text_value, prompt, title, placeholder, input_type); + auto box = InputBox::construct(parent_window, text_value, prompt, title, input_type, placeholder); box->set_resizable(false); if (parent_window) box->set_icon(parent_window->icon()); diff --git a/Userland/Libraries/LibGUI/InputBox.h b/Userland/Libraries/LibGUI/InputBox.h index fa28edfe20..62758675bd 100644 --- a/Userland/Libraries/LibGUI/InputBox.h +++ b/Userland/Libraries/LibGUI/InputBox.h @@ -23,13 +23,13 @@ class InputBox : public Dialog { public: virtual ~InputBox() override = default; - static ExecResult show(Window* parent_window, DeprecatedString& text_value, StringView prompt, StringView title, StringView placeholder = {}, InputType input_type = InputType::Text); + static ExecResult show(Window* parent_window, DeprecatedString& text_value, StringView prompt, StringView title, InputType input_type = InputType::Text, StringView placeholder = {}); DeprecatedString const& text_value() const { return m_text_value; } void set_text_value(DeprecatedString text_value); private: - explicit InputBox(Window* parent_window, DeprecatedString text_value, StringView prompt, StringView title, StringView placeholder, InputType input_type); + explicit InputBox(Window* parent_window, DeprecatedString text_value, StringView prompt, StringView title, InputType input_type, StringView placeholder); virtual void on_done(ExecResult) override; void build(InputType input_type); diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp index 33f6eabcc0..5dbe2c449d 100644 --- a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp @@ -367,7 +367,7 @@ void OutOfProcessWebView::notify_server_did_request_confirm(Badge, DeprecatedString const& message, DeprecatedString const& default_) { - m_dialog = GUI::InputBox::construct(window(), default_, message, "Prompt"sv, StringView {}, GUI::InputType::Text); + m_dialog = GUI::InputBox::construct(window(), default_, message, "Prompt"sv, GUI::InputType::Text, StringView {}); m_dialog->set_icon(window()->icon()); if (m_dialog->exec() == GUI::InputBox::ExecResult::OK)