diff options
author | Tom <tomut@yahoo.com> | 2020-07-14 09:36:00 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-15 00:11:30 +0200 |
commit | 7739497e34f7617cb2f6d838cc3710596b91d13e (patch) | |
tree | a4b3bfb2ea161afb40a5103033d16953cbe65407 /Libraries/LibDesktop | |
parent | 8ae37bccf1310652aa5318af9ccad6e4bdea4494 (diff) | |
download | serenity-7739497e34f7617cb2f6d838cc3710596b91d13e.zip |
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.
Diffstat (limited to 'Libraries/LibDesktop')
-rw-r--r-- | Libraries/LibDesktop/Launcher.cpp | 5 | ||||
-rw-r--r-- | Libraries/LibDesktop/Launcher.h | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Libraries/LibDesktop/Launcher.cpp b/Libraries/LibDesktop/Launcher.cpp index 8a42beebc8..39b6888810 100644 --- a/Libraries/LibDesktop/Launcher.cpp +++ b/Libraries/LibDesktop/Launcher.cpp @@ -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); } diff --git a/Libraries/LibDesktop/Launcher.h b/Libraries/LibDesktop/Launcher.h index 0dc0748231..3a42b1ae82 100644 --- a/Libraries/LibDesktop/Launcher.h +++ b/Libraries/LibDesktop/Launcher.h @@ -38,6 +38,7 @@ class Launcher { public: enum class LauncherType { Default = 0, + Application, UserPreferred, UserDefault }; |