Changeset View
Changeset View
Standalone View
Standalone View
src/file/fileindexscheduler.cpp
Show All 13 Lines | |||||
14 | * You should have received a copy of the GNU Lesser General Public | 14 | * You should have received a copy of the GNU Lesser General Public | ||
15 | * License along with this library; if not, write to the Free Software | 15 | * License along with this library; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
17 | * | 17 | * | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include "fileindexscheduler.h" | 20 | #include "fileindexscheduler.h" | ||
21 | 21 | | |||
22 | #include "baloodebug.h" | ||||
22 | #include "firstrunindexer.h" | 23 | #include "firstrunindexer.h" | ||
23 | #include "newfileindexer.h" | 24 | #include "newfileindexer.h" | ||
24 | #include "modifiedfileindexer.h" | 25 | #include "modifiedfileindexer.h" | ||
25 | #include "xattrindexer.h" | 26 | #include "xattrindexer.h" | ||
26 | #include "filecontentindexer.h" | 27 | #include "filecontentindexer.h" | ||
27 | #include "filecontentindexerprovider.h" | 28 | #include "filecontentindexerprovider.h" | ||
28 | #include "unindexedfileindexer.h" | 29 | #include "unindexedfileindexer.h" | ||
29 | #include "indexcleaner.h" | 30 | #include "indexcleaner.h" | ||
30 | 31 | | |||
31 | #include "fileindexerconfig.h" | 32 | #include "fileindexerconfig.h" | ||
32 | 33 | | |||
33 | #include <memory> | 34 | #include <memory> | ||
34 | 35 | | |||
35 | #include <QTimer> | 36 | #include <QTimer> | ||
36 | #include <QDebug> | | |||
37 | #include <QDBusConnection> | 37 | #include <QDBusConnection> | ||
38 | 38 | | |||
39 | using namespace Baloo; | 39 | using namespace Baloo; | ||
40 | 40 | | |||
41 | FileIndexScheduler::FileIndexScheduler(Database* db, FileIndexerConfig* config, QObject* parent) | 41 | FileIndexScheduler::FileIndexScheduler(Database* db, FileIndexerConfig* config, QObject* parent) | ||
42 | : QObject(parent) | 42 | : QObject(parent) | ||
43 | , m_db(db) | 43 | , m_db(db) | ||
44 | , m_config(config) | 44 | , m_config(config) | ||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Line(s) | 175 | else { | |||
176 | removeStartsWith(m_newFiles, file); | 176 | removeStartsWith(m_newFiles, file); | ||
177 | removeStartsWith(m_modifiedFiles, file); | 177 | removeStartsWith(m_modifiedFiles, file); | ||
178 | removeStartsWith(m_xattrFiles, file); | 178 | removeStartsWith(m_xattrFiles, file); | ||
179 | } | 179 | } | ||
180 | } | 180 | } | ||
181 | 181 | | |||
182 | void FileIndexScheduler::powerManagementStatusChanged(bool isOnBattery) | 182 | void FileIndexScheduler::powerManagementStatusChanged(bool isOnBattery) | ||
183 | { | 183 | { | ||
184 | qDebug() << "Power state changed"; | 184 | qCDebug(BALOO) << "Power state changed"; | ||
185 | if (isOnBattery && m_indexerState == ContentIndexing) { | 185 | if (isOnBattery && m_indexerState == ContentIndexing) { | ||
186 | qDebug() << "On battery stopping content indexer"; | 186 | qCDebug(BALOO) << "On battery stopping content indexer"; | ||
bruns: add a ", " after battery | |||||
187 | m_contentIndexer->quit(); | 187 | m_contentIndexer->quit(); | ||
188 | //TODO: Maybe we can add a special state for suspended due to being on battery. | 188 | //TODO: Maybe we can add a special state for suspended due to being on battery. | ||
189 | m_indexerState = Idle; | 189 | m_indexerState = Idle; | ||
190 | Q_EMIT stateChanged(m_indexerState); | 190 | Q_EMIT stateChanged(m_indexerState); | ||
191 | } else if (!isOnBattery) { | 191 | } else if (!isOnBattery) { | ||
192 | scheduleIndexing(); | 192 | scheduleIndexing(); | ||
193 | } | 193 | } | ||
194 | } | 194 | } | ||
195 | 195 | | |||
196 | void FileIndexScheduler::setSuspend(bool suspend) | 196 | void FileIndexScheduler::setSuspend(bool suspend) | ||
197 | { | 197 | { | ||
198 | if (suspend) { | 198 | if (suspend) { | ||
199 | qDebug() << "Suspending"; | 199 | qCDebug(BALOO) << "Suspending"; | ||
200 | if (m_indexerState == ContentIndexing) { | 200 | if (m_indexerState == ContentIndexing) { | ||
201 | m_contentIndexer->quit(); | 201 | m_contentIndexer->quit(); | ||
202 | } | 202 | } | ||
203 | m_indexerState = Suspended; | 203 | m_indexerState = Suspended; | ||
204 | Q_EMIT stateChanged(m_indexerState); | 204 | Q_EMIT stateChanged(m_indexerState); | ||
205 | } else { | 205 | } else { | ||
206 | qDebug() << "Resuming"; | 206 | qCDebug(BALOO) << "Resuming"; | ||
207 | m_indexerState = Idle; | 207 | m_indexerState = Idle; | ||
208 | // No need to emit here we'll be emitting in scheduling | 208 | // No need to emit here we'll be emitting in scheduling | ||
209 | scheduleIndexing(); | 209 | scheduleIndexing(); | ||
210 | } | 210 | } | ||
211 | } | 211 | } | ||
212 | 212 | | |||
213 | uint FileIndexScheduler::getRemainingTime() | 213 | uint FileIndexScheduler::getRemainingTime() | ||
214 | { | 214 | { | ||
Show All 33 Lines |
add a ", " after battery