mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
Userland: Replace manual checking by using GUI::InputType::NonemptyText
Do this where we were already checking if the input was empty after the InputBox was submitted. Those places gain interactive input validation. :^)
This commit is contained in:
committed by
Andrew Kaster
parent
55dbfd24c0
commit
8095d9276b
@@ -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) == InputBox::ExecResult::OK && !value.is_empty()) {
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user