diff options
author | Tobias Koenig <tobias.koenig@kdab.com> | 2015-02-02 11:53:46 +0000 |
---|---|---|
committer | Tobias Koenig <tobias.koenig@kdab.com> | 2015-02-14 08:12:15 +0000 |
commit | e731a96ac17b4a952351236000eac0ef782ad0bb (patch) | |
tree | 81423aba0d85475fb914cc0e902a18504e26664d /src/corelib | |
parent | dd4f59b227f3734051a07e35d6a3c33540c68908 (diff) |
Haiku: Implement QStorageInfo for Haiku
Use Haiku's BVolumeRoster API to provide information
about available mount points in QStorageInfo.
Change-Id: I058bbb5f3f33372edc55d3e51079d3e16815f29f
Reviewed-by: Augustin Cavalier <waddlesplash@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/io/qstorageinfo_unix.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 2e58065eed..667301b516 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -54,6 +54,12 @@ # include <sys/statvfs.h> #elif defined(Q_OS_SOLARIS) # include <sys/mnttab.h> +#elif defined(Q_OS_HAIKU) +# include <Directory.h> +# include <Path.h> +# include <Volume.h> +# include <VolumeRoster.h> +# include <sys/statvfs.h> #else # include <sys/statvfs.h> #endif @@ -129,6 +135,12 @@ private: FILE *fp; mntent mnt; QByteArray buffer; +#elif defined(Q_OS_HAIKU) + BVolumeRoster m_volumeRoster; + + QByteArray m_rootPath; + QByteArray m_fileSystemType; + QByteArray m_device; #endif }; @@ -303,6 +315,54 @@ inline QByteArray QStorageIterator::device() const return QByteArray(mnt.mnt_fsname); } +#elif defined(Q_OS_HAIKU) +inline QStorageIterator::QStorageIterator() +{ +} + +inline QStorageIterator::~QStorageIterator() +{ +} + +inline bool QStorageIterator::isValid() const +{ + return true; +} + +inline bool QStorageIterator::next() +{ + BVolume volume; + + if (m_volumeRoster.GetNextVolume(&volume) != B_OK) + return false; + + BDirectory directory; + if (volume.GetRootDirectory(&directory) != B_OK) + return false; + + const BPath path(&directory); + m_rootPath = path.Path(); + m_fileSystemType = QByteArray(); // no public API to access it + m_device = QByteArray::number(static_cast<qint32>(volume.Device())); + + return true; +} + +inline QString QStorageIterator::rootPath() const +{ + return QFile::decodeName(m_rootPath); +} + +inline QByteArray QStorageIterator::fileSystemType() const +{ + return m_fileSystemType; +} + +inline QByteArray QStorageIterator::device() const +{ + return m_device; +} + #else inline QStorageIterator::QStorageIterator() |