1 | /* This file is part of the KDE project |
2 | Copyright (c) 2001 David Faure <faure@kde.org> |
3 | Copyright (c) 2001 Laurent Montel <lmontel@mandrakesoft.com> |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public |
7 | License version 2 as published by the Free Software Foundation. |
8 | |
9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef kfileshare_h |
21 | #define kfileshare_h |
22 | |
23 | #include <kio/kio_export.h> |
24 | class QString; |
25 | |
26 | /** |
27 | * Common functionality for the file sharing |
28 | * (communication with the backend) |
29 | */ |
30 | namespace KFileShare |
31 | { |
32 | /** |
33 | * Reads the file share configuration file |
34 | */ |
35 | KIO_EXPORT void readConfig(); |
36 | |
37 | /** |
38 | * Reads the list of shared folders |
39 | */ |
40 | KIO_EXPORT void readShareList(); |
41 | |
42 | |
43 | /** |
44 | * Call this to know if a directory is currently shared |
45 | */ |
46 | KIO_EXPORT bool isDirectoryShared( const QString& path ); |
47 | |
48 | enum Authorization { NotInitialized, ErrorNotFound, Authorized, UserNotAllowed }; |
49 | /** |
50 | * Call this to know if the current user is authorized to share directories |
51 | */ |
52 | KIO_EXPORT Authorization authorization(); |
53 | |
54 | /** |
55 | * Uses a suid perl script to share the given path |
56 | * with NFS and Samba |
57 | * @param path the path to share |
58 | * @param shared whether the path should be shared or not |
59 | * @returns whether the perl script was successful |
60 | */ |
61 | KIO_EXPORT bool setShared( const QString& path, bool shared ); |
62 | |
63 | /** |
64 | * The used share mode. |
65 | * Simple means that the simple sharing dialog is used and |
66 | * users can share only folders from there HOME folder. |
67 | * Advanced means that the advanced sharing dialog is used and |
68 | * users can share any folder. |
69 | */ |
70 | enum ShareMode { Simple, Advanced }; |
71 | |
72 | /** |
73 | * Returns whether sharing is enabled |
74 | * If this is false, file sharing is disabled and |
75 | * nobody can share files. |
76 | */ |
77 | KIO_EXPORT bool sharingEnabled(); |
78 | |
79 | /** |
80 | * Returns whether file sharing is restricted. |
81 | * If it is not restricted every user can shar files. |
82 | * If it is restricted only users in the configured |
83 | * file share group can share files. |
84 | */ |
85 | KIO_EXPORT bool isRestricted(); |
86 | |
87 | /** |
88 | * Returns the group that is used for file sharing. |
89 | * That is, all users in that group are allowed to |
90 | * share files if file sharing is restricted. |
91 | */ |
92 | KIO_EXPORT QString fileShareGroup(); |
93 | |
94 | /** |
95 | * Returns the configured share mode |
96 | */ |
97 | KIO_EXPORT ShareMode shareMode(); |
98 | |
99 | /** |
100 | * Returns whether Samba is enabled |
101 | */ |
102 | KIO_EXPORT bool sambaEnabled(); |
103 | |
104 | /** |
105 | * Returns whether NFS is enabled |
106 | */ |
107 | KIO_EXPORT bool nfsEnabled(); |
108 | } |
109 | |
110 | #endif |
111 | |