1
/* This file is part of the KDE Project
2
Copyright (c) 2009-2011 Sebastian Trueg <trueg@kde.org>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License version 2 as published by the Free Software Foundation.
8
This library is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
Library General Public License for more details.
13
You should have received a copy of the GNU Library General Public License
14
along with this library; see the file COPYING.LIB. If not, write to
15
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16
Boston, MA 02110-1301, USA.
19
#ifndef _NEPOMUK_METADATA_MOVER_H_
20
#define _NEPOMUK_METADATA_MOVER_H_
22
#include <QtCore/QMutex>
23
#include <QtCore/QQueue>
24
#include <QtCore/QSet>
25
#include <QtCore/QDateTime>
29
#include "updaterequest.h"
38
class MetadataMover : public QObject
43
MetadataMover( Soprano::Model* model, QObject* parent = 0 );
47
void moveFileMetadata( const KUrl& from, const KUrl& to );
48
void removeFileMetadata( const KUrl& file );
49
void removeFileMetadata( const KUrl::List& files );
53
* Emitted for files (and folders) that have been moved but
54
* do not have metadata to be moved. This allows the file indexer
55
* service to pick them up in case they are of interest. The
56
* typical example would be moving a file from a non-indexed into
59
void movedWithoutData( const QString& path );
62
void slotClearRecentlyFinishedRequests();
63
void slotWorkUpdateQueue();
66
* Start the update queue from the main thread.
68
void slotStartUpdateTimer();
72
* Remove the metadata for file \p url
74
void removeMetadata( const KUrl& url );
77
* Recursively update the nie:url and nie:isPartOf properties
78
* of the resource describing \p from.
80
void updateMetadata( const KUrl& from, const KUrl& to );
82
// if the second url is empty, just delete the metadata
83
QQueue<UpdateRequest> m_updateQueue;
85
// we use several systems to watch for file operations.
86
// Thus, we can get the same request more than once. We then
87
// need a way to determine if we have already handled it.
88
// (otherwise we would remove the previously moved data.)
89
// The only way to do that is to keep a list of all requests
90
// that have been handled in the last N seconds.
91
QSet<UpdateRequest> m_recentlyFinishedRequests;
96
QTimer* m_recentlyFinishedRequestsTimer;
98
Soprano::Model* m_model;