KMountPoint Class
The KMountPoint class provides information about mounted and unmounted disks. More...
Header: | #include <KMountPoint> |
CMake: | find_package(KF6 REQUIRED COMPONENTS KIO) target_link_libraries(mytarget PRIVATE KF6::KIOCore) |
Inherits: | QSharedData |
Public Types
class | List |
enum | DetailsNeededFlag { BasicInfoNeeded, NeedMountOptions, NeedRealDeviceName } |
flags | DetailsNeededFlags |
enum | FileSystemFlag { SupportsChmod, SupportsChown, SupportsUTime, SupportsSymlinks, CaseInsensitive } |
Public Functions
(since 5.86) dev_t | deviceId() const |
(since 5.86) bool | isOnNetwork() const |
QStringList | mountOptions() const |
QString | mountPoint() const |
QString | mountType() const |
QString | mountedFrom() const |
bool | probablySlow() const |
QString | realDeviceName() const |
bool | testFileSystemFlag(KMountPoint::FileSystemFlag flag) const |
Static Public Members
KMountPoint::List | currentMountPoints(KMountPoint::DetailsNeededFlags infoNeeded = BasicInfoNeeded) |
KMountPoint::List | possibleMountPoints(KMountPoint::DetailsNeededFlags infoNeeded = BasicInfoNeeded) |
Detailed Description
It provides a system independent interface to fstab.
Member Type Documentation
enum KMountPoint::DetailsNeededFlag
flags KMountPoint::DetailsNeededFlags
Flags that specify which additional details should be fetched for each mountpoint.
Constant | Value | Description |
---|---|---|
KMountPoint::BasicInfoNeeded | 0 | Only the basic details: mountedFrom, mountPoint, mountType. |
KMountPoint::NeedMountOptions | 1 | Also fetch the options used when mounting, see KMountPoint::mountOptions(). |
KMountPoint::NeedRealDeviceName | 2 | Also fetch the device name (with symlinks resolved), see KMountPoint::realDeviceName(). |
The DetailsNeededFlags type is a typedef for QFlags<DetailsNeededFlag>. It stores an OR combination of DetailsNeededFlag values.
enum KMountPoint::FileSystemFlag
Constant | Value |
---|---|
KMountPoint::SupportsChmod | 0 |
KMountPoint::SupportsChown | 1 |
KMountPoint::SupportsUTime | 2 |
KMountPoint::SupportsSymlinks | 3 |
KMountPoint::CaseInsensitive | 4 |
Member Function Documentation
[static]
KMountPoint::List KMountPoint::currentMountPoints(KMountPoint::DetailsNeededFlags infoNeeded = BasicInfoNeeded)
Returns a list of all current mountpoints.
infoNeeded Flags that specify which additional information should be fetched.
Note: This method will return an empty list on Android
[since 5.86]
dev_t KMountPoint::deviceId() const
Returns the device ID (dev_t, major, minor) of this mount point. This ID is unique per device (including network mounts).
This function was introduced in 5.86.
[since 5.86]
bool KMountPoint::isOnNetwork() const
Returns true
if this mount point represents a network filesystem (e.g. NFS, CIFS, etc.), otherwise returns false
.
This function was introduced in 5.86.
QStringList KMountPoint::mountOptions() const
Options used to mount the filesystem. Only available if the NeedMountOptions flag was set.
QString KMountPoint::mountPoint() const
Path where the filesystem is mounted (if you used currentMountPoints()), or can be mounted (if you used possibleMountPoints()).
QString KMountPoint::mountType() const
Type of filesystem
QString KMountPoint::mountedFrom() const
Where this filesystem gets mounted from. This can refer to a device, a remote server or something else.
[static]
KMountPoint::List KMountPoint::possibleMountPoints(KMountPoint::DetailsNeededFlags infoNeeded = BasicInfoNeeded)
This function gives a list of all possible mountpoints. (fstab)
infoNeeded Flags that specify which additional information should be fetched.
bool KMountPoint::probablySlow() const
Returns true
if the filesystem is "probably" slow, e.g. a network mount, false
otherwise.
QString KMountPoint::realDeviceName() const
Canonical name of the device where the filesystem got mounted from. (Or empty, if not a device) Only available when the NeedRealDeviceName flag was set.
bool KMountPoint::testFileSystemFlag(KMountPoint::FileSystemFlag flag) const
Checks the capabilities of the filesystem.
flag the flag to check
Returns true
if the filesystem has that flag, false if not
The available flags are:
- SupportsChmod: returns true if the filesystem supports chmod (e.g. msdos filesystems return false)
- SupportsChown: returns true if the filesystem supports chown (e.g. msdos filesystems return false)
- SupportsUtime: returns true if the filesystems supports utime (e.g. msdos filesystems return false)
- SupportsSymlinks: returns true if the filesystems supports symlinks (e.g. msdos filesystems return false)
- CaseInsensitive: returns true if the filesystem treats "foo" and "FOO" as being the same file (true for msdos filesystems)