mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 10:57:36 +00:00
AK+Everywhere: Replace "protocol" with "scheme" url helpers
URL had properly named replacements for protocol(), set_protocol() and create_with_file_protocol() already. This patch removes these function and updates all call sites to use the functions named according to the specification. See https://url.spec.whatwg.org/#concept-url-scheme
This commit is contained in:
parent
454bf1fde0
commit
4230dbbb21
61 changed files with 113 additions and 116 deletions
|
@ -136,7 +136,7 @@ void GLContextWidget::drop_event(GUI::DropEvent& event)
|
|||
return;
|
||||
|
||||
for (auto& url : event.mime_data().urls()) {
|
||||
if (url.protocol() != "file")
|
||||
if (url.scheme() != "file")
|
||||
continue;
|
||||
|
||||
auto response = FileSystemAccessClient::Client::the().try_request_file(window(), url.path(), Core::OpenMode::ReadOnly);
|
||||
|
|
|
@ -44,7 +44,7 @@ void CalculatorResult::activate() const
|
|||
|
||||
void FileResult::activate() const
|
||||
{
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(title()));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(title()));
|
||||
}
|
||||
|
||||
void TerminalResult::activate() const
|
||||
|
|
|
@ -273,7 +273,7 @@ Vector<Web::Cookie::Cookie&> CookieJar::get_matching_cookies(const URL& url, Str
|
|||
continue;
|
||||
|
||||
// If the cookie's secure-only-flag is true, then the request-uri's scheme must denote a "secure" protocol.
|
||||
if (cookie.value.secure && (url.protocol() != "https"))
|
||||
if (cookie.value.secure && (url.scheme() != "https"))
|
||||
continue;
|
||||
|
||||
// If the cookie's http-only-flag is true, then exclude the cookie if the cookie-string is being generated for a "non-HTTP" API.
|
||||
|
|
|
@ -155,7 +155,7 @@ void DownloadWidget::did_finish(bool success)
|
|||
m_close_button->set_enabled(true);
|
||||
m_cancel_button->set_text("Open in Folder");
|
||||
m_cancel_button->on_click = [this](auto) {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(Core::StandardPaths::downloads_directory(), m_url.basename()));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(Core::StandardPaths::downloads_directory(), m_url.basename()));
|
||||
window()->close();
|
||||
};
|
||||
m_cancel_button->update();
|
||||
|
|
|
@ -77,7 +77,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
// Connect to LaunchServer immediately and let it know that we won't ask for anything other than opening
|
||||
// the user's downloads directory.
|
||||
// FIXME: This should go away with a standalone download manager at some point.
|
||||
TRY(Desktop::Launcher::add_allowed_url(URL::create_with_file_protocol(Core::StandardPaths::downloads_directory())));
|
||||
TRY(Desktop::Launcher::add_allowed_url(URL::create_with_file_scheme(Core::StandardPaths::downloads_directory())));
|
||||
TRY(Desktop::Launcher::seal_allowlist());
|
||||
|
||||
TRY(Core::System::unveil("/home", "rwc"));
|
||||
|
@ -120,7 +120,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto url_from_argument_string = [](String const& string) -> URL {
|
||||
if (Core::File::exists(string)) {
|
||||
return URL::create_with_file_protocol(Core::File::real_path_for(string));
|
||||
return URL::create_with_file_scheme(Core::File::real_path_for(string));
|
||||
}
|
||||
return Browser::url_from_user_input(string);
|
||||
};
|
||||
|
|
|
@ -158,7 +158,7 @@ void CharacterMapWidget::initialize_menubar(GUI::Window& window)
|
|||
|
||||
auto& help_menu = window.add_menu("&Help");
|
||||
help_menu.add_action(GUI::CommonActions::make_help_action([&](auto&) {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/CharacterMap.md"), "/bin/Help");
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/CharacterMap.md"), "/bin/Help");
|
||||
}));
|
||||
help_menu.add_action(GUI::CommonActions::make_about_action("Character Map", GUI::Icon::default_icon("app-character-map"sv), &window));
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
Config::pledge_domain("CharacterMap");
|
||||
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_protocol("/usr/share/man/man1/CharacterMap.md") }));
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man1/CharacterMap.md") }));
|
||||
TRY(Desktop::Launcher::seal_allowlist());
|
||||
|
||||
TRY(Core::System::pledge("stdio recvfd sendfd rpath"));
|
||||
|
|
|
@ -200,14 +200,14 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
executable_link_label.set_text(LexicalPath::canonicalized_path(executable_path));
|
||||
executable_link_label.on_click = [&] {
|
||||
LexicalPath path { executable_path };
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(path.dirname(), path.basename()));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
|
||||
};
|
||||
|
||||
auto& coredump_link_label = *widget->find_descendant_of_type_named<GUI::LinkLabel>("coredump_link");
|
||||
coredump_link_label.set_text(LexicalPath::canonicalized_path(coredump_path));
|
||||
coredump_link_label.on_click = [&] {
|
||||
LexicalPath path { coredump_path };
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(path.dirname(), path.basename()));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
|
||||
};
|
||||
|
||||
auto& arguments_label = *widget->find_descendant_of_type_named<GUI::Label>("arguments_label");
|
||||
|
|
|
@ -67,14 +67,14 @@ void BackgroundSettingsWidget::create_frame()
|
|||
m_context_menu = GUI::Menu::construct();
|
||||
m_show_in_file_manager_action = GUI::Action::create("Show in File Manager", Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors(), [this](GUI::Action const&) {
|
||||
LexicalPath path { m_monitor_widget->wallpaper() };
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(path.dirname(), path.basename()));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
|
||||
});
|
||||
m_context_menu->add_action(*m_show_in_file_manager_action);
|
||||
|
||||
m_context_menu->add_separator();
|
||||
m_copy_action = GUI::CommonActions::make_copy_action(
|
||||
[this](auto&) {
|
||||
auto url = URL::create_with_file_protocol(m_monitor_widget->wallpaper()).to_string();
|
||||
auto url = URL::create_with_file_scheme(m_monitor_widget->wallpaper()).to_string();
|
||||
GUI::Clipboard::the().set_data(url.bytes(), "text/uri-list");
|
||||
},
|
||||
this);
|
||||
|
|
|
@ -88,7 +88,7 @@ NonnullRefPtrVector<LauncherHandler> DirectoryView::get_launch_handlers(URL cons
|
|||
|
||||
NonnullRefPtrVector<LauncherHandler> DirectoryView::get_launch_handlers(String const& path)
|
||||
{
|
||||
return get_launch_handlers(URL::create_with_file_protocol(path));
|
||||
return get_launch_handlers(URL::create_with_file_scheme(path));
|
||||
}
|
||||
|
||||
void DirectoryView::handle_activation(GUI::ModelIndex const& index)
|
||||
|
@ -107,14 +107,14 @@ void DirectoryView::handle_activation(GUI::ModelIndex const& index)
|
|||
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
if (is_desktop()) {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(path));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(path));
|
||||
return;
|
||||
}
|
||||
open(path);
|
||||
return;
|
||||
}
|
||||
|
||||
auto url = URL::create_with_file_protocol(path);
|
||||
auto url = URL::create_with_file_scheme(path);
|
||||
auto launcher_handlers = get_launch_handlers(url);
|
||||
auto default_launcher = get_default_launch_handler(launcher_handlers);
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ PropertiesWindow::PropertiesWindow(String const& path, bool disable_rename, Wind
|
|||
auto location = general_tab.find_descendant_of_type_named<GUI::LinkLabel>("location");
|
||||
location->set_text(path);
|
||||
location->on_click = [this] {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(m_parent_path, m_name));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(m_parent_path, m_name));
|
||||
};
|
||||
|
||||
if (S_ISLNK(m_mode)) {
|
||||
|
@ -104,7 +104,7 @@ PropertiesWindow::PropertiesWindow(String const& path, bool disable_rename, Wind
|
|||
link_location->set_text(link_destination);
|
||||
link_location->on_click = [link_destination] {
|
||||
auto link_directory = LexicalPath(link_destination);
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(link_directory.dirname(), link_directory.basename()));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(link_directory.dirname(), link_directory.basename()));
|
||||
};
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -139,7 +139,7 @@ void do_copy(Vector<String> const& selected_file_paths, FileOperation file_opera
|
|||
copy_text.append("#cut\n"sv); // This exploits the comment lines in the text/uri-list specification, which might be a bit hackish
|
||||
}
|
||||
for (auto& path : selected_file_paths) {
|
||||
auto url = URL::create_with_file_protocol(path);
|
||||
auto url = URL::create_with_file_scheme(path);
|
||||
copy_text.appendff("{}\n", url);
|
||||
}
|
||||
GUI::Clipboard::the().set_data(copy_text.build().bytes(), "text/uri-list");
|
||||
|
@ -169,7 +169,7 @@ void do_paste(String const& target_directory, GUI::Window* window)
|
|||
if (uri_as_string.is_empty())
|
||||
continue;
|
||||
URL url = uri_as_string;
|
||||
if (!url.is_valid() || url.protocol() != "file") {
|
||||
if (!url.is_valid() || url.scheme() != "file") {
|
||||
dbgln("Cannot paste URI {}", uri_as_string);
|
||||
continue;
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ bool add_launch_handler_actions_to_menu(RefPtr<GUI::Menu>& menu, DirectoryView c
|
|||
auto default_file_handler = directory_view.get_default_launch_handler(current_file_launch_handlers);
|
||||
if (default_file_handler) {
|
||||
auto file_open_action = default_file_handler->create_launch_action([&, full_path = move(full_path)](auto& launcher_handler) {
|
||||
directory_view.launch(URL::create_with_file_protocol(full_path), launcher_handler);
|
||||
directory_view.launch(URL::create_with_file_scheme(full_path), launcher_handler);
|
||||
});
|
||||
if (default_file_handler->details().launcher_type == Desktop::Launcher::LauncherType::Application)
|
||||
file_open_action->set_text(String::formatted("Run {}", file_open_action->text()));
|
||||
|
@ -331,7 +331,7 @@ bool add_launch_handler_actions_to_menu(RefPtr<GUI::Menu>& menu, DirectoryView c
|
|||
if (&handler == default_file_handler.ptr())
|
||||
continue;
|
||||
file_open_with_menu.add_action(handler.create_launch_action([&, full_path = move(full_path)](auto& launcher_handler) {
|
||||
directory_view.launch(URL::create_with_file_protocol(full_path), launcher_handler);
|
||||
directory_view.launch(URL::create_with_file_scheme(full_path), launcher_handler);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
@ -444,13 +444,13 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
auto file_manager_action = GUI::Action::create("Open in File &Manager", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-file-manager.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
|
||||
auto paths = directory_view->selected_file_paths();
|
||||
if (paths.is_empty()) {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(directory_view->path()));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(directory_view->path()));
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& path : paths) {
|
||||
if (Core::File::is_directory(path))
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(path));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(path));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -469,7 +469,7 @@ ErrorOr<int> run_in_desktop_mode()
|
|||
});
|
||||
|
||||
auto display_properties_action = GUI::Action::create("&Display Settings", {}, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-display-settings.png"sv).release_value_but_fixme_should_propagate_errors(), [&](GUI::Action const&) {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol("/bin/DisplaySettings"));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme("/bin/DisplaySettings"));
|
||||
});
|
||||
|
||||
TRY(desktop_view_context_menu->try_add_action(directory_view->mkdir_action()));
|
||||
|
@ -801,7 +801,7 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const&
|
|||
|
||||
for (auto& path : paths) {
|
||||
if (Core::File::is_directory(path))
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(path));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(path));
|
||||
}
|
||||
},
|
||||
window);
|
||||
|
|
|
@ -670,7 +670,7 @@ ErrorOr<void> MainWidget::initialize_menubar(GUI::Window& window)
|
|||
|
||||
auto help_menu = TRY(window.try_add_menu("&Help"));
|
||||
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/FontEditor.md"), "/bin/Help");
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/FontEditor.md"), "/bin/Help");
|
||||
})));
|
||||
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Font Editor", TRY(GUI::Icon::try_create_default_icon("app-font-editor"sv)), &window)));
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_protocol("/usr/share/man/man1/FontEditor.md") }));
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man1/FontEditor.md") }));
|
||||
TRY(Desktop::Launcher::seal_allowlist());
|
||||
|
||||
Config::pledge_domain("FontEditor");
|
||||
|
|
|
@ -92,7 +92,7 @@ MainWidget::MainWidget()
|
|||
|
||||
m_web_view = find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view");
|
||||
m_web_view->on_link_click = [this](auto& url, auto&, unsigned) {
|
||||
if (url.protocol() == "file") {
|
||||
if (url.scheme() == "file") {
|
||||
auto path = url.path();
|
||||
if (!path.starts_with("/usr/share/man/"sv)) {
|
||||
open_external(url);
|
||||
|
@ -106,7 +106,7 @@ MainWidget::MainWidget()
|
|||
}
|
||||
m_history.push(path);
|
||||
open_page(path);
|
||||
} else if (url.protocol() == "help") {
|
||||
} else if (url.scheme() == "help") {
|
||||
if (url.host() == "man") {
|
||||
if (url.paths().size() != 2) {
|
||||
dbgln("Bad help page URL '{}'", url);
|
||||
|
@ -272,7 +272,7 @@ void MainWidget::open_url(URL const& url)
|
|||
m_go_back_action->set_enabled(m_history.can_go_back());
|
||||
m_go_forward_action->set_enabled(m_history.can_go_forward());
|
||||
|
||||
if (url.protocol() == "file") {
|
||||
if (url.scheme() == "file") {
|
||||
m_web_view->load(url);
|
||||
m_web_view->scroll_to_top();
|
||||
|
||||
|
|
|
@ -470,7 +470,7 @@ void HexEditorWidget::initialize_menubar(GUI::Window& window)
|
|||
|
||||
auto& help_menu = window.add_menu("&Help");
|
||||
help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/HexEditor.md"), "/bin/Help");
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/HexEditor.md"), "/bin/Help");
|
||||
}));
|
||||
help_menu.add_action(GUI::CommonActions::make_about_action("Hex Editor", GUI::Icon::default_icon("app-hex-editor"sv), &window));
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_protocol("/usr/share/man/man1/HexEditor.md") }));
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man1/HexEditor.md") }));
|
||||
TRY(Desktop::Launcher::seal_allowlist());
|
||||
|
||||
Config::pledge_domain("HexEditor");
|
||||
|
|
|
@ -40,7 +40,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_any_url("/bin/ImageViewer"));
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_protocol("/usr/share/man/man1/ImageViewer.md") }));
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_scheme("/usr/share/man/man1/ImageViewer.md") }));
|
||||
TRY(Desktop::Launcher::seal_allowlist());
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("filetype-image"sv);
|
||||
|
@ -97,7 +97,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
widget->load_from_file(path);
|
||||
|
||||
for (size_t i = 1; i < urls.size(); ++i) {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(urls[i].path().characters()), "/bin/ImageViewer");
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(urls[i].path().characters()), "/bin/ImageViewer");
|
||||
}
|
||||
};
|
||||
widget->on_doubleclick = [&] {
|
||||
|
@ -330,7 +330,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto help_menu = TRY(window->try_add_menu("&Help"));
|
||||
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/ImageViewer.md"), "/bin/Help");
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/ImageViewer.md"), "/bin/Help");
|
||||
})));
|
||||
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Image Viewer", app_icon, window)));
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ bool MailWidget::connect_and_login()
|
|||
if (server.is_empty()) {
|
||||
auto result = GUI::MessageBox::show(window(), "Mail has no servers configured. Do you want configure them now?"sv, "Error"sv, GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::YesNo);
|
||||
if (result == GUI::MessageBox::ExecResult::Yes)
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol("/bin/MailSettings"));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme("/bin/MailSettings"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil("/tmp/user/%uid/portal/launch", "rw"));
|
||||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
|
||||
TRY(Desktop::Launcher::add_allowed_url(URL::create_with_file_protocol("/bin/MailSettings")));
|
||||
TRY(Desktop::Launcher::add_allowed_url(URL::create_with_file_scheme("/bin/MailSettings")));
|
||||
TRY(Desktop::Launcher::add_allowed_handler_with_any_url("/bin/MailSettings"));
|
||||
TRY(Desktop::Launcher::seal_allowlist());
|
||||
|
||||
|
|
|
@ -1058,7 +1058,7 @@ void MainWidget::drop_event(GUI::DropEvent& event)
|
|||
return;
|
||||
|
||||
for (auto& url : event.mime_data().urls()) {
|
||||
if (url.protocol() != "file")
|
||||
if (url.scheme() != "file")
|
||||
continue;
|
||||
|
||||
auto response = FileSystemAccessClient::Client::the().try_request_file(window(), url.path(), Core::OpenMode::ReadOnly);
|
||||
|
|
|
@ -142,7 +142,7 @@ bool RunWindow::run_via_launch(String const& run_input)
|
|||
{
|
||||
auto url = URL::create_with_url_or_path(run_input);
|
||||
|
||||
if (url.protocol() == "file") {
|
||||
if (url.scheme() == "file") {
|
||||
auto real_path = Core::File::real_path_for(url.path());
|
||||
if (real_path.is_null()) {
|
||||
// errno *should* be preserved from Core::File::real_path_for().
|
||||
|
|
|
@ -337,11 +337,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
// Configure the nodes context menu.
|
||||
auto open_folder_action = GUI::Action::create("Open Folder", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(get_absolute_path_to_selected_node(treemapwidget)));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(get_absolute_path_to_selected_node(treemapwidget)));
|
||||
});
|
||||
auto open_containing_folder_action = GUI::Action::create("Open Containing Folder", { Mod_Ctrl, Key_O }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
|
||||
LexicalPath path { get_absolute_path_to_selected_node(treemapwidget) };
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol(path.dirname(), path.basename()));
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme(path.dirname(), path.basename()));
|
||||
});
|
||||
auto copy_path_action = GUI::Action::create("Copy Path to Clipboard", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), [&](auto&) {
|
||||
GUI::Clipboard::the().set_plain_text(get_absolute_path_to_selected_node(treemapwidget));
|
||||
|
|
|
@ -81,7 +81,7 @@ HelpWindow::HelpWindow(GUI::Window* parent)
|
|||
|
||||
m_webview = splitter.add<WebView::OutOfProcessWebView>();
|
||||
m_webview->on_link_click = [this](auto& url, auto&, auto&&) {
|
||||
VERIFY(url.protocol() == "spreadsheet");
|
||||
VERIFY(url.scheme() == "spreadsheet");
|
||||
if (url.host() == "example") {
|
||||
auto entry = LexicalPath::basename(url.path());
|
||||
auto doc_option = m_docs.get(entry);
|
||||
|
|
|
@ -264,7 +264,7 @@ Optional<Position> Sheet::position_from_url(const URL& url) const
|
|||
return {};
|
||||
}
|
||||
|
||||
if (url.protocol() != "spreadsheet" || url.host() != "cell") {
|
||||
if (url.scheme() != "spreadsheet" || url.host() != "cell") {
|
||||
dbgln("Bad url: {}", url.to_string());
|
||||
return {};
|
||||
}
|
||||
|
@ -756,7 +756,7 @@ String Position::to_cell_identifier(Sheet const& sheet) const
|
|||
URL Position::to_url(Sheet const& sheet) const
|
||||
{
|
||||
URL url;
|
||||
url.set_protocol("spreadsheet");
|
||||
url.set_scheme("spreadsheet");
|
||||
url.set_host("cell");
|
||||
url.set_paths({ String::number(getpid()) });
|
||||
url.set_fragment(to_cell_identifier(sheet));
|
||||
|
|
|
@ -412,7 +412,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
auto help_menu = TRY(window->try_add_menu("&Help"));
|
||||
TRY(help_menu->try_add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/Terminal.md"), "/bin/Help");
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/Terminal.md"), "/bin/Help");
|
||||
})));
|
||||
TRY(help_menu->try_add_action(GUI::CommonActions::make_about_action("Terminal", app_icon, window)));
|
||||
|
||||
|
|
|
@ -618,7 +618,7 @@ void MainWidget::initialize_menubar(GUI::Window& window)
|
|||
|
||||
auto& help_menu = window.add_menu("&Help");
|
||||
help_menu.add_action(GUI::CommonActions::make_help_action([](auto&) {
|
||||
Desktop::Launcher::open(URL::create_with_file_protocol("/usr/share/man/man1/TextEditor.md"), "/bin/Help");
|
||||
Desktop::Launcher::open(URL::create_with_file_scheme("/usr/share/man/man1/TextEditor.md"), "/bin/Help");
|
||||
}));
|
||||
help_menu.add_action(GUI::CommonActions::make_about_action("Text Editor", GUI::Icon::default_icon("app-text-editor"sv), &window));
|
||||
|
||||
|
@ -813,7 +813,7 @@ void MainWidget::update_markdown_preview()
|
|||
if (document) {
|
||||
auto html = document->render_to_html();
|
||||
auto current_scroll_pos = m_page_view->visible_content_rect();
|
||||
m_page_view->load_html(html, URL::create_with_file_protocol(m_path));
|
||||
m_page_view->load_html(html, URL::create_with_file_scheme(m_path));
|
||||
m_page_view->scroll_into_view(current_scroll_pos, true, true);
|
||||
}
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ void MainWidget::update_markdown_preview()
|
|||
void MainWidget::update_html_preview()
|
||||
{
|
||||
auto current_scroll_pos = m_page_view->visible_content_rect();
|
||||
m_page_view->load_html(m_editor->text(), URL::create_with_file_protocol(m_path));
|
||||
m_page_view->load_html(m_editor->text(), URL::create_with_file_scheme(m_path));
|
||||
m_page_view->scroll_into_view(current_scroll_pos, true, true);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue