20 #ifndef _TDESTORAGEDEVICE_H
21 #define _TDESTORAGEDEVICE_H
23 #include "tdegenericdevice.h"
24 #include "tqvariant.h"
29 namespace TDEDiskDeviceType {
30 #if __cplusplus >= 201103L
31 enum TDEDiskDeviceType :
unsigned long long {
33 enum TDEDiskDeviceType {
35 Null = 0x0000000000000000ULL,
36 MediaDevice = 0x0000000000000001ULL,
37 Floppy = 0x0000000000000002ULL,
38 CDROM = 0x0000000000000004ULL,
39 CDR = 0x0000000000000008ULL,
40 CDRW = 0x0000000000000010ULL,
41 CDMO = 0x0000000000000020ULL,
42 CDMRRW = 0x0000000000000040ULL,
43 CDMRRWW = 0x0000000000000080ULL,
44 DVDROM = 0x0000000000000100ULL,
45 DVDRAM = 0x0000000000000200ULL,
46 DVDR = 0x0000000000000400ULL,
47 DVDRW = 0x0000000000000800ULL,
48 DVDRDL = 0x0000000000001000ULL,
49 DVDRWDL = 0x0000000000002000ULL,
50 DVDPLUSR = 0x0000000000004000ULL,
51 DVDPLUSRW = 0x0000000000008000ULL,
52 DVDPLUSRDL = 0x0000000000010000ULL,
53 DVDPLUSRWDL = 0x0000000000020000ULL,
54 BDROM = 0x0000000000040000ULL,
55 BDR = 0x0000000000080000ULL,
56 BDRW = 0x0000000000100000ULL,
57 HDDVDROM = 0x0000000000200000ULL,
58 HDDVDR = 0x0000000000400000ULL,
59 HDDVDRW = 0x0000000000800000ULL,
60 Zip = 0x0000000001000000ULL,
61 Jaz = 0x0000000002000000ULL,
62 Camera = 0x0000000004000000ULL,
63 LUKS = 0x0000000008000000ULL,
64 OtherCrypted = 0x0000000010000000ULL,
65 CDAudio = 0x0000000020000000ULL,
66 CDVideo = 0x0000000040000000ULL,
67 DVDVideo = 0x0000000080000000ULL,
68 BDVideo = 0x0000000100000000ULL,
69 Flash = 0x0000000200000000ULL,
70 USB = 0x0000000400000000ULL,
71 Tape = 0x0000000800000000ULL,
72 HDD = 0x0000001000000000ULL,
73 Optical = 0x0000002000000000ULL,
74 RAM = 0x0000004000000000ULL,
75 Loop = 0x0000008000000000ULL,
76 CompactFlash = 0x0000010000000000ULL,
77 MemoryStick = 0x0000020000000000ULL,
78 SmartMedia = 0x0000040000000000ULL,
79 SDMMC = 0x0000080000000000ULL,
80 UnlockedCrypt = 0x0000100000000000ULL,
81 Other = 0x8000000000000000ULL
84 inline TDEDiskDeviceType operator|(TDEDiskDeviceType a, TDEDiskDeviceType b)
86 return static_cast<TDEDiskDeviceType
>(
static_cast<unsigned long long>(a) |
static_cast<unsigned long long>(b));
89 inline TDEDiskDeviceType operator&(TDEDiskDeviceType a, TDEDiskDeviceType b)
91 return static_cast<TDEDiskDeviceType
>(
static_cast<unsigned long long>(a) &
static_cast<unsigned long long>(b));
94 inline TDEDiskDeviceType operator~(TDEDiskDeviceType a)
96 return static_cast<TDEDiskDeviceType
>(~static_cast<unsigned long long>(a));
100 namespace TDEDiskDeviceStatus {
101 enum TDEDiskDeviceStatus {
103 Mountable = 0x00000001,
104 Removable = 0x00000002,
105 Inserted = 0x00000004,
107 UsedByDevice = 0x00000010,
108 UsesDevice = 0x00000020,
109 ContainsFilesystem = 0x00000040,
110 Hotpluggable = 0x00000080,
115 inline TDEDiskDeviceStatus operator|(TDEDiskDeviceStatus a, TDEDiskDeviceStatus b)
117 return static_cast<TDEDiskDeviceStatus
>(
static_cast<int>(a) |
static_cast<int>(b));
120 inline TDEDiskDeviceStatus operator&(TDEDiskDeviceStatus a, TDEDiskDeviceStatus b)
122 return static_cast<TDEDiskDeviceStatus
>(
static_cast<int>(a) &
static_cast<int>(b));
125 inline TDEDiskDeviceStatus operator~(TDEDiskDeviceStatus a)
127 return static_cast<TDEDiskDeviceStatus
>(~static_cast<int>(a));
131 namespace TDELUKSKeySlotStatus {
132 enum TDELUKSKeySlotStatus {
133 Invalid = 0x00000000,
134 Inactive = 0x00000001,
140 inline TDELUKSKeySlotStatus operator|(TDELUKSKeySlotStatus a, TDELUKSKeySlotStatus b)
142 return static_cast<TDELUKSKeySlotStatus
>(
static_cast<int>(a) |
static_cast<int>(b));
145 inline TDELUKSKeySlotStatus operator&(TDELUKSKeySlotStatus a, TDELUKSKeySlotStatus b)
147 return static_cast<TDELUKSKeySlotStatus
>(
static_cast<int>(a) &
static_cast<int>(b));
150 inline TDELUKSKeySlotStatus operator~(TDELUKSKeySlotStatus a)
152 return static_cast<TDELUKSKeySlotStatus
>(~static_cast<int>(a));
156 typedef TQValueList<TDELUKSKeySlotStatus::TDELUKSKeySlotStatus> TDELUKSKeySlotStatusList;
158 namespace TDELUKSResult {
160 Invalid = 0x00000000,
161 Success = 0x00000001,
162 LUKSNotSupported = 0x00000002,
163 LUKSNotFound = 0x00000003,
164 InvalidKeyslot = 0x00000004,
165 KeyslotOpFailed = 0x00000005,
170 typedef TQMap<TQString, TQString> TDEStorageMountOptions;
172 class TDECORE_EXPORT TDEStorageDevice :
public TDEGenericDevice
179 TDEStorageDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null);
189 TQString diskLabel();
199 TQString mappedName();
204 TDEDiskDeviceType::TDEDiskDeviceType diskType();
209 TDEDiskDeviceStatus::TDEDiskDeviceStatus diskStatus();
214 bool mediaInserted();
219 TQString fileSystemName();
224 TQString fileSystemUsage();
229 TQStringList holdingDevices();
234 TQStringList slaveDevices();
244 TQStringVariantMap mountDevice(TQString mediaName = TQString::null,
245 TDEStorageMountOptions mountOptions = TDEStorageMountOptions());
252 TQStringVariantMap unmountDevice();
261 TQStringVariantMap unlockDevice(
const TQString &passphrase);
268 TQStringVariantMap lockDevice();
273 TQString mountPath();
278 unsigned long long deviceSize();
283 TQString deviceFriendlySize();
299 TQString friendlyName();
306 TQString detailedFriendlyName();
313 TQString friendlyDeviceType();
318 bool isDiskOfType(TDEDiskDeviceType::TDEDiskDeviceType tf);
323 bool checkDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus sf);
331 bool lockDriveMedia(
bool lock);
338 bool ejectDriveMedia();
345 TQStringVariantMap ejectDrive();
353 void cryptSetOperationsUnlockPassword(TQByteArray password);
359 void cryptClearOperationsUnlockPassword();
366 bool cryptOperationsUnlockPasswordSet();
378 TDELUKSResult::TDELUKSResult cryptCheckKey(
unsigned int keyslot);
391 TDELUKSResult::TDELUKSResult cryptAddKey(
unsigned int keyslot, TQByteArray password);
401 TDELUKSResult::TDELUKSResult cryptDelKey(
unsigned int keyslot);
406 unsigned int cryptKeySlotCount();
411 TDELUKSKeySlotStatusList cryptKeySlotStatus();
417 TQString cryptKeySlotFriendlyName(TDELUKSKeySlotStatus::TDELUKSKeySlotStatus status);
426 void internalSetDeviceNode(TQString dn);
432 void internalSetDiskLabel(TQString dn);
438 void internalSetDiskUUID(TQString
id);
444 void internalSetDiskType(TDEDiskDeviceType::TDEDiskDeviceType tf);
450 void internalSetDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus st);
456 void internalSetMediaInserted(
bool inserted);
462 void internalSetFileSystemName(TQString fn);
468 void internalSetFileSystemUsage(TQString fu);
474 void internalSetHoldingDevices(TQStringList hd);
480 void internalSetSlaveDevices(TQStringList sd);
485 void internalInitializeLUKSIfNeeded();
490 void internalGetLUKSKeySlotStatus();
495 void internalUpdateMappedName();
500 void internalUpdateMountPath();
503 TQString m_mappedName;
504 TDEDiskDeviceType::TDEDiskDeviceType m_diskType;
505 TDEDiskDeviceStatus::TDEDiskDeviceStatus m_diskStatus;
508 TQString m_fileSystemName;
509 TQString m_fileSystemUsage;
510 bool m_mediaInserted;
511 TQString m_mountPath;
512 TQStringList m_holdingDevices;
513 TQStringList m_slaveDevices;
514 struct crypt_device* m_cryptDevice;
515 TQByteArray m_cryptDevicePassword;
516 TQString m_cryptDeviceType;
517 unsigned int m_cryptKeySlotCount;
518 TDELUKSKeySlotStatusList m_cryptKeyslotStatus;
520 friend class TDEHardwareDevices;
StdSizes
These are the standard sizes for icons.