File indexing completed on 2024-06-16 04:58:32

0001 /* -*- mode: c++; c-basic-offset:4 -*-
0002     filesystemwatcher.h
0003 
0004     This file is part of Kleopatra, the KDE keymanager
0005     SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include "kleo_export.h"
0013 
0014 #include <QObject>
0015 #include <QStringList>
0016 
0017 class QString;
0018 
0019 namespace Kleo
0020 {
0021 
0022 class KLEO_EXPORT FileSystemWatcher : public QObject
0023 {
0024     Q_OBJECT
0025 public:
0026     explicit FileSystemWatcher(QObject *parent = nullptr);
0027     explicit FileSystemWatcher(const QStringList &paths, QObject *parent = nullptr);
0028     ~FileSystemWatcher() override;
0029 
0030     void setDelay(int ms);
0031     int delay() const;
0032 
0033     void setEnabled(bool enable);
0034     bool isEnabled() const;
0035 
0036     void addPaths(const QStringList &paths);
0037     void addPath(const QString &path);
0038 
0039     void blacklistFiles(const QStringList &patterns);
0040     void whitelistFiles(const QStringList &patterns);
0041 
0042     QStringList files() const;
0043     void removePaths(const QStringList &path);
0044     void removePath(const QString &path);
0045 
0046 Q_SIGNALS:
0047     void directoryChanged(const QString &path);
0048     void fileChanged(const QString &path);
0049     void triggered();
0050 
0051 private:
0052     class Private;
0053     QScopedPointer<Private> const d;
0054 };
0055 }