From ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kdecore/kmountpoint.h | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 kdecore/kmountpoint.h (limited to 'kdecore/kmountpoint.h') diff --git a/kdecore/kmountpoint.h b/kdecore/kmountpoint.h new file mode 100644 index 000000000..ee3ea3941 --- /dev/null +++ b/kdecore/kmountpoint.h @@ -0,0 +1,116 @@ +/* + This file is part of the KDE libraries + Copyright (c) 2003 Waldo Bastian + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef _KMOUNTPOINT_H_ +#define _KMOUNTPOINT_H_ + +#include +#include + +#include + +/** + * The KMountPoint class provides information about mounted and unmounted disks. + * It provides a system independent interface to fstab. + * + * @author Waldo Bastian + * @since 3.2 + */ +class KDECORE_EXPORT KMountPoint : public KShared +{ + typedef signed long long int filesize_t; +public: + typedef KSharedPtr Ptr; + typedef QValueList List; +public: + enum { NeedMountOptions = 1, NeedRealDeviceName = 2 }; + + /** + * This function gives a list of all possible mountpoints. (fstab) + * @param infoNeeded Flags that specify which additional information + * should be fetched. + */ + static KMountPoint::List possibleMountPoints(int infoNeeded=0); + + /** + * This function gives a list of all currently used mountpoints. (mtab) + * @param infoNeeded Flags that specify which additional information + * should be fetched. + */ + static KMountPoint::List currentMountPoints(int infoNeeded=0); + + /** + * Where this filesystem gets mounted from. + * This can refer to a device, a remote server or something else. + */ + QString mountedFrom() const { return m_mountedFrom; } + + /** + * 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. + */ + QString realDeviceName() const { return m_device; } + + /** + * Path where the filesystem is mounted or can be mounted. + */ + QString mountPoint() const { return m_mountPoint; } + + /** + * Type of filesystem + */ + QString mountType() const { return m_mountType; } + + /** + * Options used to mount the filesystem. + * Only available when the NeedMountOptions flag was set. + */ + QStringList mountOptions() const { return m_mountOptions; } + + /** + * When using supermount, the device name is in the options field + * as dev=/my/device + * @since 3.4 + */ + static QString devNameFromOptions(const QStringList &options); + + /** + * Destructor + */ + ~KMountPoint(); + +private: + /** + * Constructor + */ + KMountPoint(); + + QString m_mountedFrom; + QString m_device; + QString m_mountPoint; + QString m_mountType; + QStringList m_mountOptions; + + class KMountPointPrivate; + KMountPointPrivate *d; +}; + +#endif // _KMOUNTPOINT_H_ + -- cgit v1.2.1