• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
  • tdehw
tdestoragedevice.h
1 /* This file is part of the TDE libraries
2  Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net>
3  (C) 2013 Golubev Alexander <fatzer2@gmail.com>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef _TDESTORAGEDEVICE_H
21 #define _TDESTORAGEDEVICE_H
22 
23 #include "tdegenericdevice.h"
24 
25 // Keep readDiskDeviceSubtypeFromString() in tdehardwaredevices.cpp in sync with this enum
26 namespace TDEDiskDeviceType {
27 #if __cplusplus >= 201103L
28 enum TDEDiskDeviceType : unsigned long long {
29 #else
30 enum TDEDiskDeviceType {
31 #endif
32  Null = 0x0000000000000000ULL,
33  MediaDevice = 0x0000000000000001ULL,
34  Floppy = 0x0000000000000002ULL,
35  CDROM = 0x0000000000000004ULL,
36  CDR = 0x0000000000000008ULL,
37  CDRW = 0x0000000000000010ULL,
38  CDMO = 0x0000000000000020ULL,
39  CDMRRW = 0x0000000000000040ULL,
40  CDMRRWW = 0x0000000000000080ULL,
41  DVDROM = 0x0000000000000100ULL,
42  DVDRAM = 0x0000000000000200ULL,
43  DVDR = 0x0000000000000400ULL,
44  DVDRW = 0x0000000000000800ULL,
45  DVDRDL = 0x0000000000001000ULL,
46  DVDRWDL = 0x0000000000002000ULL,
47  DVDPLUSR = 0x0000000000004000ULL,
48  DVDPLUSRW = 0x0000000000008000ULL,
49  DVDPLUSRDL = 0x0000000000010000ULL,
50  DVDPLUSRWDL = 0x0000000000020000ULL,
51  BDROM = 0x0000000000040000ULL,
52  BDR = 0x0000000000080000ULL,
53  BDRW = 0x0000000000100000ULL,
54  HDDVDROM = 0x0000000000200000ULL,
55  HDDVDR = 0x0000000000400000ULL,
56  HDDVDRW = 0x0000000000800000ULL,
57  Zip = 0x0000000001000000ULL,
58  Jaz = 0x0000000002000000ULL,
59  Camera = 0x0000000004000000ULL,
60  LUKS = 0x0000000008000000ULL,
61  OtherCrypted = 0x0000000010000000ULL,
62  CDAudio = 0x0000000020000000ULL,
63  CDVideo = 0x0000000040000000ULL,
64  DVDVideo = 0x0000000080000000ULL,
65  BDVideo = 0x0000000100000000ULL,
66  Flash = 0x0000000200000000ULL,
67  USB = 0x0000000400000000ULL,
68  Tape = 0x0000000800000000ULL,
69  HDD = 0x0000001000000000ULL,
70  Optical = 0x0000002000000000ULL,
71  RAM = 0x0000004000000000ULL,
72  Loop = 0x0000008000000000ULL,
73  CompactFlash = 0x0000010000000000ULL,
74  MemoryStick = 0x0000020000000000ULL,
75  SmartMedia = 0x0000040000000000ULL,
76  SDMMC = 0x0000080000000000ULL,
77  UnlockedCrypt = 0x0000100000000000ULL,
78  Other = 0x8000000000000000ULL
79 };
80 
81 inline TDEDiskDeviceType operator|(TDEDiskDeviceType a, TDEDiskDeviceType b)
82 {
83  return static_cast<TDEDiskDeviceType>(static_cast<unsigned long long>(a) | static_cast<unsigned long long>(b));
84 }
85 
86 inline TDEDiskDeviceType operator&(TDEDiskDeviceType a, TDEDiskDeviceType b)
87 {
88  return static_cast<TDEDiskDeviceType>(static_cast<unsigned long long>(a) & static_cast<unsigned long long>(b));
89 }
90 
91 inline TDEDiskDeviceType operator~(TDEDiskDeviceType a)
92 {
93  return static_cast<TDEDiskDeviceType>(~static_cast<unsigned long long>(a));
94 }
95 };
96 
97 namespace TDEDiskDeviceStatus {
98 enum TDEDiskDeviceStatus {
99  Null = 0x00000000,
100  Mountable = 0x00000001,
101  Removable = 0x00000002,
102  Inserted = 0x00000004,
103  Blank = 0x00000008,
104  UsedByDevice = 0x00000010,
105  UsesDevice = 0x00000020,
106  ContainsFilesystem = 0x00000040,
107  Hotpluggable = 0x00000080,
108  Hidden = 0x00000100,
109  Other = 0x80000000
110 };
111 
112 inline TDEDiskDeviceStatus operator|(TDEDiskDeviceStatus a, TDEDiskDeviceStatus b)
113 {
114  return static_cast<TDEDiskDeviceStatus>(static_cast<int>(a) | static_cast<int>(b));
115 }
116 
117 inline TDEDiskDeviceStatus operator&(TDEDiskDeviceStatus a, TDEDiskDeviceStatus b)
118 {
119  return static_cast<TDEDiskDeviceStatus>(static_cast<int>(a) & static_cast<int>(b));
120 }
121 
122 inline TDEDiskDeviceStatus operator~(TDEDiskDeviceStatus a)
123 {
124  return static_cast<TDEDiskDeviceStatus>(~static_cast<int>(a));
125 }
126 };
127 
128 typedef TQMap<TQString,TQString> TDEStorageMountOptions;
129 
130 class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
131 {
132  public:
137  TDEStorageDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null);
138 
142  ~TDEStorageDevice();
143 
147  TQString diskLabel();
148 
152  TQString diskUUID();
153 
157  TDEDiskDeviceType::TDEDiskDeviceType diskType();
158 
162  TDEDiskDeviceStatus::TDEDiskDeviceStatus diskStatus();
163 
167  bool mediaInserted();
168 
172  TQString fileSystemName();
173 
177  TQString fileSystemUsage();
178 
182  TQStringList holdingDevices();
183 
187  TQStringList slaveDevices();
188 
199  TQString mountDevice(TQString mediaName=TQString::null, TDEStorageMountOptions mountOptions=TDEStorageMountOptions(), TQString* errRet=0, int* retcode=0);
200 
212  TQString mountEncryptedDevice(TQString passphrase, TQString mediaName=TQString::null, TDEStorageMountOptions mountOptions=TDEStorageMountOptions(), TQString* errRet=0, int* retcode=0);
213 
222  bool unmountDevice(TQString* errRet, int* retcode=0);
223 
227  TQString mountPath();
228 
232  unsigned long long deviceSize();
233 
237  TQString deviceFriendlySize();
238 
246  TQPixmap icon(TDEIcon::StdSizes size);
247 
253  TQString friendlyName();
254 
260  TQString detailedFriendlyName();
261 
267  TQString friendlyDeviceType();
268 
272  bool isDiskOfType(TDEDiskDeviceType::TDEDiskDeviceType tf);
273 
277  bool checkDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus sf);
278 
285  bool lockDriveMedia(bool lock);
286 
292  bool ejectDriveMedia();
293 
299  bool ejectDrive();
300 
306  static TQString determineFileSystemType(TQString path);
307 
308  protected:
313  void internalSetDiskLabel(TQString dn);
314 
319  void internalSetDiskUUID(TQString id);
320 
325  void internalSetDiskType(TDEDiskDeviceType::TDEDiskDeviceType tf);
326 
331  void internalSetDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus st);
332 
337  void internalSetMediaInserted(bool inserted);
338 
343  void internalSetFileSystemName(TQString fn);
344 
349  void internalSetFileSystemUsage(TQString fu);
350 
355  void internalSetHoldingDevices(TQStringList hd);
356 
361  void internalSetSlaveDevices(TQStringList sd);
362 
363  private:
364  TDEDiskDeviceType::TDEDiskDeviceType m_diskType;
365  TDEDiskDeviceStatus::TDEDiskDeviceStatus m_diskStatus;
366  TQString m_diskName;
367  TQString m_diskUUID;
368  TQString m_fileSystemName;
369  TQString m_fileSystemUsage;
370  bool m_mediaInserted;
371  TQString m_mountPath;
372  TQStringList m_holdingDevices;
373  TQStringList m_slaveDevices;
374 
375  friend class TDEHardwareDevices;
376 };
377 
378 #endif // _TDESTORAGEDEVICE_H
TDEIcon::StdSizes
StdSizes
These are the standard sizes for icons.
Definition: kicontheme.h:112
TDEDiskDeviceType
Definition: tdestoragedevice.h:26
TDEDiskDeviceStatus
Definition: tdestoragedevice.h:97

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.8.8
This website is maintained by Timothy Pearson.