Baloo

pendingfile.cpp
1 /*
2  This file is part of the KDE Baloo Project
3  SPDX-FileCopyrightText: 2014 Vishesh Handa <[email protected]>
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 
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 }
Represents a file which needs to be indexed.
Definition: pendingfile.h:19
Implements storage for docIds without any associated data Instantiated for:
Definition: coding.cpp:11
QString path(const QString &relativePath)
void merge(const PendingFile &file)
Takes a PendingFile file and merges its flags into the current PendingFile.
Definition: pendingfile.cpp:54
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Nov 29 2023 03:56:26 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.