| 618 | } |
| 619 | |
| 620 | bool ModListSortProxy::dropMimeData(const QMimeData* data, Qt::DropAction action, |
| 621 | int row, int column, const QModelIndex& parent) |
| 622 | { |
| 623 | ModListDropInfo dropInfo(data, *m_Organizer); |
| 624 | |
| 625 | if (!dropInfo.isLocalFileDrop() && sortColumn() != ModList::COL_PRIORITY) { |
| 626 | QWidget* wid = qApp->activeWindow()->findChild<QTreeView*>("modList"); |
| 627 | MessageDialog::showMessage( |
| 628 | tr("Drag&Drop is only supported when sorting by priority"), wid); |
| 629 | return false; |
| 630 | } |
| 631 | |
| 632 | if (row == -1 && column == -1) { |
| 633 | return sourceModel()->dropMimeData(data, action, -1, -1, mapToSource(parent)); |
| 634 | } |
| 635 | |
| 636 | // in the regular model, when dropping between rows, the row-value passed to |
| 637 | // the sourceModel is inconsistent between ascending and descending ordering |
| 638 | // |
| 639 | // we want to fix that, but we cannot do it for the by-priority proxy because |
| 640 | // it messes up with non top-level items, so we simply forward the row and the |
| 641 | // by-priority proxy will fix the row for us |
| 642 | if (sortOrder() == Qt::DescendingOrder && row != -1 && !sourceIsByPriorityProxy()) { |
| 643 | --row; |
| 644 | } |
| 645 | |
| 646 | return QSortFilterProxyModel::dropMimeData(data, action, row, column, parent); |
| 647 | } |
| 648 | |
| 649 | void ModListSortProxy::setSourceModel(QAbstractItemModel* sourceModel) |
| 650 | { |
nothing calls this directly
no test coverage detected