1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 17:55:07 +00:00

FileManager: Copy item(s) when dragging and dropping them :^)

This patch implements basic drag & drop file management in a narrow set
of cases. You can now drag & drop a file onto a folder in the same
directory, and the dropped file will be copied into the directory.

We'll need to support a lot more variations of this, but this is nice!
This commit is contained in:
Andreas Kling 2020-02-13 21:55:05 +01:00
parent 95fe78667f
commit 4dc15fc063
3 changed files with 49 additions and 0 deletions

View file

@ -200,6 +200,19 @@ DirectoryView::DirectoryView(GUI::Widget* parent)
on_context_menu_request(*m_columns_view, index, event);
};
m_table_view->on_drop = [this](auto& index, auto& event) {
if (on_drop)
on_drop(*m_table_view, index, event);
};
m_item_view->on_drop = [this](auto& index, auto& event) {
if (on_drop)
on_drop(*m_item_view, index, event);
};
m_columns_view->on_drop = [this](auto& index, auto& event) {
if (on_drop)
on_drop(*m_columns_view, index, event);
};
set_view_mode(ViewMode::Icon);
}