File indexing completed on 2024-03-24 03:54:34
0001 /* 0002 This file is part of the KDE Baloo Project 0003 SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in> 0004 0005 SPDX-License-Identifier: LGPL-2.1-or-later 0006 */ 0007 0008 #include "pendingfile.h" 0009 #include "baloodebug.h" 0010 0011 using namespace Baloo; 0012 0013 PendingFile::PendingFile(const QString& path) 0014 : m_path(path) 0015 , m_created(false) 0016 , m_closedOnWrite(false) 0017 , m_attributesChanged(false) 0018 , m_deleted(false) 0019 , m_modified(false) 0020 { 0021 } 0022 0023 QString PendingFile::path() const 0024 { 0025 return m_path; 0026 } 0027 0028 bool PendingFile::isNewFile() const 0029 { 0030 return m_created; 0031 } 0032 0033 bool PendingFile::shouldIndexContents() const 0034 { 0035 if (m_created || m_closedOnWrite || m_modified) { 0036 return true; 0037 } 0038 return false; 0039 } 0040 0041 bool PendingFile::shouldIndexXAttrOnly() const 0042 { 0043 if (m_attributesChanged && !shouldIndexContents()) { 0044 return true; 0045 } 0046 return false; 0047 } 0048 0049 bool PendingFile::shouldRemoveIndex() const 0050 { 0051 return m_deleted; 0052 } 0053 0054 void PendingFile::merge(const PendingFile& file) 0055 { 0056 m_attributesChanged |= file.m_attributesChanged; 0057 m_closedOnWrite |= file.m_closedOnWrite; 0058 m_created |= file.m_created; 0059 m_modified |= file.m_modified; 0060 } 0061 0062 void PendingFile::printFlags() const 0063 { 0064 qCDebug(BALOO) << "AttributesChanged:" << m_attributesChanged; 0065 qCDebug(BALOO) << "ClosedOnWrite:" << m_closedOnWrite; 0066 qCDebug(BALOO) << "Created:" << m_created; 0067 qCDebug(BALOO) << "Deleted:" << m_deleted; 0068 qCDebug(BALOO) << "Modified:" << m_modified; 0069 }