20#ifndef _TDESTORAGEDEVICE_H
21#define _TDESTORAGEDEVICE_H
23#include "tdegenericdevice.h"
30namespace TDEDiskDeviceType {
31enum TDEDiskDeviceType :
unsigned long long {
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
81inline TDEDiskDeviceType operator|(TDEDiskDeviceType a, TDEDiskDeviceType b)
83 return static_cast<TDEDiskDeviceType
>(
static_cast<unsigned long long>(a) |
static_cast<unsigned long long>(b));
86inline TDEDiskDeviceType operator&(TDEDiskDeviceType a, TDEDiskDeviceType b)
88 return static_cast<TDEDiskDeviceType
>(
static_cast<unsigned long long>(a) &
static_cast<unsigned long long>(b));
91inline TDEDiskDeviceType operator~(TDEDiskDeviceType a)
93 return static_cast<TDEDiskDeviceType
>(~static_cast<unsigned long long>(a));
97namespace TDEDiskDeviceStatus {
98enum TDEDiskDeviceStatus {
100 Mountable = 0x00000001,
101 Removable = 0x00000002,
102 Inserted = 0x00000004,
104 UsedByDevice = 0x00000010,
105 UsesDevice = 0x00000020,
106 ContainsFilesystem = 0x00000040,
112inline TDEDiskDeviceStatus operator|(TDEDiskDeviceStatus a, TDEDiskDeviceStatus b)
114 return static_cast<TDEDiskDeviceStatus
>(
static_cast<int>(a) |
static_cast<int>(b));
117inline TDEDiskDeviceStatus operator&(TDEDiskDeviceStatus a, TDEDiskDeviceStatus b)
119 return static_cast<TDEDiskDeviceStatus
>(
static_cast<int>(a) &
static_cast<int>(b));
122inline TDEDiskDeviceStatus operator~(TDEDiskDeviceStatus a)
124 return static_cast<TDEDiskDeviceStatus
>(~static_cast<int>(a));
128namespace TDELUKSKeySlotStatus {
129enum TDELUKSKeySlotStatus {
130 Invalid = 0x00000000,
131 Inactive = 0x00000001,
137inline TDELUKSKeySlotStatus operator|(TDELUKSKeySlotStatus a, TDELUKSKeySlotStatus b)
139 return static_cast<TDELUKSKeySlotStatus
>(
static_cast<int>(a) |
static_cast<int>(b));
142inline TDELUKSKeySlotStatus operator&(TDELUKSKeySlotStatus a, TDELUKSKeySlotStatus b)
144 return static_cast<TDELUKSKeySlotStatus
>(
static_cast<int>(a) &
static_cast<int>(b));
147inline TDELUKSKeySlotStatus operator~(TDELUKSKeySlotStatus a)
149 return static_cast<TDELUKSKeySlotStatus
>(~static_cast<int>(a));
153typedef TQValueList<TDELUKSKeySlotStatus::TDELUKSKeySlotStatus> TDELUKSKeySlotStatusList;
155namespace TDELUKSResult {
157 Invalid = 0x00000000,
158 Success = 0x00000001,
159 LUKSNotSupported = 0x00000002,
160 LUKSNotFound = 0x00000003,
161 InvalidKeyslot = 0x00000004,
162 KeyslotOpFailed = 0x00000005,
167typedef TQMap<TQString, TQString> TDEStorageMountOptions;
169class TDECORE_EXPORT TDEStorageDevice :
public TDEGenericDevice
176 TDEStorageDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null);
186 TQString diskLabel();
196 TQString mappedName();
201 TDEDiskDeviceType::TDEDiskDeviceType diskType();
206 TDEDiskDeviceStatus::TDEDiskDeviceStatus diskStatus();
211 bool mediaInserted();
216 TQString fileSystemName();
221 TQString fileSystemUsage();
226 TQStringList holdingDevices();
231 TQStringList slaveDevices();
241 TQStringVariantMap mountDevice(TQString mediaName = TQString::null,
242 TDEStorageMountOptions mountOptions = TDEStorageMountOptions());
249 TQStringVariantMap unmountDevice();
258 TQStringVariantMap unlockDevice(
const TQString &passphrase);
265 TQStringVariantMap lockDevice();
270 TQString mountPath();
275 unsigned long long deviceSize();
280 TQString deviceFriendlySize();
296 TQString friendlyName();
303 TQString detailedFriendlyName();
310 TQString friendlyDeviceType();
315 bool isDiskOfType(TDEDiskDeviceType::TDEDiskDeviceType tf);
320 bool checkDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus sf);
328 bool lockDriveMedia(
bool lock);
335 bool ejectDriveMedia();
342 TQStringVariantMap ejectDrive();
350 void cryptSetOperationsUnlockPassword(TQByteArray password);
356 void cryptClearOperationsUnlockPassword();
363 bool cryptOperationsUnlockPasswordSet();
375 TDELUKSResult::TDELUKSResult cryptCheckKey(
unsigned int keyslot);
388 TDELUKSResult::TDELUKSResult cryptAddKey(
unsigned int keyslot, TQByteArray password);
398 TDELUKSResult::TDELUKSResult cryptDelKey(
unsigned int keyslot);
403 unsigned int cryptKeySlotCount();
408 TDELUKSKeySlotStatusList cryptKeySlotStatus();
414 TQString cryptKeySlotFriendlyName(TDELUKSKeySlotStatus::TDELUKSKeySlotStatus status);
423 void internalSetDeviceNode(TQString dn);
429 void internalSetDiskLabel(TQString dn);
435 void internalSetDiskUUID(TQString
id);
441 void internalSetDiskType(TDEDiskDeviceType::TDEDiskDeviceType tf);
447 void internalSetDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus st);
453 void internalSetMediaInserted(
bool inserted);
459 void internalSetFileSystemName(TQString fn);
465 void internalSetFileSystemUsage(TQString fu);
471 void internalSetHoldingDevices(TQStringList hd);
477 void internalSetSlaveDevices(TQStringList sd);
482 void internalInitializeLUKSIfNeeded();
487 void internalGetLUKSKeySlotStatus();
492 void internalUpdateMappedName();
497 void internalUpdateMountPath();
500 TQString m_mappedName;
501 TDEDiskDeviceType::TDEDiskDeviceType m_diskType;
502 TDEDiskDeviceStatus::TDEDiskDeviceStatus m_diskStatus;
505 TQString m_fileSystemName;
506 TQString m_fileSystemUsage;
507 bool m_mediaInserted;
508 TQString m_mountPath;
509 TQStringList m_holdingDevices;
510 TQStringList m_slaveDevices;
511 struct crypt_device* m_cryptDevice;
512 TQByteArray m_cryptDevicePassword;
513 TQString m_cryptDeviceType;
514 unsigned int m_cryptKeySlotCount;
515 TDELUKSKeySlotStatusList m_cryptKeyslotStatus;
517 friend class TDEHardwareDevices;
StdSizes
These are the standard sizes for icons.