1 | /* |
2 | This file is part of the KDE Project |
3 | SPDX-FileCopyrightText: 2009-2011 Sebastian Trueg <trueg@kde.org> |
4 | SPDX-FileCopyrightText: 2013-2014 Vishesh Handa <vhanda@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | */ |
8 | |
9 | #ifndef BALOO_METADATA_MOVER_H_ |
10 | #define BALOO_METADATA_MOVER_H_ |
11 | |
12 | #include <QObject> |
13 | |
14 | namespace Baloo |
15 | { |
16 | |
17 | class Database; |
18 | class Transaction; |
19 | |
20 | class MetadataMover : public QObject |
21 | { |
22 | Q_OBJECT |
23 | |
24 | public: |
25 | explicit MetadataMover(Database* db, QObject* parent = nullptr); |
26 | ~MetadataMover() override; |
27 | |
28 | public Q_SLOTS: |
29 | void moveFileMetadata(const QString& from, const QString& to); |
30 | void removeFileMetadata(const QString& file); |
31 | |
32 | Q_SIGNALS: |
33 | /** |
34 | * Emitted for files (and folders) that have been moved but |
35 | * do not have metadata to be moved. This allows the file indexer |
36 | * service to pick them up in case they are of interest. The |
37 | * typical example would be moving a file from a non-indexed into |
38 | * an indexed folder. |
39 | */ |
40 | void movedWithoutData(const QString& path); |
41 | |
42 | void fileRemoved(const QString& path); |
43 | |
44 | private: |
45 | /** |
46 | * Remove the metadata for file \p url |
47 | */ |
48 | void removeMetadata(Transaction* tr, const QString& url); |
49 | |
50 | /** |
51 | * Recursively update the nie:url and nie:isPartOf properties |
52 | * of the resource describing \p from. |
53 | */ |
54 | void updateMetadata(Transaction* tr, const QString& from, const QString& to); |
55 | |
56 | Database* m_db; |
57 | }; |
58 | } |
59 | |
60 | #endif |
61 | |