KSambaShareData Class

This class represents a Samba user share. More...

Header: #include <KSambaShareData>
CMake: find_package(KF6 REQUIRED COMPONENTS KIO)
target_link_libraries(mytarget PRIVATE KF6::KIOCore)
Since: 4.7

Public Types

enum GuestPermission { GuestsNotAllowed, GuestsAllowed }
enum UserShareError { UserShareOk, UserShareExceedMaxShares, UserShareNameOk, UserShareNameInvalid, UserShareNameInUse, …, UserShareSystemError }

Public Functions

QString acl() const
QString comment() const
KSambaShareData::GuestPermission guestPermission() const
QString name() const
QString path() const
KSambaShareData::UserShareError remove()
KSambaShareData::UserShareError save()
KSambaShareData::UserShareError setAcl(const QString &acl)
KSambaShareData::UserShareError setComment(const QString &comment)
KSambaShareData::UserShareError setGuestPermission(const KSambaShareData::GuestPermission &permission = KSambaShareData::GuestsNotAllowed)
KSambaShareData::UserShareError setName(const QString &name)
KSambaShareData::UserShareError setPath(const QString &path)

Detailed Description

It is possible to share a directory with one or more different names, update the share details or remove.

See also KSambaShare.

Member Type Documentation

enum KSambaShareData::GuestPermission

ConstantValue
KSambaShareData::GuestsNotAllowed0
KSambaShareData::GuestsAllowed1

enum KSambaShareData::UserShareError

ConstantValueDescription
KSambaShareData::UserShareOk0 
KSambaShareData::UserShareExceedMaxShares1 
KSambaShareData::UserShareNameOk2 
KSambaShareData::UserShareNameInvalid3 
KSambaShareData::UserShareNameInUse4 
KSambaShareData::UserSharePathOk5 
KSambaShareData::UserSharePathInvalid6 
KSambaShareData::UserSharePathNotExists7 
KSambaShareData::UserSharePathNotDirectory8 
KSambaShareData::UserSharePathNotAbsolute9 
KSambaShareData::UserSharePathNotAllowed10 
KSambaShareData::UserShareAclOk11 
KSambaShareData::UserShareAclInvalid12 
KSambaShareData::UserShareAclUserNotValid13 
KSambaShareData::UserShareCommentOk14 
KSambaShareData::UserShareGuestsOk15 
KSambaShareData::UserShareGuestsInvalid16 
KSambaShareData::UserShareGuestsNotAllowed17 
KSambaShareData::UserShareSystemError18A system error occurred; check KSambaShare::lastSystemErrorString

Member Function Documentation

QString KSambaShareData::acl() const

Containing a string describing the permission added to the users, such as "[DOMAIN]username1:X,[DOMAIN]username2:X,...". X stands for "F" (full control), "R" (read-only) and "D" (deny). By default the acl is Everyone:R.

Returns the share acl.

See also setAcl().

QString KSambaShareData::comment() const

Returns the share comment.

See also setComment().

KSambaShareData::GuestPermission KSambaShareData::guestPermission() const

Returns whether guest access to the share is allowed or not.

See also setGuestPermission().

QString KSambaShareData::name() const

Returns the share name.

See also setName().

QString KSambaShareData::path() const

Returns the share path.

See also setPath().

KSambaShareData::UserShareError KSambaShareData::remove()

Unshare the folder held by the object.

Returns UserShareOk if the share was removed or other errors as applicable. Also see UserShareSystemError.

KSambaShareData::UserShareError KSambaShareData::save()

Share the folder with the information that has been set.

Returns UserShareOk if the share was added or other errors as applicable. Also see UserShareSystemError.

KSambaShareData::UserShareError KSambaShareData::setAcl(const QString &acl)

Sets the acl to the share.

acl the acl that will be given to the share.

Returns UserShareAclOk if the acl is valid.

Returns UserShareAclInvalid if the acl has invalid format.

Returns UserShareAclUserNotValid if one of the users in the acl is invalid.

See also acl().

KSambaShareData::UserShareError KSambaShareData::setComment(const QString &comment)

Sets the comment for the share.

comment the comment that will be given to the share.

Returns UserShareCommentOk always.

See also comment().

KSambaShareData::UserShareError KSambaShareData::setGuestPermission(const KSambaShareData::GuestPermission &permission = KSambaShareData::GuestsNotAllowed)

Flags if guest is allowed or not to access the share.

permission the permission that will be given to the share.

Returns UserShareGuestsOk if the permission was set.

Returns UserShareGuestsNotAllowed if the system does not allow guest access to the shares.

See also guestPermission().

KSambaShareData::UserShareError KSambaShareData::setName(const QString &name)

Sets the share name. If the share name is changed and valid it will remove the existing share and will create a new share. The share name cannot use a name of a system user or containing the forbidden characters '%, <, >, *, ?, |, /, , +, =, ;, :, ",,. To check if the name is available or valid use the method KSambaShare::isShareNameAvailable().

name the name that will be given to the share.

Returns UserShareNameOk if the name is valid, UserShareNameInvalid if the name contains invalid characters, UserShareNameInUse if the name is already in use by another shared folder or a by a system user.

See also name().

KSambaShareData::UserShareError KSambaShareData::setPath(const QString &path)

Set the path for the share.

path the path that will be given to the share.

Returns UserSharePathOk if valid.

Returns UserSharePathInvalid if the path is in invalid format.

Returns UserSharePathNotExists if the path does not exists.

Returns UserSharePathNotDirectory if the path points to file instead of a directory.

Returns UserSharePathNotAbsolute if the path is not is absolute form.

Returns UserSharePathNotAllowed if the path is not owner by the user.

See also path().