diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-11-21 17:49:23 +0800 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-11-21 17:49:23 +0800 |
commit | d39c407bf49fab58fa53c20bb3d301ee6e709c32 (patch) | |
tree | 9bc93b5ecaf45943c3db3304f444a79eb1c780ed /kcontrol/hwmanager/devicepropsdlg.cpp | |
parent | 1b6c123de102f0152d296fba8771d348329ba95c (diff) | |
download | tdebase-d39c407bf49fab58fa53c20bb3d301ee6e709c32.tar.gz tdebase-d39c407bf49fab58fa53c20bb3d301ee6e709c32.zip |
1) tdehwdevicetray: added support for unmount/unlock/lock operations.
2) minor changes and improvements to user messages.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'kcontrol/hwmanager/devicepropsdlg.cpp')
-rw-r--r-- | kcontrol/hwmanager/devicepropsdlg.cpp | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/kcontrol/hwmanager/devicepropsdlg.cpp b/kcontrol/hwmanager/devicepropsdlg.cpp index bb37695bd..bc50f11ac 100644 --- a/kcontrol/hwmanager/devicepropsdlg.cpp +++ b/kcontrol/hwmanager/devicepropsdlg.cpp @@ -940,7 +940,7 @@ void DevicePropertiesDialog::unmountDisk() { TQStringVariantMap unmountResult = sdevice->unmountDevice(); if (unmountResult["result"].toBool() == false) { // Unmount failed! - qerror = "<qt>" + i18n("Unfortunately, the device could not be unmounted."); + qerror = "<qt>" + i18n("<b>The device could not be unmounted.</b>"); TQString errStr = unmountResult.contains("errStr") ? unmountResult["errStr"].toString() : TQString::null; if (!errStr.isEmpty()) { qerror.append(i18n("<p>Technical details:<br>").append(errStr)); @@ -958,9 +958,11 @@ void DevicePropertiesDialog::unlockDisk() { if (!m_passDlg) { - m_passDlg = new PasswordDlg(sdevice->deviceNode(), "drive-harddisk-locked"); + m_passDlg = new PasswordDlg(); connect(m_passDlg, TQT_SIGNAL(user1Clicked()), this, TQT_SLOT(doUnlockDisk())); } + m_passDlg->setDevice(sdevice->deviceNode()); + m_passDlg->clearPassword(); m_passDlg->show(); } @@ -969,28 +971,27 @@ void DevicePropertiesDialog::doUnlockDisk() { // Use DCOP call to unlock the disk to make sure the status and mime type of the underlying medium // is correctly updated throughout TDE - TQString qerror; DCOPRef mediamanager("kded", "mediamanager"); DCOPReply reply = mediamanager.call("unlockByNode", sdevice->deviceNode(), m_passDlg->getPassword()); TQStringVariantMap unlockResult; if (reply.isValid()) { reply.get(unlockResult); } - if (!unlockResult.contains("result") || !unlockResult["result"].toBool()) { - qerror = i18n("<qt>Unable to unlock this device.<p>Potential reasons include:<br>Wrong password and/or user privilege level.<br>Corrupt data on storage device."); - TQString errStr = unlockResult.contains("errStr") ? unlockResult["errStr"].toString() : i18n("Unknown unlock error."); - if (!errStr.isEmpty()) { - qerror.append(i18n("<p>Technical details:<br>").append(errStr)); + if (!unlockResult.contains("result") || !unlockResult["result"].toBool()) + { + TQString errStr = unlockResult.contains("errStr") ? unlockResult["errStr"].toString() : TQString::null; + if (errStr.isEmpty()) + { + errStr = i18n("<qt>Unable to unlock this device.<p>Potential reasons include:<br>Wrong password " + "and/or user privilege level.<br>Corrupt data on storage device.</qt>"); } - qerror.append("</qt>"); + KMessageBox::error(this, errStr, i18n("Unlock Failed")); + m_passDlg->clearPassword(); } else { m_passDlg->hide(); - qerror = ""; } - if (qerror != "") KMessageBox::error(this, qerror, i18n("Unlock Failed")); - populateDeviceInformation(); } @@ -999,25 +1000,18 @@ void DevicePropertiesDialog::lockDisk() { // Use DCOP call to lock the disk to make sure the status and mime type of the underlying medium // is correctly updated throughout TDE - TQString qerror; DCOPRef mediamanager("kded", "mediamanager"); DCOPReply reply = mediamanager.call("lockByNode", sdevice->deviceNode()); TQStringVariantMap lockResult; if (reply.isValid()) { reply.get(lockResult); } - if (lockResult["result"].toBool() == false) { + if (!lockResult.contains("result") || lockResult["result"].toBool() == false) { // Lock failed! - qerror = "<qt>" + i18n("Unfortunately, the device could not be locked."); - TQString errStr = lockResult.contains("errStr") ? lockResult["errStr"].toString() : TQString::null; - if (!errStr.isEmpty()) { - qerror.append(i18n("<p>Technical details:<br>").append(errStr)); - } - qerror.append("</qt>"); + TQString errStr = lockResult.contains("errStr") ? lockResult["errStr"].toString() : i18n("Unable to lock the device."); + KMessageBox::error(this, "<qt>" + errStr + "</qt>", i18n("Lock Failed")); } - if (qerror != "") KMessageBox::error(this, qerror, i18n("Lock Failed")); - populateDeviceInformation(); } |