FileManager: Add launch handler actions to desktop context menu

Extracted a method from the code in the File Manager application which
added actions for activating launch handlers found for the selected
file from the context menu. Applied this method to desktop files
and shortcuts.

Note: made some launch handler related methods in the DirectoryView
static or const which allows passing const DirectoryView& to certain
methods.
This commit is contained in:
Zac 2021-03-03 21:00:32 +10:00 committed by Andreas Kling
commit 6d68ae45b4
Notes: sideshowbarker 2024-07-18 21:44:51 +09:00
3 changed files with 70 additions and 42 deletions

View file

@ -74,12 +74,12 @@ public:
int path_history_size() const { return m_path_history.size(); }
int path_history_position() const { return m_path_history_position; }
static RefPtr<LauncherHandler> get_default_launch_handler(const NonnullRefPtrVector<LauncherHandler>& handlers);
NonnullRefPtrVector<LauncherHandler> get_launch_handlers(const URL& url);
NonnullRefPtrVector<LauncherHandler> get_launch_handlers(const String& path);
static NonnullRefPtrVector<LauncherHandler> get_launch_handlers(const URL& url);
static NonnullRefPtrVector<LauncherHandler> get_launch_handlers(const String& path);
void refresh();
void launch(const URL&, const LauncherHandler&);
void launch(const URL&, const LauncherHandler&) const;
Function<void(const StringView& path, bool can_write_in_path)> on_path_change;
Function<void(GUI::AbstractView&)> on_selection_change;