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

FileManager: Allow double-clicking applications again

By adding a special LauncherType::Application we can still
get meta data for the application, but also know that we should
consider executing that binary as the default action. LaunchServer
will not do this for us, as it should probably not be allowed to
run arbitrary binaries that haven't been registered as handlers.
This commit is contained in:
Tom 2020-07-14 09:36:00 -06:00 committed by Andreas Kling
parent 8ae37bccf1
commit 7739497e34
7 changed files with 45 additions and 17 deletions

View file

@ -44,7 +44,9 @@ auto Launcher::Details::from_details_str(const String& details_str) -> NonnullRe
details->name = obj.get("name").to_string();
if (auto type_value = obj.get_ptr("type")) {
auto type_str = type_value->to_string();
if (type_str == "userpreferred")
if (type_str == "app")
details->launcher_type = LauncherType::Application;
else if (type_str == "userpreferred")
details->launcher_type = LauncherType::UserPreferred;
else if (type_str == "userdefault")
details->launcher_type = LauncherType::UserDefault;
@ -83,6 +85,7 @@ bool Launcher::open(const URL& url, const String& handler_name)
bool Launcher::open(const URL& url, const Details& details)
{
ASSERT(details.launcher_type != LauncherType::Application); // Launcher should not be used to execute arbitrary applications
return open(url, details.executable);
}