Changeset View
Changeset View
Standalone View
Standalone View
src/file/localfilelisting.cpp
Show All 29 Lines | |||||
30 | #include <QDebug> | 30 | #include <QDebug> | ||
31 | 31 | | |||
32 | #include <algorithm> | 32 | #include <algorithm> | ||
33 | 33 | | |||
34 | class LocalFileListingPrivate | 34 | class LocalFileListingPrivate | ||
35 | { | 35 | { | ||
36 | public: | 36 | public: | ||
37 | 37 | | |||
38 | QString mRootPath; | | |||
39 | | ||||
40 | }; | 38 | }; | ||
41 | 39 | | |||
42 | LocalFileListing::LocalFileListing(QObject *parent) : AbstractFileListing(QStringLiteral("local"), parent), d(std::make_unique<LocalFileListingPrivate>()) | 40 | LocalFileListing::LocalFileListing(QObject *parent) : AbstractFileListing(parent), d(std::make_unique<LocalFileListingPrivate>()) | ||
43 | { | 41 | { | ||
44 | } | 42 | } | ||
45 | 43 | | |||
46 | LocalFileListing::~LocalFileListing() | 44 | LocalFileListing::~LocalFileListing() | ||
47 | = default; | 45 | = default; | ||
48 | 46 | | |||
49 | QString LocalFileListing::rootPath() const | | |||
50 | { | | |||
51 | return d->mRootPath; | | |||
52 | } | | |||
53 | | ||||
54 | void LocalFileListing::setRootPath(const QString &rootPath) | | |||
55 | { | | |||
56 | if (d->mRootPath == rootPath) { | | |||
57 | return; | | |||
58 | } | | |||
59 | | ||||
60 | d->mRootPath = rootPath; | | |||
61 | Q_EMIT rootPathChanged(); | | |||
62 | | ||||
63 | setSourceName(rootPath); | | |||
64 | } | | |||
65 | | ||||
66 | void LocalFileListing::executeInit(QHash<QUrl, QDateTime> allFiles) | 47 | void LocalFileListing::executeInit(QHash<QUrl, QDateTime> allFiles) | ||
67 | { | 48 | { | ||
68 | AbstractFileListing::executeInit(std::move(allFiles)); | 49 | AbstractFileListing::executeInit(std::move(allFiles)); | ||
69 | } | 50 | } | ||
70 | 51 | | |||
71 | void LocalFileListing::triggerRefreshOfContent() | 52 | void LocalFileListing::triggerRefreshOfContent() | ||
72 | { | 53 | { | ||
73 | Q_EMIT indexingStarted(); | 54 | Q_EMIT indexingStarted(); | ||
74 | 55 | | |||
75 | AbstractFileListing::triggerRefreshOfContent(); | 56 | AbstractFileListing::triggerRefreshOfContent(); | ||
76 | 57 | | |||
77 | scanDirectoryTree(d->mRootPath); | 58 | const auto &rootPaths = allRootPaths(); | ||
59 | for (const auto &onePath : rootPaths) { | ||||
60 | scanDirectoryTree(onePath); | ||||
61 | } | ||||
62 | | ||||
63 | setWaitEndTrackRemoval(false); | ||||
78 | 64 | | |||
79 | checkFilesToRemove(); | 65 | checkFilesToRemove(); | ||
80 | 66 | | |||
67 | if (!waitEndTrackRemoval()) { | ||||
81 | Q_EMIT indexingFinished(); | 68 | Q_EMIT indexingFinished(); | ||
82 | } | 69 | } | ||
70 | } | ||||
83 | 71 | | |||
84 | 72 | | |||
85 | #include "moc_localfilelisting.cpp" | 73 | #include "moc_localfilelisting.cpp" |