File indexing completed on 2024-06-16 03:54:30

0001 /*
0002     SPDX-FileCopyrightText: 2010 Mario Bensi <mbensi@ipsquad.net>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef SOLID_BACKENDS_FSTAB_WATCHER_H
0008 #define SOLID_BACKENDS_FSTAB_WATCHER_H
0009 
0010 #include <QObject>
0011 
0012 class QFileSystemWatcher;
0013 class QFile;
0014 class QSocketNotifier;
0015 
0016 namespace Solid
0017 {
0018 namespace Backends
0019 {
0020 namespace Fstab
0021 {
0022 class FstabWatcher : public QObject
0023 {
0024     Q_OBJECT
0025 public:
0026     FstabWatcher();
0027     ~FstabWatcher() override;
0028 
0029     static FstabWatcher *instance();
0030 
0031 Q_SIGNALS:
0032     void mtabChanged();
0033     void fstabChanged();
0034 
0035 private Q_SLOTS:
0036     void onFileChanged(const QString &path);
0037     void orphanFileSystemWatcher();
0038 
0039 private:
0040     bool m_isRoutineInstalled;
0041     QFileSystemWatcher *m_fileSystemWatcher;
0042     QSocketNotifier *m_mtabSocketNotifier;
0043     QFile *m_mtabFile;
0044     bool m_isFstabWatched;
0045 };
0046 }
0047 }
0048 }
0049 #endif // SOLID_BACKENDS_FSTAB_WATCHER_H