| 76 | } |
| 77 | |
| 78 | void ComicsView::dragEnterEvent(QDragEnterEvent *event) |
| 79 | { |
| 80 | if (model->canDropMimeData(event->mimeData(), event->proposedAction(), 0, 0, QModelIndex())) |
| 81 | event->acceptProposedAction(); |
| 82 | else { |
| 83 | QLOG_TRACE() << "dragEnterEvent"; |
| 84 | if (event->mimeData()->hasUrls() && event->dropAction() == Qt::CopyAction) { |
| 85 | const auto urlList = event->mimeData()->urls(); |
| 86 | QString currentPath; |
| 87 | for (const auto &url : urlList) { |
| 88 | // comics or folders are accepted, folders' content is validate in dropEvent (avoid any lag before droping) |
| 89 | currentPath = url.toLocalFile(); |
| 90 | if (Comic::fileIsComic(currentPath) || QFileInfo(currentPath).isDir()) { |
| 91 | event->acceptProposedAction(); |
| 92 | return; |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | void ComicsView::dropEvent(QDropEvent *event) |
| 100 | { |
nothing calls this directly
no test coverage detected