mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
FileManager: Add a basic context menu with copy/paste/delete/...
I also added a dummy "Properties..." action just to fill out the menu a little bit. :^) Fixes #270.
This commit is contained in:
parent
f360858836
commit
3a02bd40f8
3 changed files with 34 additions and 2 deletions
|
@ -68,12 +68,21 @@ DirectoryView::DirectoryView(GWidget* parent)
|
|||
|
||||
m_item_view->set_model_column(GDirectoryModel::Column::Name);
|
||||
|
||||
m_table_view->model()->on_update = [this] {
|
||||
update_statusbar();
|
||||
m_model->on_path_change = [this] {
|
||||
m_table_view->selection().clear();
|
||||
m_item_view->selection().clear();
|
||||
if (on_path_change)
|
||||
on_path_change(model().path());
|
||||
};
|
||||
|
||||
// NOTE: We're using the on_update hook on the GSortingProxyModel here instead of
|
||||
// the GDirectoryModel's hook. This is because GSortingProxyModel has already
|
||||
// installed an on_update hook on the GDirectoryModel internally.
|
||||
// FIXME: This is an unfortunate design. We should come up with something better.
|
||||
m_table_view->model()->on_update = [this] {
|
||||
update_statusbar();
|
||||
};
|
||||
|
||||
m_model->on_thumbnail_progress = [this](int done, int total) {
|
||||
if (on_thumbnail_progress)
|
||||
on_thumbnail_progress(done, total);
|
||||
|
@ -98,6 +107,15 @@ DirectoryView::DirectoryView(GWidget* parent)
|
|||
on_selection_change(*m_item_view);
|
||||
};
|
||||
|
||||
m_table_view->on_context_menu_request = [this](auto& index, auto& event) {
|
||||
if (on_context_menu_request)
|
||||
on_context_menu_request(*m_table_view, index, event);
|
||||
};
|
||||
m_item_view->on_context_menu_request = [this](auto& index, auto& event) {
|
||||
if (on_context_menu_request)
|
||||
on_context_menu_request(*m_item_view, index, event);
|
||||
};
|
||||
|
||||
set_view_mode(ViewMode::Icon);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue