KDiskFreeSpaceInfo

Search for usage in LXR

#include <KDiskFreeSpaceInfo>

Public Member Functions

 KDiskFreeSpaceInfo (const KDiskFreeSpaceInfo &)
 
 ~KDiskFreeSpaceInfo ()
 
KIO::filesize_t available () const
 
bool isValid () const
 
QString mountPoint () const
 
KDiskFreeSpaceInfooperator= (const KDiskFreeSpaceInfo &)
 
KIO::filesize_t size () const
 
KIO::filesize_t used () const
 

Static Public Member Functions

static KDiskFreeSpaceInfo freeSpaceInfo (const QString &path)
 

Detailed Description

Determine the space left on an arbitrary partition.

This class determines the free space left on the partition that holds a given path. This path can be the mount point or any file or directory on the partition.

To find how much space is available on the partition containing path, simply do the following:

if( info.isValid() )
doSomething( info.available() );
Author
Sebastian Trueg trueg[email protected]@kde[email protected].org
Since
4.2
Deprecated:
Since 5.88, use KIO::FileSystemFreeSpaceJob or QStorageInfo instead.

Definition at line 44 of file kdiskfreespaceinfo.h.

Constructor & Destructor Documentation

◆ KDiskFreeSpaceInfo()

KDiskFreeSpaceInfo::KDiskFreeSpaceInfo ( const KDiskFreeSpaceInfo other)

Copy constructor.

Definition at line 41 of file kdiskfreespaceinfo.cpp.

◆ ~KDiskFreeSpaceInfo()

KDiskFreeSpaceInfo::~KDiskFreeSpaceInfo ( )

Destructor.

Definition at line 46 of file kdiskfreespaceinfo.cpp.

Member Function Documentation

◆ available()

KIO::filesize_t KDiskFreeSpaceInfo::available ( ) const

The available space in the partition mounted at mountPoint()

Only valid if isValid() returns true.

Returns
Available space left on the requested partition in bytes.

Definition at line 71 of file kdiskfreespaceinfo.cpp.

◆ freeSpaceInfo()

KDiskFreeSpaceInfo KDiskFreeSpaceInfo::freeSpaceInfo ( const QString path)
static

Static method used to determine the free disk space.

Parameters
pathAn arbitrary path. The available space will be determined for the partition containing path.

Check isValid() to see if the process was successful. Then use mountPoint(), size(), available(), and used() to access the requested values.

Deprecated:
Since 5.88, use KIO::FileSystemFreeSpaceJob or QStorageInfo instead.

Definition at line 81 of file kdiskfreespaceinfo.cpp.

◆ isValid()

bool KDiskFreeSpaceInfo::isValid ( ) const
Returns
true if the available disk space was successfully determined and the values from mountPoint(), size(), available(), and used() are valid. false otherwise.

Definition at line 56 of file kdiskfreespaceinfo.cpp.

◆ mountPoint()

QString KDiskFreeSpaceInfo::mountPoint ( ) const

The mount point of the partition the requested path points to.

Only valid if isValid() returns true.

Definition at line 61 of file kdiskfreespaceinfo.cpp.

◆ operator=()

KDiskFreeSpaceInfo & KDiskFreeSpaceInfo::operator= ( const KDiskFreeSpaceInfo other)

Assignment operator.

Definition at line 50 of file kdiskfreespaceinfo.cpp.

◆ size()

KIO::filesize_t KDiskFreeSpaceInfo::size ( ) const

The total size of the partition mounted at mountPoint()

Only valid if isValid() returns true.

Returns
Total size of the requested partition in bytes.

Definition at line 66 of file kdiskfreespaceinfo.cpp.

◆ used()

KIO::filesize_t KDiskFreeSpaceInfo::used ( ) const

The used space in the partition mounted at mountPoint()

Only valid if isValid() returns true.

Returns
Used space on the requested partition in bytes.

Definition at line 76 of file kdiskfreespaceinfo.cpp.


The documentation for this class was generated from the following files:
static KDiskFreeSpaceInfo freeSpaceInfo(const QString &path)
Static method used to determine the free disk space.
Determine the space left on an arbitrary partition.
KIO::filesize_t available() const
The available space in the partition mounted at mountPoint()
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Dec 1 2022 03:55:21 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.