mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:37:45 +00:00
LibGUI+Userland: Improve error and font handling for InputBox
Adds fallible factories, ports DeprecatedString, and rebuilds the layout to accomodate system font changes.
This commit is contained in:
parent
9c2bcffe83
commit
02a9e5d3f6
19 changed files with 135 additions and 124 deletions
|
@ -568,7 +568,7 @@ void DirectoryView::handle_selection_change()
|
|||
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;
|
||||
String value;
|
||||
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);
|
||||
|
@ -580,7 +580,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;
|
||||
String value;
|
||||
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;
|
||||
|
|
|
@ -223,7 +223,7 @@ void do_create_link(Vector<DeprecatedString> const& selected_file_paths, GUI::Wi
|
|||
|
||||
void do_create_archive(Vector<DeprecatedString> const& selected_file_paths, GUI::Window* window)
|
||||
{
|
||||
DeprecatedString archive_name;
|
||||
String archive_name;
|
||||
if (GUI::InputBox::show(window, archive_name, "Enter name:"sv, "Create Archive"sv) != GUI::InputBox::ExecResult::OK)
|
||||
return;
|
||||
|
||||
|
@ -237,7 +237,7 @@ void do_create_archive(Vector<DeprecatedString> const& selected_file_paths, GUI:
|
|||
path_builder.append(".zip"sv);
|
||||
} else {
|
||||
path_builder.append(archive_name);
|
||||
if (!archive_name.ends_with(".zip"sv))
|
||||
if (!AK::StringUtils::ends_with(archive_name, ".zip"sv, CaseSensitivity::CaseSensitive))
|
||||
path_builder.append(".zip"sv);
|
||||
}
|
||||
auto output_path = path_builder.to_deprecated_string();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue