From 18d991680d3a5155bb558e667916f76947d7e15a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Fri, 6 Apr 2012 20:18:06 -0500 Subject: Add disk info page to device manager --- kcontrol/hwmanager/devicepropsdlg.cpp | 40 +++++++++++++++++ kcontrol/hwmanager/devicepropsdlgbase.ui | 76 +++++++++++++++++++++++++++++++- 2 files changed, 114 insertions(+), 2 deletions(-) diff --git a/kcontrol/hwmanager/devicepropsdlg.cpp b/kcontrol/hwmanager/devicepropsdlg.cpp index 43892ce8c..bc2e0f843 100644 --- a/kcontrol/hwmanager/devicepropsdlg.cpp +++ b/kcontrol/hwmanager/devicepropsdlg.cpp @@ -44,6 +44,11 @@ DevicePropertiesDialog::DevicePropertiesDialog(TDEGenericDevice* device, TQWidge if (m_device) { base = new DevicePropertiesDialogBase(plainPage()); + // Remove all non-applicable tabs + if (m_device->type() != TDEGenericDeviceType::Disk) { + base->tabBarWidget->removePage(base->tabDisk); + } + TQGridLayout *mainGrid = new TQGridLayout(plainPage(), 1, 1, 0, spacingHint()); mainGrid->setRowStretch(1, 1); mainGrid->setRowStretch(1, 1); @@ -64,6 +69,41 @@ DevicePropertiesDialog::DevicePropertiesDialog(TDEGenericDevice* device, TQWidge base->labelBusID->hide(); base->stocklabelBusID->hide(); } + + if (m_device->type() == TDEGenericDeviceType::Disk) { + TDEStorageDevice* sdevice = static_cast(m_device); + base->tabDisk->show(); + base->labelDiskMountpoint->setText(sdevice->mountPath()); + + // Show status + TQString status_text = ""; + if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Mountable)) { + status_text += "Mountable
"; + } + if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Removable)) { + status_text += "Removable
"; + } + if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Inserted)) { + status_text += "Inserted
"; + } + if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::UsedByDevice)) { + status_text += "In use
"; + } + if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::UsesDevice)) { + status_text += "Uses other device
"; + } + if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::ContainsFilesystem)) { + status_text += "Contains a filesystem
"; + } + if (status_text == "") { + status_text += "Unavailable"; + } + status_text += ""; + base->labelDiskStatus->setText(status_text); + + // TODO + // Add mount/unmount buttons + } } } diff --git a/kcontrol/hwmanager/devicepropsdlgbase.ui b/kcontrol/hwmanager/devicepropsdlgbase.ui index e55b8dd40..07daa19da 100644 --- a/kcontrol/hwmanager/devicepropsdlgbase.ui +++ b/kcontrol/hwmanager/devicepropsdlgbase.ui @@ -18,14 +18,14 @@ - TabWidget2 + tabBarWidget true - tab + tabGeneral General @@ -192,6 +192,78 @@ + + + tabDisk + + + Disk + + + + unnamed + + + + groupProps + + + Volume Information + + + + unnamed + + + + unnamed + + + Mountpoint: + + + + + labelDiskMountpoint + + + + + unnamed + + + Status: + + + AlignTop|AlignLeft + + + + + labelDiskStatus + + + + + + + Spacer4 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + -- cgit v1.2.3