1 | /* |
2 | This file is part of the KDE project |
3 | SPDX-FileCopyrightText: 2004 Jan Schaefer <j_schaef@informatik.uni-kl.de> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-only |
6 | */ |
7 | |
8 | #ifndef knfsshare_h |
9 | #define knfsshare_h |
10 | |
11 | #include <QObject> |
12 | |
13 | #include "kiocore_export.h" |
14 | |
15 | #include <memory> |
16 | |
17 | /** |
18 | * @class KNFSShare knfsshare.h <KNFSShare> |
19 | * |
20 | * Similar functionality like KFileShare, |
21 | * but works only for NFS and do not need |
22 | * any suid script. |
23 | * It parses the /etc/exports file to get its information. |
24 | * Singleton class, call instance() to get an instance. |
25 | */ |
26 | class KNFSShare : public QObject |
27 | { |
28 | Q_OBJECT |
29 | public: |
30 | /** |
31 | * Returns the one and only instance of KNFSShare |
32 | */ |
33 | static KNFSShare *instance(); |
34 | |
35 | /** |
36 | * Whether or not the given path is shared by NFS. |
37 | * @param path the path to check if it is shared by NFS. |
38 | * @return whether the given path is shared by NFS. |
39 | */ |
40 | bool isDirectoryShared(const QString &path) const; |
41 | |
42 | /** |
43 | * Returns a list of all directories shared by NFS. |
44 | * The resulting list is not sorted. |
45 | * @return a list of all directories shared by NFS. |
46 | */ |
47 | QStringList sharedDirectories() const; |
48 | |
49 | /** |
50 | * KNFSShare destructor. |
51 | * Do not call! |
52 | * The instance is destroyed automatically! |
53 | */ |
54 | ~KNFSShare() override; |
55 | |
56 | /** |
57 | * Returns the path to the used exports file, |
58 | * or null if no exports file was found |
59 | */ |
60 | QString exportsPath() const; |
61 | |
62 | Q_SIGNALS: |
63 | /** |
64 | * Emitted when the /etc/exports file has changed |
65 | */ |
66 | void changed(); |
67 | |
68 | private: |
69 | KIOCORE_NO_EXPORT KNFSShare(); |
70 | class KNFSSharePrivate; |
71 | std::unique_ptr<KNFSSharePrivate> const d; |
72 | |
73 | friend class KNFSShareSingleton; |
74 | }; |
75 | |
76 | #endif |
77 | |