summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorKarol Kosek <krkk@serenityos.org>2023-04-15 17:18:45 +0200
committerAndreas Kling <kling@serenityos.org>2023-04-19 07:59:54 +0200
commit956f4d92057526213d4039be7fa68ab67ff32e02 (patch)
tree0522c420ca49ea66e41135ec3866bab750e1de69 /Userland
parentc4c1df76211c9fff4028321a50dc9121d2ed5c73 (diff)
downloadserenity-956f4d92057526213d4039be7fa68ab67ff32e02.zip
Userland: Construct Menus with name using the non-deprecated String
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/Browser/BookmarksBarWidget.cpp2
-rw-r--r--Userland/Applications/FileManager/main.cpp14
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.cpp2
-rw-r--r--Userland/DevTools/Inspector/main.cpp2
-rw-r--r--Userland/Libraries/LibGUI/CommonMenus.cpp2
-rw-r--r--Userland/Libraries/LibGUI/Menu.cpp7
-rw-r--r--Userland/Libraries/LibGUI/Menu.h1
-rw-r--r--Userland/Libraries/LibGUI/Menubar.cpp4
-rw-r--r--Userland/Services/Taskbar/main.cpp2
9 files changed, 15 insertions, 21 deletions
diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp
index 56dd74a367..6614faebd6 100644
--- a/Userland/Applications/Browser/BookmarksBarWidget.cpp
+++ b/Userland/Applications/Browser/BookmarksBarWidget.cpp
@@ -261,7 +261,7 @@ void BookmarksBarWidget::update_content_size()
} else {
// hide all items > m_last_visible_index and create new bookmarks menu for them
m_additional->set_visible(true);
- m_additional_menu = GUI::Menu::construct("Additional Bookmarks");
+ m_additional_menu = GUI::Menu::construct("Additional Bookmarks"_string.release_value_but_fixme_should_propagate_errors());
m_additional->set_menu(m_additional_menu);
for (size_t i = m_last_visible_index; i < m_bookmarks.size(); ++i) {
auto& bookmark = m_bookmarks.at(i);
diff --git a/Userland/Applications/FileManager/main.cpp b/Userland/Applications/FileManager/main.cpp
index 67b1e3f43b..9791fcf85d 100644
--- a/Userland/Applications/FileManager/main.cpp
+++ b/Userland/Applications/FileManager/main.cpp
@@ -476,7 +476,7 @@ ErrorOr<int> run_in_desktop_mode()
paste_action->set_enabled(data_type == "text/uri-list" && access(directory_view->path().characters(), W_OK) == 0);
};
- auto desktop_view_context_menu = TRY(GUI::Menu::try_create("Directory View"));
+ auto desktop_view_context_menu = TRY(GUI::Menu::try_create(TRY("Directory View"_string)));
auto file_manager_action = GUI::Action::create("Open in File &Manager", {}, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-file-manager.png"sv)), [&](auto&) {
auto paths = directory_view->selected_file_paths();
@@ -518,7 +518,7 @@ ErrorOr<int> run_in_desktop_mode()
TRY(desktop_view_context_menu->try_add_separator());
TRY(desktop_view_context_menu->try_add_action(display_properties_action));
- auto desktop_context_menu = TRY(GUI::Menu::try_create("Directory View Directory"));
+ auto desktop_context_menu = TRY(GUI::Menu::try_create(TRY("Directory View Directory"_string)));
TRY(desktop_context_menu->try_add_action(file_manager_action));
TRY(desktop_context_menu->try_add_action(open_terminal_action));
@@ -541,7 +541,7 @@ ErrorOr<int> run_in_desktop_mode()
if (node.is_directory()) {
desktop_context_menu->popup(event.screen_position(), file_manager_action);
} else {
- file_context_menu = GUI::Menu::construct("Directory View File");
+ file_context_menu = GUI::Menu::construct("Directory View File"_string.release_value_but_fixme_should_propagate_errors());
bool added_open_menu_items = add_launch_handler_actions_to_menu(file_context_menu, directory_view, node.full_path(), file_context_menu_action_default_action, current_file_handlers);
if (added_open_menu_items)
@@ -690,9 +690,9 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
directory_view->refresh();
};
- auto directory_context_menu = TRY(GUI::Menu::try_create("Directory View Directory"));
- auto directory_view_context_menu = TRY(GUI::Menu::try_create("Directory View"));
- auto tree_view_directory_context_menu = TRY(GUI::Menu::try_create("Tree View Directory"));
+ auto directory_context_menu = TRY(GUI::Menu::try_create(TRY("Directory View Directory"_string)));
+ auto directory_view_context_menu = TRY(GUI::Menu::try_create(TRY("Directory View"_string)));
+ auto tree_view_directory_context_menu = TRY(GUI::Menu::try_create(TRY("Tree View Directory"_string)));
auto open_parent_directory_action = GUI::Action::create("Open &Parent Directory", { Mod_Alt, Key_Up }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/open-parent-directory.png"sv)), [&](GUI::Action const&) {
directory_view->open_parent_directory();
@@ -1210,7 +1210,7 @@ ErrorOr<int> run_in_windowed_mode(DeprecatedString const& initial_location, Depr
folder_specific_paste_action->set_enabled(should_get_enabled);
directory_context_menu->popup(event.screen_position(), directory_open_action);
} else {
- file_context_menu = GUI::Menu::construct("Directory View File");
+ file_context_menu = GUI::Menu::construct("Directory View File"_string.release_value_but_fixme_should_propagate_errors());
bool added_launch_file_handlers = add_launch_handler_actions_to_menu(file_context_menu, directory_view, node.full_path(), file_context_menu_action_default_action, current_file_handlers);
if (added_launch_file_handlers)
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
index 6d6cceaa25..51b1886c3e 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
@@ -495,7 +495,7 @@ ErrorOr<NonnullRefPtr<GUI::Menu>> HackStudioWidget::create_project_tree_view_con
m_tree_view_rename_action = GUI::CommonActions::make_rename_action([this](GUI::Action const&) {
m_project_tree_view->begin_editing(m_project_tree_view->cursor_index());
});
- auto project_tree_view_context_menu = GUI::Menu::construct("Project Files");
+ auto project_tree_view_context_menu = GUI::Menu::construct(TRY("Project Files"_string));
auto& new_file_submenu = project_tree_view_context_menu->add_submenu("N&ew...");
for (auto& new_file_action : m_new_file_actions) {
diff --git a/Userland/DevTools/Inspector/main.cpp b/Userland/DevTools/Inspector/main.cpp
index 3e5b82dea5..b7ac04bb21 100644
--- a/Userland/DevTools/Inspector/main.cpp
+++ b/Userland/DevTools/Inspector/main.cpp
@@ -128,7 +128,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
remote_process.set_inspected_object(remote_object->address);
};
- auto properties_tree_view_context_menu = TRY(GUI::Menu::try_create("Properties Tree View"));
+ auto properties_tree_view_context_menu = TRY(GUI::Menu::try_create(TRY("Properties Tree View"_string)));
auto copy_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors();
auto copy_property_name_action = GUI::Action::create("Copy Property Name", copy_bitmap, [&](auto&) {
diff --git a/Userland/Libraries/LibGUI/CommonMenus.cpp b/Userland/Libraries/LibGUI/CommonMenus.cpp
index 5b1194808d..1ec60c183e 100644
--- a/Userland/Libraries/LibGUI/CommonMenus.cpp
+++ b/Userland/Libraries/LibGUI/CommonMenus.cpp
@@ -59,7 +59,7 @@ ErrorOr<NonnullRefPtr<Menu>> make_accessibility_menu(ColorFilterer& filterer)
group->add_action(*achromatomaly_accessibility_action);
(void)group.leak_ptr();
- auto menu = TRY(Menu::try_create("&Accessibility"));
+ auto menu = TRY(Menu::try_create(TRY("&Accessibility"_string)));
menu->add_action(default_accessibility_action);
menu->add_action(pratanopia_accessibility_action);
menu->add_action(pratanomaly_accessibility_action);
diff --git a/Userland/Libraries/LibGUI/Menu.cpp b/Userland/Libraries/LibGUI/Menu.cpp
index b1397fac91..5c1897c4e7 100644
--- a/Userland/Libraries/LibGUI/Menu.cpp
+++ b/Userland/Libraries/LibGUI/Menu.cpp
@@ -38,11 +38,6 @@ Menu::Menu(String name)
{
}
-Menu::Menu(DeprecatedString name)
- : m_name(String::from_deprecated_string(name).release_value_but_fixme_should_propagate_errors())
-{
-}
-
Menu::~Menu()
{
unrealize_menu();
@@ -119,7 +114,7 @@ ErrorOr<NonnullRefPtr<Menu>> Menu::try_add_submenu(DeprecatedString name)
// NOTE: We grow the vector first, to get allocation failure handled immediately.
TRY(m_items.try_ensure_capacity(m_items.size() + 1));
- auto submenu = TRY(Menu::try_create(name));
+ auto submenu = TRY(Menu::try_create(TRY(String::from_deprecated_string(name))));
auto item = TRY(adopt_nonnull_own_or_enomem(new (nothrow) MenuItem(m_menu_id, submenu)));
submenu->set_parent(*this, m_items.size());
diff --git a/Userland/Libraries/LibGUI/Menu.h b/Userland/Libraries/LibGUI/Menu.h
index eb6a8b5124..d6cf3638cc 100644
--- a/Userland/Libraries/LibGUI/Menu.h
+++ b/Userland/Libraries/LibGUI/Menu.h
@@ -70,7 +70,6 @@ private:
friend class Menubar;
explicit Menu(String name = {});
- explicit Menu(DeprecatedString name);
int realize_menu(RefPtr<Action> default_action = nullptr);
void unrealize_menu();
diff --git a/Userland/Libraries/LibGUI/Menubar.cpp b/Userland/Libraries/LibGUI/Menubar.cpp
index 02c2dc3e67..61d75cd887 100644
--- a/Userland/Libraries/LibGUI/Menubar.cpp
+++ b/Userland/Libraries/LibGUI/Menubar.cpp
@@ -18,14 +18,14 @@ ErrorOr<void> Menubar::try_add_menu(Badge<Window>, NonnullRefPtr<Menu> menu)
ErrorOr<NonnullRefPtr<Menu>> Menubar::try_add_menu(Badge<Window>, DeprecatedString name)
{
- auto menu = TRY(try_add<Menu>(move(name)));
+ auto menu = TRY(try_add<Menu>(TRY(String::from_deprecated_string(name))));
TRY(m_menus.try_append(menu));
return menu;
}
Menu& Menubar::add_menu(Badge<Window>, DeprecatedString name)
{
- auto& menu = add<Menu>(move(name));
+ auto& menu = add<Menu>(String::from_deprecated_string(name).release_value_but_fixme_should_propagate_errors());
m_menus.append(menu);
return menu;
}
diff --git a/Userland/Services/Taskbar/main.cpp b/Userland/Services/Taskbar/main.cpp
index 29b0ede8b8..e64b3559c3 100644
--- a/Userland/Services/Taskbar/main.cpp
+++ b/Userland/Services/Taskbar/main.cpp
@@ -117,7 +117,7 @@ ErrorOr<Vector<DeprecatedString>> discover_apps_and_categories()
ErrorOr<NonnullRefPtr<GUI::Menu>> build_system_menu(GUI::Window& window)
{
Vector<DeprecatedString> const sorted_app_categories = TRY(discover_apps_and_categories());
- auto system_menu = TRY(GUI::Menu::try_create("\xE2\x9A\xA1")); // HIGH VOLTAGE SIGN
+ auto system_menu = TRY(GUI::Menu::try_create("\xE2\x9A\xA1"_short_string)); // HIGH VOLTAGE SIGN
system_menu->add_action(GUI::Action::create("&About SerenityOS", TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/ladyball.png"sv)), [&](auto&) {
GUI::Process::spawn_or_show_error(&window, "/bin/About"sv);