1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:38:12 +00:00

LibGUI: Add InputBox::show with required parent window argument

Similar to MessageBox::show, this encourages passing in a window.
This commit is contained in:
Tom 2020-07-16 07:54:42 -06:00 committed by Andreas Kling
parent 27bd2eab22
commit 65a11fb5f9
11 changed files with 99 additions and 94 deletions

View file

@ -152,11 +152,11 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, Options options, const
toolbar.add_separator();
auto mkdir_action = Action::create("New directory...", Gfx::Bitmap::load_from_file("/res/icons/16x16/mkdir.png"), [this](const Action&) {
auto& input_box = add<InputBox>("Enter name:", "New directory");
if (input_box.exec() == InputBox::ExecOK && !input_box.text_value().is_empty()) {
String value;
if (InputBox::show(value, this, "Enter name:", "New directory") == InputBox::ExecOK && !value.is_empty()) {
auto new_dir_path = LexicalPath(String::format("%s/%s",
m_model->root_path().characters(),
input_box.text_value().characters()))
value.characters()))
.string();
int rc = mkdir(new_dir_path.characters(), 0777);
if (rc < 0) {