Baloo

filewatch.h
1/*
2 This file is part of the KDE Project
3 SPDX-FileCopyrightText: 2007-2011 Sebastian Trueg <trueg@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef BALOO_FILE_WATCH_H_
9#define BALOO_FILE_WATCH_H_
10
11#include <QObject>
12#include "pendingfile.h"
13
14class KInotify;
15
16namespace Baloo
17{
18class Database;
19class MetadataMover;
20class FileIndexerConfig;
21class PendingFileQueue;
22class FileWatchTest;
23
24class FileWatch : public QObject
25{
27
28public:
29 FileWatch(Database* db, FileIndexerConfig* config, QObject* parent = nullptr);
30 ~FileWatch() override;
31
32public Q_SLOTS:
33 /**
34 * To be called whenever the list of indexed/excluded folders in the config
35 * changes.
36 */
37 void updateIndexedFoldersWatches();
38
40 void indexNewFile(const QString& string);
41 void indexModifiedFile(const QString& string);
42 void indexXAttr(const QString& path);
43
44 /**
45 * This signal is emitted when a file has been removed, and everyone else
46 * should update their caches
47 */
48 void fileRemoved(const QString& path);
49
50 void installedWatches();
51
52private Q_SLOTS:
53 void slotFileMoved(const QString& from, const QString& to);
54 void slotFileDeleted(const QString& urlString, bool isDir);
55 void slotFileCreated(const QString& path, bool isDir);
56 void slotFileClosedAfterWrite(const QString&);
57 void slotAttributeChanged(const QString& path);
58 void slotFileModified(const QString& path);
59 void slotInotifyWatchUserLimitReached(const QString&);
60
61private:
62 /** Watch a folder, provided it is not already watched*/
63 void watchFolder(const QString& path);
64
65 Database* m_db;
66
67 MetadataMover* m_metadataMover;
68 FileIndexerConfig* m_config;
69
70 KInotify* m_dirWatch;
71
72 /// queue used to "compress" multiple file events like downloads
73 PendingFileQueue* m_pendingFileQueue;
74
75 QStringList m_includedFolders;
76 QStringList m_excludedFolders;
77
78 friend class FileWatchTest;
79};
80}
81
82#endif
A simple wrapper around inotify which only allows to add folders recursively.
Definition kinotify.h:25
Implements storage for docIds without any associated data Instantiated for:
Definition coding.cpp:11
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.