1 | /* |
---|---|
2 | This file is part of the KDE Baloo Project |
3 | SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.1-or-later |
6 | */ |
7 | |
8 | #include "pendingfile.h" |
9 | #include "baloodebug.h" |
10 | |
11 | using namespace Baloo; |
12 | |
13 | PendingFile::PendingFile(const QString& path) |
14 | : m_path(path) |
15 | , m_created(false) |
16 | , m_closedOnWrite(false) |
17 | , m_attributesChanged(false) |
18 | , m_deleted(false) |
19 | , m_modified(false) |
20 | { |
21 | } |
22 | |
23 | QString PendingFile::path() const |
24 | { |
25 | return m_path; |
26 | } |
27 | |
28 | bool PendingFile::isNewFile() const |
29 | { |
30 | return m_created; |
31 | } |
32 | |
33 | bool PendingFile::shouldIndexContents() const |
34 | { |
35 | if (m_created || m_closedOnWrite || m_modified) { |
36 | return true; |
37 | } |
38 | return false; |
39 | } |
40 | |
41 | bool PendingFile::shouldIndexXAttrOnly() const |
42 | { |
43 | if (m_attributesChanged && !shouldIndexContents()) { |
44 | return true; |
45 | } |
46 | return false; |
47 | } |
48 | |
49 | bool PendingFile::shouldRemoveIndex() const |
50 | { |
51 | return m_deleted; |
52 | } |
53 | |
54 | void PendingFile::merge(const PendingFile& file) |
55 | { |
56 | m_attributesChanged |= file.m_attributesChanged; |
57 | m_closedOnWrite |= file.m_closedOnWrite; |
58 | m_created |= file.m_created; |
59 | m_modified |= file.m_modified; |
60 | } |
61 | |
62 | void PendingFile::printFlags() const |
63 | { |
64 | qCDebug(BALOO) << "AttributesChanged:"<< m_attributesChanged; |
65 | qCDebug(BALOO) << "ClosedOnWrite:"<< m_closedOnWrite; |
66 | qCDebug(BALOO) << "Created:"<< m_created; |
67 | qCDebug(BALOO) << "Deleted:"<< m_deleted; |
68 | qCDebug(BALOO) << "Modified:"<< m_modified; |
69 | } |
70 |