summaryrefslogtreecommitdiffstats
path: root/src/common-lib/filesystemmountwatcher.h
blob: b8b7e8e526e0ed1c306726583564527268eef8d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef FILESYSTEMMOUNTWATCHER_H
#define FILESYSTEMMOUNTWATCHER_H

#include <QtCore/QObject>
#include <QtCore/QMultiMap>
#include <QtAppManCommon/global.h>

QT_BEGIN_NAMESPACE_AM

class FileSystemMountWatcherPrivate;

class FileSystemMountWatcher : public QObject
{
    Q_OBJECT

public:
    FileSystemMountWatcher(QObject *parent = nullptr);
    ~FileSystemMountWatcher() override;

    static QMultiMap<QString, QString> currentMountPoints();

    void addMountPoint(const QString &directory);
    void removeMountPoint(const QString &directory);

    // Auto-test API, only functional on Linux. Needs to be called before constructor:
    static bool setMountTabFileForTesting(const QString &mtabFile);

Q_SIGNALS:
    void mountChanged(const QString &mountPoint, const QString &device);

private:
    static FileSystemMountWatcherPrivate *d;
};

QT_END_NAMESPACE_AM

#endif // FILESYSTEMMOUNTWATCHER_H