1/*
2 This file is part of the KDE Baloo project.
3 SPDX-FileCopyrightText: 2015 Vishesh Handa <vhanda@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8#ifndef BALOO_UNINDEXEDFILEITERATOR_H
9#define BALOO_UNINDEXEDFILEITERATOR_H
10
11#include "filtereddiriterator.h"
12
13#include <QMimeDatabase>
14
15namespace Baloo {
16
17class Transaction;
18
19/**
20 * Iterate over all the files (and directories) under a specific directory which require
21 * indexing. This checks the following -
22 * - Config include / exclude path
23 * - Config filters
24 * - Config mimetype filters
25 * - Database for mtime differences
26 */
27class UnIndexedFileIterator
28{
29public:
30 UnIndexedFileIterator(const FileIndexerConfig* config, Transaction* transaction, const QString& folder);
31 ~UnIndexedFileIterator();
32
33 QString next();
34 QString filePath() const;
35 QString mimetype() const;
36 bool mTimeChanged() const;
37 bool cTimeChanged() const;
38
39private:
40 bool shouldIndex(const QString& filePath);
41
42 const FileIndexerConfig* m_config;
43 Transaction* m_transaction;
44 FilteredDirIterator m_iter;
45
46 QMimeDatabase m_mimeDb;
47 QString m_mimetype;
48
49 bool m_mTimeChanged;
50 bool m_cTimeChanged;
51};
52
53}
54
55#endif // BALOO_UNINDEXEDFILEITERATOR_H
56

source code of baloo/src/file/unindexedfileiterator.h