diff options
author | Timothy Pearson <[email protected]> | 2012-08-29 14:35:32 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-08-29 14:35:32 -0500 |
commit | 4c44d87c732a9bd2e2b02278ebd287cd57376a50 (patch) | |
tree | add9d141d28de90adca62e15fd90a4037b87975e /kcontrol/hwmanager | |
parent | 55c88e3706712bd26f081fdfc164382238506652 (diff) | |
download | tdebase-4c44d87c732a9bd2e2b02278ebd287cd57376a50.tar.gz tdebase-4c44d87c732a9bd2e2b02278ebd287cd57376a50.zip |
Fix TDEHW library media backend
Add PictBridge camera support to same
Diffstat (limited to 'kcontrol/hwmanager')
-rw-r--r-- | kcontrol/hwmanager/devicepropsdlg.cpp | 79 | ||||
-rw-r--r-- | kcontrol/hwmanager/devicepropsdlg.h | 3 | ||||
-rw-r--r-- | kcontrol/hwmanager/devicepropsdlgbase.ui | 57 |
3 files changed, 135 insertions, 4 deletions
diff --git a/kcontrol/hwmanager/devicepropsdlg.cpp b/kcontrol/hwmanager/devicepropsdlg.cpp index 784c49b69..ee5ee5981 100644 --- a/kcontrol/hwmanager/devicepropsdlg.cpp +++ b/kcontrol/hwmanager/devicepropsdlg.cpp @@ -38,6 +38,7 @@ #include <kapplication.h> #include <klineedit.h> #include <kstdguiitem.h> +#include <kmessagebox.h> #include "devicepropsdlg.h" @@ -286,6 +287,11 @@ DevicePropertiesDialog::DevicePropertiesDialog(TDEGenericDevice* device, TQWidge if (m_device->type() == TDEGenericDeviceType::CPU) { connect(base->comboCPUGovernor, TQT_SIGNAL(activated(const TQString &)), this, TQT_SLOT(setCPUGovernor(const TQString &))); } + if (m_device->type() == TDEGenericDeviceType::Disk) { + connect(base->buttonDiskMount, TQT_SIGNAL(clicked()), this, TQT_SLOT(mountDisk())); + connect(base->buttonDiskUnmount, TQT_SIGNAL(clicked()), this, TQT_SLOT(unmountDisk())); + } + if ((m_device->type() == TDEGenericDeviceType::OtherSensor) || (m_device->type() == TDEGenericDeviceType::ThermalSensor)) { base->groupSensors->setColumnLayout(0, TQt::Vertical ); base->groupSensors->layout()->setSpacing( KDialog::spacingHint() ); @@ -370,7 +376,18 @@ void DevicePropertiesDialog::populateDeviceInformation() { if (m_device->type() == TDEGenericDeviceType::Disk) { TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(m_device); - base->labelDiskMountpoint->setText(sdevice->mountPath()); + + TQString mountPoint = sdevice->mountPath(); + if (mountPoint == "") mountPoint = i18n("<none>"); + base->labelDiskMountpoint->setText(mountPoint); + + TQString fsName = sdevice->fileSystemName(); + if (fsName == "") fsName = i18n("<unknown>"); + base->labelDiskFileSystemType->setText(fsName); + + TQString volUUID = sdevice->diskUUID(); + if (volUUID == "") volUUID = i18n("<none>"); + base->labelDiskUUID->setText(volUUID); // Show status TQString status_text = "<qt>"; @@ -401,8 +418,15 @@ void DevicePropertiesDialog::populateDeviceInformation() { status_text += "</qt>"; base->labelDiskStatus->setText(status_text); - // TODO - // Add mount/unmount buttons + // Update mount/unmount button status + if (sdevice->checkDiskStatus(TDEDiskDeviceStatus::Mountable)) { + base->groupDiskActions->show(); + base->buttonDiskMount->setEnabled((sdevice->mountPath() == "")); + base->buttonDiskUnmount->setEnabled((sdevice->mountPath() != "")); + } + else { + base->groupDiskActions->hide(); + } } if (m_device->type() == TDEGenericDeviceType::CPU) { @@ -742,6 +766,55 @@ void DevicePropertiesDialog::setHibernationMethod(int value) { populateDeviceInformation(); } +void DevicePropertiesDialog::mountDisk() { + TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(m_device); + + // FIXME + // This can only mount normal volumes + TQString qerror; + TQString diskLabel = sdevice->diskLabel(); + if (diskLabel.isNull()) { + diskLabel = i18n("%1 Removable Device").arg(sdevice->deviceFriendlySize()); + } + TQString optionString; + TQString mountMessages; + TQString mountedPath = sdevice->mountDevice(diskLabel, optionString, &mountMessages); + if (mountedPath.isNull()) { + qerror = i18n("<qt>Unable to mount this device.<p>Potential reasons include:<br>Improper device and/or user privilege level<br>Corrupt data on storage device"); + if (!mountMessages.isNull()) { + qerror.append(i18n("<p>Technical details:<br>").append(mountMessages)); + } + qerror.append("</qt>"); + } + else { + qerror = ""; + } + + if (qerror != "") KMessageBox::error(this, qerror, i18n("Mount Failed")); + + populateDeviceInformation(); +} + +void DevicePropertiesDialog::unmountDisk() { + TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(m_device); + + TQString qerror; + TQString unmountMessages; + int unmountRetcode = 0; + if (!sdevice->unmountDevice(&unmountMessages, &unmountRetcode)) { + // Unmount failed! + qerror = "<qt>" + i18n("Unfortunately, the device could not be unmounted."); + if (!unmountMessages.isNull()) { + qerror.append(i18n("<p>Technical details:<br>").append(unmountMessages)); + } + qerror.append("</qt>"); + } + + if (qerror != "") KMessageBox::error(this, qerror, i18n("Unmount Failed")); + + populateDeviceInformation(); +} + void DevicePropertiesDialog::virtual_hook( int id, void* data ) { KDialogBase::virtual_hook( id, data ); } diff --git a/kcontrol/hwmanager/devicepropsdlg.h b/kcontrol/hwmanager/devicepropsdlg.h index 192ebffd4..bbff43977 100644 --- a/kcontrol/hwmanager/devicepropsdlg.h +++ b/kcontrol/hwmanager/devicepropsdlg.h @@ -188,6 +188,9 @@ private slots: void setBacklightBrightness(int); void setHibernationMethod(int); + void mountDisk(); + void unmountDisk(); + private: TDEGenericDevice* m_device; DevicePropertiesDialogBase* base; diff --git a/kcontrol/hwmanager/devicepropsdlgbase.ui b/kcontrol/hwmanager/devicepropsdlgbase.ui index dc328d643..bd3688402 100644 --- a/kcontrol/hwmanager/devicepropsdlgbase.ui +++ b/kcontrol/hwmanager/devicepropsdlgbase.ui @@ -284,19 +284,74 @@ <cstring>unnamed</cstring> </property> <property name="text"> + <string>Filesystem Type:</string> + </property> + </widget> + <widget class="TQLabel" row="1" column="1" colspan="1"> + <property name="name"> + <cstring>labelDiskFileSystemType</cstring> + </property> + </widget> + <widget class="TQLabel" row="2" column="0" colspan="1"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> + <string>Volume UUID:</string> + </property> + </widget> + <widget class="TQLabel" row="2" column="1" colspan="1"> + <property name="name"> + <cstring>labelDiskUUID</cstring> + </property> + </widget> + <widget class="TQLabel" row="3" column="0" colspan="1"> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="text"> <string>Status:</string> </property> <property name="alignment"> <set>AlignTop|AlignLeft</set> </property> </widget> - <widget class="TQLabel" row="1" column="1" colspan="1"> + <widget class="TQLabel" row="3" column="1" colspan="1"> <property name="name"> <cstring>labelDiskStatus</cstring> </property> </widget> </grid> </widget> + <widget class="TQGroupBox" row="1" column="0"> + <property name="name"> + <cstring>groupDiskActions</cstring> + </property> + <property name="title"> + <string>Device Actions</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQPushButton" row="0" column="0" colspan="1"> + <property name="name"> + <cstring>buttonDiskMount</cstring> + </property> + <property name="text"> + <string>Mount</string> + </property> + </widget> + <widget class="TQPushButton" row="0" column="1" colspan="1"> + <property name="name"> + <cstring>buttonDiskUnmount</cstring> + </property> + <property name="text"> + <string>Unmount</string> + </property> + </widget> + </grid> + </widget> <spacer row="8" column="0"> <property name="name" stdset="0"> <cstring>Spacer4</cstring> |