KIO

ksambashare.h
1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2004 Jan Schaefer <j_schaef@informatik.uni-kl.de>
4 SPDX-FileCopyrightText: 2010 Rodrigo Belem <rclbelem@gmail.com>
5 SPDX-FileCopyrightText: 2020 Harald Sitter <sitter@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.0-only
8*/
9
10#ifndef ksambashare_h
11#define ksambashare_h
12
13#include "kiocore_export.h"
14#include <QObject>
15
16class KSambaShareData;
17class KSambaSharePrivate;
18
19/**
20 * @class KSambaShare ksambashare.h <KSambaShare>
21 *
22 * This class lists Samba user shares and monitors them for addition, update and removal.
23 * Singleton class, call instance() to get an instance.
24 */
25class KIOCORE_EXPORT KSambaShare : public QObject
26{
27 Q_OBJECT
28
29public:
30 /**
31 * @return the one and only instance of KSambaShare.
32 */
34
35 /**
36 * Whether or not the given path is shared by Samba.
37 *
38 * @param path the path to check if it is shared by Samba.
39 *
40 * @return whether the given path is shared by Samba.
41 */
42 bool isDirectoryShared(const QString &path) const;
43
44 /**
45 * Returns a list of all directories shared by local users in Samba.
46 * The resulting list is not sorted.
47 *
48 * @return a list of all directories shared by Samba.
49 */
51
52 /**
53 * Tests that a share name is valid and does not conflict with system users names or shares.
54 *
55 * @param name the share name.
56 *
57 * @return whether the given name is already being used or not.
58 *
59 */
60 bool isShareNameAvailable(const QString &name) const;
61
62 /**
63 * Returns the list of available shares.
64 *
65 * @return @c a QStringList containing the user shares names.
66 * @return @c an empty list if there aren't user shared directories.
67 *
68 */
70
71 /**
72 * Returns the KSambaShareData object of the share name.
73 *
74 * @param name the share name.
75 *
76 * @return @c the KSambaShareData object that matches the name.
77 * @return @c an empty KSambaShareData object if there isn't match for the name.
78 *
79 */
81
82 /**
83 * Returns a list of KSambaShareData matching the path.
84 *
85 * @param path the path that wants to get KSambaShareData object.
86 *
87 * @return @c the QList of KSambaShareData objects that matches the path.
88 * @return @c an empty QList if there aren't matches for the given path.
89 *
90 */
92
93 ~KSambaShare() override;
94
95 /**
96 * Used to obtain UserShareSystemError error strings. This is usually the
97 * verbatim stderr of internal helper commands and may contain newlines.
98 * Do not use this to obtain error strings for other error types!
99 *
100 * @return QString containing the most relevant last stderr
101 * @since 5.74
102 */
104
105 /**
106 * Check whether usershares may enable guests. System-level configuration
107 * may disable usershare guests and prevent saving KSambaShareData with
108 * UserGuestPermission set.
109 *
110 * @return @c true when usershares may allow guest access
111 * @since 5.74
112 */
113 bool areGuestsAllowed() const;
114
116 /**
117 * Emitted when a share is updated, added or removed
118 */
119 void changed();
120
121private:
122 KIOCORE_NO_EXPORT KSambaShare();
123
124 KSambaSharePrivate *const d_ptr;
125 Q_DECLARE_PRIVATE(KSambaShare)
126 friend class KSambaShareData;
127 friend class KSambaShareSingleton;
128};
129
130#endif
This class represents a Samba user share.
This class lists Samba user shares and monitors them for addition, update and removal.
Definition ksambashare.h:26
bool areGuestsAllowed() const
Check whether usershares may enable guests.
bool isShareNameAvailable(const QString &name) const
Tests that a share name is valid and does not conflict with system users names or shares.
KSambaShareData getShareByName(const QString &name) const
Returns the KSambaShareData object of the share name.
QList< KSambaShareData > getSharesByPath(const QString &path) const
Returns a list of KSambaShareData matching the path.
QStringList shareNames() const
Returns the list of available shares.
QString lastSystemErrorString() const
Used to obtain UserShareSystemError error strings.
void changed()
Emitted when a share is updated, added or removed.
bool isDirectoryShared(const QString &path) const
Whether or not the given path is shared by Samba.
static KSambaShare * instance()
QStringList sharedDirectories() const
Returns a list of all directories shared by local users in Samba.
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:51 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.