-rw-r--r-- | library/storage.cpp | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/library/storage.cpp b/library/storage.cpp index 4e07ec6..1ce43bc 100644 --- a/library/storage.cpp +++ b/library/storage.cpp | |||
@@ -66,6 +66,21 @@ static bool isCF(const QString& m) | |||
66 | return FALSE; | 66 | return FALSE; |
67 | } | 67 | } |
68 | 68 | ||
69 | /*! \class StorageInfo storage.h | ||
70 | \brief The StorageInfo class describes the disks mounted on the file system. | ||
71 | |||
72 | This class provides access to the mount information for the Linux | ||
73 | filesystem. Each mount point is represented by the FileSystem class. | ||
74 | To ensure this class has the most up to date size information, call | ||
75 | the update() method. Note that this will automatically be signaled | ||
76 | by the operating system when a disk has been mounted or unmounted. | ||
77 | |||
78 | \ingroup qtopiaemb | ||
79 | */ | ||
80 | |||
81 | /*! Constructor that determines the current mount points of the filesystem. | ||
82 | The standard \a parent parameters is passed on to QObject. | ||
83 | */ | ||
69 | StorageInfo::StorageInfo( QObject *parent ) | 84 | StorageInfo::StorageInfo( QObject *parent ) |
70 | : QObject( parent ) | 85 | : QObject( parent ) |
71 | { | 86 | { |
@@ -76,6 +91,9 @@ StorageInfo::StorageInfo( QObject *parent ) | |||
76 | update(); | 91 | update(); |
77 | } | 92 | } |
78 | 93 | ||
94 | /*! Returns the longest matching FileSystem that starts with the | ||
95 | same prefix as \a filename as its mount point. | ||
96 | */ | ||
79 | const FileSystem *StorageInfo::fileSystemOf( const QString &filename ) | 97 | const FileSystem *StorageInfo::fileSystemOf( const QString &filename ) |
80 | { | 98 | { |
81 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) { | 99 | for (QListIterator<FileSystem> i(mFileSystems); i.current(); ++i) { |
@@ -91,6 +109,12 @@ void StorageInfo::cardMessage( const QCString& msg, const QByteArray& ) | |||
91 | if ( msg == "mtabChanged()" ) | 109 | if ( msg == "mtabChanged()" ) |
92 | update(); | 110 | update(); |
93 | } | 111 | } |
112 | |||
113 | |||
114 | /*! Updates the mount and free space available information for each mount | ||
115 | point. This method is automatically called when a disk is mounted or | ||
116 | unmounted. | ||
117 | */ | ||
94 | // cause of the lack of a d pointer we need | 118 | // cause of the lack of a d pointer we need |
95 | // to store informations in a config file :( | 119 | // to store informations in a config file :( |
96 | void StorageInfo::update() | 120 | void StorageInfo::update() |
@@ -234,7 +258,16 @@ bool StorageInfo::hasMmc() | |||
234 | return hasMmc; | 258 | return hasMmc; |
235 | } | 259 | } |
236 | 260 | ||
261 | /*! \fn const QList<FileSystem> &StorageInfo::fileSystems() const | ||
262 | Returns a list of all available mounted file systems. | ||
263 | |||
264 | \warning This may change in Qtopia 3.x to return only relevant Qtopia file systems (and ignore mount points such as /tmp) | ||
265 | */ | ||
237 | 266 | ||
267 | /*! \fn void StorageInfo::disksChanged() | ||
268 | Gets emitted when a disk has been mounted or unmounted, such as when | ||
269 | a CF c | ||
270 | */ | ||
238 | //--------------------------------------------------------------------------- | 271 | //--------------------------------------------------------------------------- |
239 | 272 | ||
240 | FileSystem::FileSystem( const QString &disk, const QString &path, const QString &name, bool rem, const QString &o ) | 273 | FileSystem::FileSystem( const QString &disk, const QString &path, const QString &name, bool rem, const QString &o ) |
@@ -259,3 +292,55 @@ void FileSystem::update() | |||
259 | #endif | 292 | #endif |
260 | } | 293 | } |
261 | 294 | ||
295 | /*! \class FileSystem storage.h | ||
296 | \brief The FileSystem class describes a single mount point. | ||
297 | |||
298 | This class simply returns information about a mount point, including | ||
299 | file system name, mount point, human readable name, size information | ||
300 | and mount options information. | ||
301 | \ingroup qtopiaemb | ||
302 | |||
303 | \sa StorageInfo | ||
304 | */ | ||
305 | |||
306 | /*! \fn const QString &FileSystem::disk() const | ||
307 | Returns the file system name, such as /dev/hda3 | ||
308 | */ | ||
309 | |||
310 | /*! \fn const QString &FileSystem::path() const | ||
311 | Returns the mount path, such as /home | ||
312 | */ | ||
313 | |||
314 | /*! \fn const QString &FileSystem::name() const | ||
315 | Returns the translated, human readable name for the mount directory. | ||
316 | */ | ||
317 | |||
318 | /*! \fn const QString &FileSystem::options() const | ||
319 | Returns the mount options | ||
320 | */ | ||
321 | |||
322 | /*! \fn long FileSystem::blockSize() const | ||
323 | Returns the size of each block on the file system. | ||
324 | */ | ||
325 | |||
326 | /*! \fn long FileSystem::totalBlocks() const | ||
327 | Returns the total number of blocks on the file system | ||
328 | */ | ||
329 | |||
330 | /*! \fn long FileSystem::availBlocks() const | ||
331 | Returns the number of available blocks on the file system | ||
332 | */ | ||
333 | |||
334 | /*! \fn bool FileSystem::isRemovable() const | ||
335 | Returns flag whether the file system can be removed, such as a CF card | ||
336 | would be removable, but the internal memory wouldn't | ||
337 | */ | ||
338 | |||
339 | /*! \fn bool FileSystem::isWritable() const | ||
340 | Returns flag whether the file system is mounted as writable or read-only. | ||
341 | Returns FALSE if read-only, TRUE if read and write. | ||
342 | */ | ||
343 | |||
344 | /*! \fn QStringList StorageInfo::fileSystemNames() const | ||
345 | Returns a list of filesystem names. | ||
346 | */ | ||