| 29 | } |
| 30 | |
| 31 | QList<QPair<QString, QString>> ComicFilesManager::getDroppedFiles(const QList<QUrl> &urls) |
| 32 | { |
| 33 | QList<QPair<QString, QString>> dropedFiles; |
| 34 | |
| 35 | QString currentPath; |
| 36 | for (const auto &url : urls) { |
| 37 | currentPath = url.toLocalFile(); |
| 38 | if (currentPath.endsWith('/')) |
| 39 | currentPath = currentPath.remove(currentPath.length() - 1, 1); // QTBUG-35896 QUrl.toLocalFile inconsistency. |
| 40 | if (Comic::fileIsComic(currentPath)) |
| 41 | dropedFiles << QPair<QString, QString>(currentPath, "/"); |
| 42 | else { |
| 43 | QLOG_DEBUG() << "XXXXXXXXXXXX :" << currentPath; |
| 44 | QFileInfo info(currentPath); |
| 45 | if (info.isDir()) { |
| 46 | QLOG_DEBUG() << "origin path prior to absoluteFilePath : " << info.absolutePath(); |
| 47 | const auto comicPaths = Comic::findValidComicFilesInFolder(info.absoluteFilePath()); |
| 48 | for (const auto &comicPath : comicPaths) { |
| 49 | QFileInfo comicInfo(comicPath); |
| 50 | QString path = comicInfo.absolutePath(); |
| 51 | QLOG_DEBUG() << "comic path : " << comicPath; |
| 52 | QLOG_DEBUG() << "full comic path : " << path; |
| 53 | QLOG_DEBUG() << "origin path : " << info.absolutePath(); |
| 54 | dropedFiles << QPair<QString, QString>(comicPath, path.remove(info.absolutePath())); |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | return dropedFiles; |
| 61 | } |
| 62 | |
| 63 | void ComicFilesManager::process() |
| 64 | { |