| 65 | |
| 66 | |
| 67 | void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & currVirtualPath, const QSet<QUrl> &pFavoriteSet) |
| 68 | { |
| 69 | // Q_ASSERT(QFileInfo(currentPath.toLocalFile()).exists()); |
| 70 | // if(QFileInfo(currentPath.toLocalFile()).exists()) |
| 71 | // return; |
| 72 | |
| 73 | QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(currentPath.toLocalFile()); |
| 74 | |
| 75 | QFileInfoList::iterator fileInfo; |
| 76 | for ( fileInfo = fileInfoList.begin(); fileInfo != fileInfoList.end(); fileInfo += 1) { |
| 77 | if (abort) { |
| 78 | return; |
| 79 | } |
| 80 | |
| 81 | QString fullFileName = fileInfo->absoluteFilePath(); |
| 82 | UBFeatureElementType featureType = UBFeaturesController::fileTypeFromUrl(fullFileName); |
| 83 | QString fileName = fileInfo->fileName(); |
| 84 | |
| 85 | QImage icon = UBFeaturesController::getIcon(fullFileName, featureType); |
| 86 | |
| 87 | if ( fullFileName.contains(".thumbnail.")) |
| 88 | continue; |
| 89 | |
| 90 | UBFeature testFeature(currVirtualPath + "/" + fileName, icon, fileName, QUrl::fromLocalFile(fullFileName), featureType); |
| 91 | |
| 92 | emit sendFeature(testFeature); |
| 93 | emit featureSent(); |
| 94 | emit scanPath(fullFileName); |
| 95 | |
| 96 | if ( pFavoriteSet.find(QUrl::fromLocalFile(fullFileName)) != pFavoriteSet.end()) { |
| 97 | //TODO send favoritePath from the controller or make favoritePath public and static |
| 98 | emit sendFeature(UBFeature( UBFeaturesController::favoritePath + "/" + fileName, icon, fileName, QUrl::fromLocalFile(fullFileName), featureType)); |
| 99 | } |
| 100 | |
| 101 | if (featureType == FEATURE_FOLDER) { |
| 102 | scanFS(QUrl::fromLocalFile(fullFileName), currVirtualPath + "/" + fileName, pFavoriteSet); |
| 103 | } |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | void UBFeaturesComputingThread::scanAll(QList<QPair<QUrl, UBFeature> > pScanningData, const QSet<QUrl> &pFavoriteSet) |
| 108 | { |
nothing calls this directly
no test coverage detected