Changeset View
Changeset View
Standalone View
Standalone View
src/file/indexcleaner.cpp
Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Line(s) | 48 | auto shouldDelete = [&](quint64 id) { | |||
---|---|---|---|---|---|
70 | } | 70 | } | ||
71 | 71 | | |||
72 | return false; | 72 | return false; | ||
73 | }; | 73 | }; | ||
74 | 74 | | |||
75 | const auto includeFolders = m_config->includeFolders(); | 75 | const auto includeFolders = m_config->includeFolders(); | ||
76 | for (const QString& folder : includeFolders) { | 76 | for (const QString& folder : includeFolders) { | ||
77 | quint64 id = filePathToId(QFile::encodeName(folder)); | 77 | quint64 id = filePathToId(QFile::encodeName(folder)); | ||
78 | if (id > 0) { | ||||
78 | tr.removeRecursively(id, shouldDelete); | 79 | tr.removeRecursively(id, shouldDelete); | ||
79 | } | 80 | } | ||
81 | } | ||||
80 | const auto excludeFolders = m_config->excludeFolders(); | 82 | const auto excludeFolders = m_config->excludeFolders(); | ||
81 | for (const QString& folder : excludeFolders) { | 83 | for (const QString& folder : excludeFolders) { | ||
82 | quint64 id = filePathToId(QFile::encodeName(folder)); | 84 | quint64 id = filePathToId(QFile::encodeName(folder)); | ||
83 | if (tr.hasDocument(id)) { | 85 | if (id > 0 && tr.hasDocument(id)) { | ||
84 | tr.removeRecursively(id, shouldDelete); | 86 | tr.removeRecursively(id, shouldDelete); | ||
85 | } | 87 | } | ||
86 | } | 88 | } | ||
87 | tr.commit(); | 89 | tr.commit(); | ||
88 | 90 | | |||
89 | Q_EMIT done(); | 91 | Q_EMIT done(); | ||
90 | } | 92 | } |