Changeset View
Changeset View
Standalone View
Standalone View
src/file/modifiedfileindexer.cpp
Show All 39 Lines | 39 | { | |||
---|---|---|---|---|---|
40 | Q_ASSERT(m_db); | 40 | Q_ASSERT(m_db); | ||
41 | Q_ASSERT(m_config); | 41 | Q_ASSERT(m_config); | ||
42 | Q_ASSERT(!m_files.isEmpty()); | 42 | Q_ASSERT(!m_files.isEmpty()); | ||
43 | } | 43 | } | ||
44 | 44 | | |||
45 | void ModifiedFileIndexer::run() | 45 | void ModifiedFileIndexer::run() | ||
46 | { | 46 | { | ||
47 | QMimeDatabase mimeDb; | 47 | QMimeDatabase mimeDb; | ||
48 | BasicIndexingJob::IndexingLevel level = m_config->onlyBasicIndexing() ? BasicIndexingJob::NoLevel | ||||
49 | : BasicIndexingJob::MarkForContentIndexing; | ||||
48 | 50 | | |||
49 | Transaction tr(m_db, Transaction::ReadWrite); | 51 | Transaction tr(m_db, Transaction::ReadWrite); | ||
50 | 52 | | |||
51 | for (const QString& filePath : qAsConst(m_files)) { | 53 | for (const QString& filePath : qAsConst(m_files)) { | ||
52 | Q_ASSERT(!filePath.endsWith('/')); | 54 | Q_ASSERT(!filePath.endsWith('/')); | ||
53 | 55 | | |||
54 | QString fileName = filePath.mid(filePath.lastIndexOf('/') + 1); | 56 | QString fileName = filePath.mid(filePath.lastIndexOf('/') + 1); | ||
55 | if (!m_config->shouldFileBeIndexed(fileName)) { | 57 | if (!m_config->shouldFileBeIndexed(fileName)) { | ||
Show All 25 Lines | |||||
81 | bool mTimeChanged = timeInfo.mTime != fileInfo.lastModified().toTime_t(); | 83 | bool mTimeChanged = timeInfo.mTime != fileInfo.lastModified().toTime_t(); | ||
82 | bool cTimeChanged = timeInfo.cTime != fileInfo.metadataChangeTime().toTime_t(); | 84 | bool cTimeChanged = timeInfo.cTime != fileInfo.metadataChangeTime().toTime_t(); | ||
83 | 85 | | |||
84 | if (!mTimeChanged && !cTimeChanged) { | 86 | if (!mTimeChanged && !cTimeChanged) { | ||
85 | continue; | 87 | continue; | ||
86 | } | 88 | } | ||
87 | 89 | | |||
88 | // FIXME: The BasicIndexingJob extracts too much info. We only need the time | 90 | // FIXME: The BasicIndexingJob extracts too much info. We only need the time | ||
89 | BasicIndexingJob::IndexingLevel level = | | |||
90 | m_config->onlyBasicIndexing() ? BasicIndexingJob::NoLevel : BasicIndexingJob::MarkForContentIndexing; | | |||
91 | BasicIndexingJob job(filePath, mimetype, level); | 91 | BasicIndexingJob job(filePath, mimetype, level); | ||
92 | if (!job.index()) { | 92 | if (!job.index()) { | ||
93 | continue; | 93 | continue; | ||
94 | } | 94 | } | ||
95 | 95 | | |||
96 | // we can get modified events for files which do not exist | 96 | // we can get modified events for files which do not exist | ||
97 | // cause Baloo was not running and missed those events | 97 | // cause Baloo was not running and missed those events | ||
98 | if (tr.hasDocument(job.document().id())) { | 98 | if (tr.hasDocument(job.document().id())) { | ||
Show All 10 Lines |