Update disk device labeling

pull/16/head
Timothy Pearson 13 years ago
parent 026722768b
commit 61531c281b

@ -346,19 +346,80 @@ void TDEStorageDevice::setSlaveDevices(TQStringList sd) {
TQString TDEStorageDevice::friendlyName() {
if (isDiskOfType(TDEDiskDeviceType::Floppy)) {
return i18n("Floppy Drive");
return friendlyDeviceType();
}
else if (isDiskOfType(TDEDiskDeviceType::Zip)) {
return i18n("Zip Drive");
}
else if (isDiskOfType(TDEDiskDeviceType::Optical)) {
return i18n("Optical Drive");
TQString label = diskLabel();
if (label.isNull()) {
if (deviceSize() > 0) {
if (checkDiskStatus(TDEDiskDeviceStatus::Removable)) {
label = i18n("%1 Removable Device").arg(deviceFriendlySize());
}
else {
return TDEGenericDevice::friendlyName();
label = i18n("%1 Fixed Storage Device").arg(deviceFriendlySize());
}
}
}
if (!label.isNull()) {
return label;
}
return friendlyDeviceType();
}
TQString TDEStorageDevice::friendlyDeviceType() {
TQString ret = i18n("Hard Disk Drive");
// Keep this in sync with TDEStorageDevice::icon(KIcon::StdSizes size) below
if (isDiskOfType(TDEDiskDeviceType::Floppy)) {
ret = i18n("Floppy Drive");
}
if (isDiskOfType(TDEDiskDeviceType::CDROM)) {
ret = i18n("CDROM Drive");
}
if (isDiskOfType(TDEDiskDeviceType::CDRW)) {
ret = i18n("CDRW Drive");
}
if (isDiskOfType(TDEDiskDeviceType::DVDROM)) {
ret = i18n("DVD Drive");
}
if (isDiskOfType(TDEDiskDeviceType::DVDRW) || isDiskOfType(TDEDiskDeviceType::DVDRAM)) {
ret = i18n("DVDRW Drive");
}
if (isDiskOfType(TDEDiskDeviceType::DVDRW)) {
ret = i18n("DVDRW Drive");
}
if (isDiskOfType(TDEDiskDeviceType::DVDRAM)) {
ret = i18n("DVDRAM Drive");
}
if (isDiskOfType(TDEDiskDeviceType::Zip)) {
ret = i18n("Zip Drive");
}
if (isDiskOfType(TDEDiskDeviceType::HDD)) {
ret = i18n("Hard Disk Drive");
if (checkDiskStatus(TDEDiskDeviceStatus::Removable)) {
ret = i18n("Removable Storage");
}
if (isDiskOfType(TDEDiskDeviceType::CompactFlash)) {
ret = i18n("Compact Flash");
}
if (isDiskOfType(TDEDiskDeviceType::MemoryStick)) {
ret = i18n("Memory Stick");
}
}
if (isDiskOfType(TDEDiskDeviceType::RAM)) {
ret = i18n("Random Access Memory");
}
if (isDiskOfType(TDEDiskDeviceType::Loop)) {
ret = i18n("Loop Device");
}
return ret;
}
TQPixmap TDEStorageDevice::icon(KIcon::StdSizes size) {
TQPixmap ret = DesktopIcon("hdd_unmount", size);
@ -374,18 +435,15 @@ TQPixmap TDEStorageDevice::icon(KIcon::StdSizes size) {
if (isDiskOfType(TDEDiskDeviceType::DVDROM)) {
ret = DesktopIcon("dvd_unmount", size);
}
if (isDiskOfType(TDEDiskDeviceType::DVDRW) || isDiskOfType(TDEDiskDeviceType::DVDRAM)) {
if (isDiskOfType(TDEDiskDeviceType::DVDRW)) {
ret = DesktopIcon("dvd_unmount", size);
}
if (isDiskOfType(TDEDiskDeviceType::DVDRAM)) {
ret = DesktopIcon("dvd_unmount", size);
}
if (isDiskOfType(TDEDiskDeviceType::Zip)) {
ret = DesktopIcon("zip_unmount", size);
}
if (isDiskOfType(TDEDiskDeviceType::RAM)) {
ret = DesktopIcon("memory", size);
}
if (isDiskOfType(TDEDiskDeviceType::Loop)) {
ret = DesktopIcon("blockdevice", size);
}
if (isDiskOfType(TDEDiskDeviceType::HDD)) {
ret = DesktopIcon("hdd_unmount", size);
@ -400,6 +458,13 @@ TQPixmap TDEStorageDevice::icon(KIcon::StdSizes size) {
}
}
if (isDiskOfType(TDEDiskDeviceType::RAM)) {
ret = DesktopIcon("memory", size);
}
if (isDiskOfType(TDEDiskDeviceType::Loop)) {
ret = DesktopIcon("blockdevice", size);
}
return ret;
}
@ -1560,8 +1625,13 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
}
}
else if (devicesubsystem == "tty") {
if (devicenode.contains("/ttyS")) {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Serial);
}
else {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::TextIO);
}
}
else if (devicesubsystem == "thermal") {
// FIXME
// Figure out a way to differentiate between ThermalControl (fans and coolers) and ThermalSensor types

@ -371,7 +371,7 @@ class TDECORE_EXPORT TDEGenericDevice
/**
* @return a TQString containing the friendly type name
*/
TQString friendlyDeviceType();
virtual TQString friendlyDeviceType();
/**
* @return a TQString containing the device bus ID, if any
@ -593,6 +593,13 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
*/
TQString friendlyName();
/**
* @return a TQString containing the friendly type name
*
* This method overrides TDEGenericDevice::friendlyDeviceType()
*/
TQString friendlyDeviceType();
private:
TDEDiskDeviceType::TDEDiskDeviceType m_diskType;
TDEDiskDeviceStatus::TDEDiskDeviceStatus m_diskStatus;

Loading…
Cancel
Save