File indexing completed on 2024-05-05 16:08:27

0001 /* This file is part of the KDE project
0002    Copyright (c) 2001 David Faure <faure@kde.org>
0003    Copyright (c) 2001 Laurent Montel <lmontel@mandrakesoft.com>
0004 
0005    This library is free software; you can redistribute it and/or
0006    modify it under the terms of the GNU Library General Public
0007    License version 2 as published by the Free Software Foundation.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017    Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef kfileshare_h
0021 #define kfileshare_h
0022 
0023 #include <kdelibs4support_export.h>
0024 class QString;
0025 
0026 /**
0027  * Common functionality for the file sharing
0028  * (communication with the backend)
0029  * @deprecated since 5.0, use KSambaShare and KNFSShare.
0030  */
0031 namespace KFileShare
0032 {
0033 /**
0034  * Reads the file share configuration file
0035  */
0036 KDELIBS4SUPPORT_DEPRECATED_EXPORT void readConfig();
0037 
0038 /**
0039  * Reads the list of shared folders
0040  */
0041 KDELIBS4SUPPORT_DEPRECATED_EXPORT void readShareList();
0042 
0043 /**
0044  * Call this to know if a directory is currently shared
0045  */
0046 KDELIBS4SUPPORT_DEPRECATED_EXPORT bool isDirectoryShared(const QString &path);
0047 
0048 enum Authorization { NotInitialized, ErrorNotFound, Authorized, UserNotAllowed };
0049 /**
0050  * Call this to know if the current user is authorized to share directories
0051  */
0052 KDELIBS4SUPPORT_DEPRECATED_EXPORT Authorization authorization();
0053 
0054 /**
0055  * Uses a suid perl script to share the given path
0056  * with NFS and Samba
0057  * @param path the path to share
0058  * @param shared whether the path should be shared or not
0059  * @returns whether the perl script was successful
0060  */
0061 KDELIBS4SUPPORT_DEPRECATED_EXPORT bool setShared(const QString &path, bool shared);
0062 
0063 /**
0064  * The used share mode.
0065  * Simple means that the simple sharing dialog is used and
0066  * users can share only folders from there HOME folder.
0067  * Advanced means that the advanced sharing dialog is used and
0068  * users can share any folder.
0069  */
0070 enum ShareMode { Simple, Advanced };
0071 
0072 /**
0073  * Returns whether sharing is enabled
0074  * If this is false, file sharing is disabled and
0075  * nobody can share files.
0076  */
0077 KDELIBS4SUPPORT_DEPRECATED_EXPORT bool sharingEnabled();
0078 
0079 /**
0080  * Returns whether file sharing is restricted.
0081  * If it is not restricted every user can shar files.
0082  * If it is restricted only users in the configured
0083  * file share group can share files.
0084  */
0085 KDELIBS4SUPPORT_DEPRECATED_EXPORT bool isRestricted();
0086 
0087 /**
0088  * Returns the group that is used for file sharing.
0089  * That is, all users in that group are allowed to
0090  * share files if file sharing is restricted.
0091  */
0092 KDELIBS4SUPPORT_DEPRECATED_EXPORT QString fileShareGroup();
0093 
0094 /**
0095  * Returns the configured share mode
0096  */
0097 KDELIBS4SUPPORT_DEPRECATED_EXPORT ShareMode shareMode();
0098 
0099 /**
0100  * Returns whether Samba is enabled
0101  */
0102 KDELIBS4SUPPORT_DEPRECATED_EXPORT bool sambaEnabled();
0103 
0104 /**
0105  * Returns whether NFS is enabled
0106  */
0107 KDELIBS4SUPPORT_DEPRECATED_EXPORT bool nfsEnabled();
0108 }
0109 
0110 #endif