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

FileManager: Add on_selection event for DirectoryView

There needs to be a way to know when a user has selected a file. 
file_system_model->on_selection_changed only fires on directory 
change.
This commit is contained in:
Aaron Malpas 2019-09-10 23:37:55 +10:00 committed by Andreas Kling
parent 8920ece8f6
commit b894803a30
2 changed files with 10 additions and 0 deletions

View file

@ -92,6 +92,15 @@ DirectoryView::DirectoryView(GWidget* parent)
handle_activation(filter_model.map_to_target(index));
};
m_table_view->on_selection = [this](const GModelIndex&) {
if (on_selection)
on_selection(*m_table_view);
};
m_item_view->on_selection = [this](const GModelIndex&) {
if (on_selection)
on_selection(*m_item_view);
};
set_view_mode(ViewMode::Icon);
}