-rw-r--r-- | library/storage.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/library/storage.h b/library/storage.h new file mode 100644 index 0000000..66a9f9d --- a/dev/null +++ b/library/storage.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | #ifndef __storage_h__ | ||
21 | #define __storage_h__ | ||
22 | |||
23 | #include <qobject.h> | ||
24 | #include <qlist.h> | ||
25 | |||
26 | class FileSystem; | ||
27 | class QCopChannel; | ||
28 | |||
29 | class StorageInfo : public QObject | ||
30 | { | ||
31 | Q_OBJECT | ||
32 | public: | ||
33 | StorageInfo( QObject *parent=0 ); | ||
34 | |||
35 | const QList<FileSystem> &fileSystems() const { return mFileSystems; } | ||
36 | const FileSystem *fileSystemOf( const QString &filename ); | ||
37 | |||
38 | signals: | ||
39 | void disksChanged(); | ||
40 | |||
41 | public slots: | ||
42 | void update(); | ||
43 | |||
44 | private slots: | ||
45 | void cardMessage( const QCString& msg, const QByteArray& data ); | ||
46 | private: | ||
47 | QList<FileSystem> mFileSystems; | ||
48 | QCopChannel *channel; | ||
49 | }; | ||
50 | |||
51 | class FileSystem | ||
52 | { | ||
53 | public: | ||
54 | const QString &disk() const { return fsdisk; } | ||
55 | const QString &path() const { return fspath; } | ||
56 | const QString &name() const { return humanname; } | ||
57 | const QString &options() const { return opts; } | ||
58 | long blockSize() const { return blkSize; } | ||
59 | long totalBlocks() const { return totalBlks; } | ||
60 | long availBlocks() const { return availBlks; } | ||
61 | bool isRemovable() const { return removable; } | ||
62 | bool isWritable() const { return opts.contains("rw"); } | ||
63 | |||
64 | private: | ||
65 | friend class StorageInfo; | ||
66 | FileSystem( const QString &disk, const QString &path, const QString &humanname, bool rem, const QString &opts ); | ||
67 | void update(); | ||
68 | |||
69 | QString fsdisk; | ||
70 | QString fspath; | ||
71 | QString humanname; | ||
72 | long blkSize; | ||
73 | long totalBlks; | ||
74 | long availBlks; | ||
75 | bool removable; | ||
76 | QString opts; | ||
77 | }; | ||
78 | |||
79 | |||
80 | #endif | ||