20 #ifndef _TDESTORAGEDEVICE_H
21 #define _TDESTORAGEDEVICE_H
23 #include "tdegenericdevice.h"
24 #include "tqvariant.h"
25 #include "kdemacros.h"
30 namespace TDEDiskDeviceType {
31 #if __cplusplus >= 201103L
32 enum TDEDiskDeviceType :
unsigned long long {
34 enum TDEDiskDeviceType {
36 Null = 0x0000000000000000ULL,
37 MediaDevice = 0x0000000000000001ULL,
38 Floppy = 0x0000000000000002ULL,
39 CDROM = 0x0000000000000004ULL,
40 CDR = 0x0000000000000008ULL,
41 CDRW = 0x0000000000000010ULL,
42 CDMO = 0x0000000000000020ULL,
43 CDMRRW = 0x0000000000000040ULL,
44 CDMRRWW = 0x0000000000000080ULL,
45 DVDROM = 0x0000000000000100ULL,
46 DVDRAM = 0x0000000000000200ULL,
47 DVDR = 0x0000000000000400ULL,
48 DVDRW = 0x0000000000000800ULL,
49 DVDRDL = 0x0000000000001000ULL,
50 DVDRWDL = 0x0000000000002000ULL,
51 DVDPLUSR = 0x0000000000004000ULL,
52 DVDPLUSRW = 0x0000000000008000ULL,
53 DVDPLUSRDL = 0x0000000000010000ULL,
54 DVDPLUSRWDL = 0x0000000000020000ULL,
55 BDROM = 0x0000000000040000ULL,
56 BDR = 0x0000000000080000ULL,
57 BDRW = 0x0000000000100000ULL,
58 HDDVDROM = 0x0000000000200000ULL,
59 HDDVDR = 0x0000000000400000ULL,
60 HDDVDRW = 0x0000000000800000ULL,
61 Zip = 0x0000000001000000ULL,
62 Jaz = 0x0000000002000000ULL,
63 Camera = 0x0000000004000000ULL,
64 LUKS = 0x0000000008000000ULL,
65 OtherCrypted = 0x0000000010000000ULL,
66 CDAudio = 0x0000000020000000ULL,
67 CDVideo = 0x0000000040000000ULL,
68 DVDVideo = 0x0000000080000000ULL,
69 BDVideo = 0x0000000100000000ULL,
70 Flash = 0x0000000200000000ULL,
71 USB = 0x0000000400000000ULL,
72 Tape = 0x0000000800000000ULL,
73 HDD = 0x0000001000000000ULL,
74 Optical = 0x0000002000000000ULL,
75 RAM = 0x0000004000000000ULL,
76 Loop = 0x0000008000000000ULL,
77 CompactFlash = 0x0000010000000000ULL,
78 MemoryStick = 0x0000020000000000ULL,
79 SmartMedia = 0x0000040000000000ULL,
80 SDMMC = 0x0000080000000000ULL,
81 UnlockedCrypt = 0x0000100000000000ULL,
82 Other = 0x8000000000000000ULL
85 inline TDEDiskDeviceType operator|(TDEDiskDeviceType a, TDEDiskDeviceType b)
87 return static_cast<TDEDiskDeviceType
>(
static_cast<unsigned long long>(a) |
static_cast<unsigned long long>(b));
90 inline TDEDiskDeviceType operator&(TDEDiskDeviceType a, TDEDiskDeviceType b)
92 return static_cast<TDEDiskDeviceType
>(
static_cast<unsigned long long>(a) &
static_cast<unsigned long long>(b));
95 inline TDEDiskDeviceType operator~(TDEDiskDeviceType a)
97 return static_cast<TDEDiskDeviceType
>(~static_cast<unsigned long long>(a));
101 namespace TDEDiskDeviceStatus {
102 enum TDEDiskDeviceStatus {
104 Mountable = 0x00000001,
105 Removable = 0x00000002,
106 Inserted = 0x00000004,
108 UsedByDevice = 0x00000010,
109 UsesDevice = 0x00000020,
110 ContainsFilesystem = 0x00000040,
116 inline TDEDiskDeviceStatus operator|(TDEDiskDeviceStatus a, TDEDiskDeviceStatus b)
118 return static_cast<TDEDiskDeviceStatus
>(
static_cast<int>(a) |
static_cast<int>(b));
121 inline TDEDiskDeviceStatus operator&(TDEDiskDeviceStatus a, TDEDiskDeviceStatus b)
123 return static_cast<TDEDiskDeviceStatus
>(
static_cast<int>(a) &
static_cast<int>(b));
126 inline TDEDiskDeviceStatus operator~(TDEDiskDeviceStatus a)
128 return static_cast<TDEDiskDeviceStatus
>(~static_cast<int>(a));
132 namespace TDELUKSKeySlotStatus {
133 enum TDELUKSKeySlotStatus {
134 Invalid = 0x00000000,
135 Inactive = 0x00000001,
141 inline TDELUKSKeySlotStatus operator|(TDELUKSKeySlotStatus a, TDELUKSKeySlotStatus b)
143 return static_cast<TDELUKSKeySlotStatus
>(
static_cast<int>(a) |
static_cast<int>(b));
146 inline TDELUKSKeySlotStatus operator&(TDELUKSKeySlotStatus a, TDELUKSKeySlotStatus b)
148 return static_cast<TDELUKSKeySlotStatus
>(
static_cast<int>(a) &
static_cast<int>(b));
151 inline TDELUKSKeySlotStatus operator~(TDELUKSKeySlotStatus a)
153 return static_cast<TDELUKSKeySlotStatus
>(~static_cast<int>(a));
157 typedef TQValueList<TDELUKSKeySlotStatus::TDELUKSKeySlotStatus> TDELUKSKeySlotStatusList;
159 namespace TDELUKSResult {
161 Invalid = 0x00000000,
162 Success = 0x00000001,
163 LUKSNotSupported = 0x00000002,
164 LUKSNotFound = 0x00000003,
165 InvalidKeyslot = 0x00000004,
166 KeyslotOpFailed = 0x00000005,
171 typedef TQMap<TQString, TQString> TDEStorageMountOptions;
173 class TDECORE_EXPORT TDEStorageDevice :
public TDEGenericDevice
180 TDEStorageDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null);
190 TQString diskLabel();
200 TQString mappedName();
205 TDEDiskDeviceType::TDEDiskDeviceType diskType();
210 TDEDiskDeviceStatus::TDEDiskDeviceStatus diskStatus();
215 bool mediaInserted();
220 TQString fileSystemName();
225 TQString fileSystemUsage();
230 TQStringList holdingDevices();
235 TQStringList slaveDevices();
245 TQStringVariantMap mountDevice(TQString mediaName = TQString::null,
246 TDEStorageMountOptions mountOptions = TDEStorageMountOptions());
253 TQStringVariantMap unmountDevice();
262 TQStringVariantMap unlockDevice(
const TQString &passphrase);
269 TQStringVariantMap lockDevice();
274 TQString mountPath();
279 unsigned long long deviceSize();
284 TQString deviceFriendlySize();
300 TQString friendlyName();
307 TQString detailedFriendlyName();
314 TQString friendlyDeviceType();
319 bool isDiskOfType(TDEDiskDeviceType::TDEDiskDeviceType tf);
324 bool checkDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus sf);
332 bool lockDriveMedia(
bool lock);
339 bool ejectDriveMedia();
346 TQStringVariantMap ejectDrive();
354 void cryptSetOperationsUnlockPassword(TQByteArray password);
360 void cryptClearOperationsUnlockPassword();
367 bool cryptOperationsUnlockPasswordSet();
379 TDELUKSResult::TDELUKSResult cryptCheckKey(
unsigned int keyslot);
392 TDELUKSResult::TDELUKSResult cryptAddKey(
unsigned int keyslot, TQByteArray password);
402 TDELUKSResult::TDELUKSResult cryptDelKey(
unsigned int keyslot);
407 unsigned int cryptKeySlotCount();
412 TDELUKSKeySlotStatusList cryptKeySlotStatus();
418 TQString cryptKeySlotFriendlyName(TDELUKSKeySlotStatus::TDELUKSKeySlotStatus status);
427 void internalSetDeviceNode(TQString dn);
433 void internalSetDiskLabel(TQString dn);
439 void internalSetDiskUUID(TQString
id);
445 void internalSetDiskType(TDEDiskDeviceType::TDEDiskDeviceType tf);
451 void internalSetDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus st);
457 void internalSetMediaInserted(
bool inserted);
463 void internalSetFileSystemName(TQString fn);
469 void internalSetFileSystemUsage(TQString fu);
475 void internalSetHoldingDevices(TQStringList hd);
481 void internalSetSlaveDevices(TQStringList sd);
486 void internalInitializeLUKSIfNeeded();
491 void internalGetLUKSKeySlotStatus();
496 void internalUpdateMappedName();
501 void internalUpdateMountPath();
504 TQString m_mappedName;
505 TDEDiskDeviceType::TDEDiskDeviceType m_diskType;
506 TDEDiskDeviceStatus::TDEDiskDeviceStatus m_diskStatus;
509 TQString m_fileSystemName;
510 TQString m_fileSystemUsage;
511 bool m_mediaInserted;
512 TQString m_mountPath;
513 TQStringList m_holdingDevices;
514 TQStringList m_slaveDevices;
515 struct crypt_device* m_cryptDevice;
516 TQByteArray m_cryptDevicePassword;
517 TQString m_cryptDeviceType;
518 unsigned int m_cryptKeySlotCount;
519 TDELUKSKeySlotStatusList m_cryptKeyslotStatus;
521 friend class TDEHardwareDevices;
StdSizes
These are the standard sizes for icons.