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 |
19 | * \inmodule KIOCore |
20 | * |
21 | * Similar functionality like KFileShare, |
22 | * but works only for NFS and do not need |
23 | * any suid script. |
24 | * It parses the /etc/exports file to get its information. |
25 | * Singleton class, call instance() to get an instance. |
26 | * |
27 | * \internal |
28 | */ |
29 | class KNFSShare : public QObject |
30 | { |
31 | Q_OBJECT |
32 | public: |
33 | /*! |
34 | * Returns the one and only instance of KNFSShare |
35 | */ |
36 | static KNFSShare *instance(); |
37 | |
38 | /*! |
39 | * Whether or not the given path is shared by NFS. |
40 | * \a path the path to check if it is shared by NFS. |
41 | * Returns whether the given path is shared by NFS. |
42 | */ |
43 | bool isDirectoryShared(const QString &path) const; |
44 | |
45 | /*! |
46 | * Returns a list of all directories shared by NFS. |
47 | * The resulting list is not sorted. |
48 | * Returns a list of all directories shared by NFS. |
49 | */ |
50 | QStringList sharedDirectories() const; |
51 | |
52 | /*! |
53 | * KNFSShare destructor. |
54 | * Do not call! |
55 | * The instance is destroyed automatically! |
56 | */ |
57 | ~KNFSShare() override; |
58 | |
59 | /*! |
60 | * Returns the path to the used exports file, |
61 | * or null if no exports file was found |
62 | */ |
63 | QString exportsPath() const; |
64 | |
65 | Q_SIGNALS: |
66 | /*! |
67 | * Emitted when the /etc/exports file has changed |
68 | */ |
69 | void changed(); |
70 | |
71 | private: |
72 | KIOCORE_NO_EXPORT KNFSShare(); |
73 | class KNFSSharePrivate; |
74 | std::unique_ptr<KNFSSharePrivate> const d; |
75 | |
76 | friend class KNFSShareSingleton; |
77 | }; |
78 | |
79 | #endif |
80 | |