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

FileManager: Move delete and force-delete actions to DirectoryView

This is a little bit messy since the left-side treeview also has a
delete action. Because of that, we have to put a focus-dependent action
that delegates to the relevant view-specific action in the tool bar
and menu bar.

I'm not sure yet what a good abstraction would be for this. We'll see
what we can think of.
This commit is contained in:
Andreas Kling 2020-09-13 21:38:44 +02:00
parent 174527b580
commit ef50e5aaee
5 changed files with 118 additions and 97 deletions

View file

@ -137,12 +137,18 @@ public:
GUI::Action& mkdir_action() { return *m_mkdir_action; }
GUI::Action& touch_action() { return *m_touch_action; }
GUI::Action& open_terminal_action() { return *m_open_terminal_action; }
GUI::Action& delete_action() { return *m_delete_action; }
GUI::Action& force_delete_action() { return *m_force_delete_action; }
private:
explicit DirectoryView(Mode);
const GUI::FileSystemModel& model() const { return *m_model; }
GUI::FileSystemModel& model() { return *m_model; }
void handle_selection_change();
void do_delete(bool should_confirm);
// ^GUI::ModelClient
virtual void model_did_update(unsigned) override;
@ -166,6 +172,11 @@ private:
Vector<String> m_path_history;
void add_path_to_history(const StringView& path);
enum class ConfirmBeforeDelete {
No,
Yes
};
RefPtr<GUI::TableView> m_table_view;
RefPtr<GUI::IconView> m_icon_view;
RefPtr<GUI::ColumnsView> m_columns_view;
@ -173,4 +184,6 @@ private:
RefPtr<GUI::Action> m_mkdir_action;
RefPtr<GUI::Action> m_touch_action;
RefPtr<GUI::Action> m_open_terminal_action;
RefPtr<GUI::Action> m_delete_action;
RefPtr<GUI::Action> m_force_delete_action;
};