File indexing completed on 2024-04-21 03:51:45
0001 /* 0002 This file is part of the KDE Project 0003 SPDX-FileCopyrightText: 2009-2011 Sebastian Trueg <trueg@kde.org> 0004 SPDX-FileCopyrightText: 2013-2014 Vishesh Handa <vhanda@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef BALOO_METADATA_MOVER_H_ 0010 #define BALOO_METADATA_MOVER_H_ 0011 0012 #include <QObject> 0013 0014 namespace Baloo 0015 { 0016 0017 class Database; 0018 class Transaction; 0019 0020 class MetadataMover : public QObject 0021 { 0022 Q_OBJECT 0023 0024 public: 0025 explicit MetadataMover(Database* db, QObject* parent = nullptr); 0026 ~MetadataMover() override; 0027 0028 public Q_SLOTS: 0029 void moveFileMetadata(const QString& from, const QString& to); 0030 void removeFileMetadata(const QString& file); 0031 0032 Q_SIGNALS: 0033 /** 0034 * Emitted for files (and folders) that have been moved but 0035 * do not have metadata to be moved. This allows the file indexer 0036 * service to pick them up in case they are of interest. The 0037 * typical example would be moving a file from a non-indexed into 0038 * an indexed folder. 0039 */ 0040 void movedWithoutData(const QString& path); 0041 0042 void fileRemoved(const QString& path); 0043 0044 private: 0045 /** 0046 * Remove the metadata for file \p url 0047 */ 0048 void removeMetadata(Transaction* tr, const QString& url); 0049 0050 /** 0051 * Recursively update the nie:url and nie:isPartOf properties 0052 * of the resource describing \p from. 0053 */ 0054 void updateMetadata(Transaction* tr, const QString& from, const QString& to); 0055 0056 Database* m_db; 0057 }; 0058 } 0059 0060 #endif