8 #include <Wt/WAbstractItemModel.h>
9 #include <Wt/WItemSelectionModel.h>
10 #include <Wt/WMessageBox.h>
15 =
"application/x-computers-selection";
27 const WModelIndex& target)
41 WItemSelectionModel *selection
42 =
dynamic_cast<WItemSelectionModel *
>(
event.source());
45 StandardButton result = WMessageBox::show
48 + asString(selection->selectedIndexes().size())
49 +
" files to folder '"
50 + cpp17::any_cast<WString>(target.data(ItemDataRole::Display)).toUTF8()
52 StandardButton::Yes | StandardButton::No);
54 StandardButton result = StandardButton::Yes;
57 if (result == StandardButton::Yes) {
62 std::shared_ptr<WAbstractItemModel> sourceModel = selection->model();
64 WModelIndexSet toChange = selection->selectedIndexes();
66 for (WModelIndexSet::reverse_iterator i = toChange.rbegin();
67 i != toChange.rend(); ++i) {
68 WModelIndex index = *i;
76 std::map<ItemDataRole, cpp17::any> data = model()->itemData(target);
77 data[ItemDataRole::Decoration] = index.data(ItemDataRole::Decoration);
78 sourceModel->setItemData(index, data);
virtual void dropEvent(const WDropEvent &event, const WModelIndex &target)
Drop event.
static const char * FileSelectionMimeType
Constant that indicates the mime type for a selection of files.