df9e4e43 | 2019-07-08 01:33:32 | Michele Calgaro |
Adjusted to new TDEStorageOpResult-based tdelibs api. Signed-off-by: Michele Calgaro <michele.calgaro@...> |
||
M kcontrol/hwmanager/devicepropsdlg.cpp M kcontrol/hwmanager/hwdevicetray.cpp M tdeioslave/media/mediamanager/tdehardwarebackend.cpp |
||
kcontrol/hwmanager/devicepropsdlg.cppdiff --git a/kcontrol/hwmanager/devicepropsdlg.cpp b/kcontrol/hwmanager/devicepropsdlg.cpp index 885dc7a..c97c6de 100644 --- a/kcontrol/hwmanager/devicepropsdlg.cpp +++ b/kcontrol/hwmanager/devicepropsdlg.cpp @@ -879,21 +879,19 @@ 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()); } TDEStorageMountOptions mountOptions; - TQString mountMessages; - TQString mountedPath = sdevice->mountDevice(diskLabel, mountOptions, &mountMessages); - if (mountedPath.isNull()) { + TDEStorageOpResult mountResult = sdevice->mountDevice(diskLabel, mountOptions); + TQString mountedPath = mountResult.contains("mountPath") ? mountResult["mountPath"].toString() : TQString::null; + if (mountedPath.isEmpty()) { 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)); + TQString errStr = mountResult.contains("errStr") ? mountResult["errStr"].toString() : TQString::null; + if (!errStr.isEmpty()) { + qerror.append(i18n("<p>Technical details:<br>").append(errStr)); } qerror.append("</qt>"); } @@ -910,13 +908,13 @@ TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(m_device); TQString qerror; - TQString unmountMessages; - int unmountRetcode = 0; - if (!sdevice->unmountDevice(&unmountMessages, &unmountRetcode)) { + TDEStorageOpResult unmountResult = sdevice->unmountDevice(); + if (unmountResult["result"].toBool() == false) { // Unmount failed! qerror = "<qt>" + i18n("Unfortunately, the device could not be unmounted."); - if (!unmountMessages.isNull()) { - qerror.append(i18n("<p>Technical details:<br>").append(unmountMessages)); + TQString errStr = unmountResult.contains("errStr") ? unmountResult["errStr"].toString() : TQString::null; + if (!errStr.isEmpty()) { + qerror.append(i18n("<p>Technical details:<br>").append(errStr)); } qerror.append("</qt>"); } kcontrol/hwmanager/hwdevicetray.cppdiff --git a/kcontrol/hwmanager/hwdevicetray.cpp b/kcontrol/hwmanager/hwdevicetray.cpp index b6ef8a6..ae3a1db 100644 --- a/kcontrol/hwmanager/hwdevicetray.cpp +++ b/kcontrol/hwmanager/hwdevicetray.cpp @@ -300,11 +300,12 @@ for (hwdevice = diskDeviceList.first(); hwdevice; hwdevice = diskDeviceList.next()) { TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice); if ((sdevice->diskUUID() == uuid) || (sdevice->systemPath() == uuid)) { - if (sdevice->mountPath() != TQString::null) { - int retcode; - TQString errstr; - if (!sdevice->unmountDevice(&errstr, &retcode)) { - KMessageBox::error(0, i18n("<qt><b>Unable to eject device</b><p>Detailed error information:<br>%1 (code %2)</qt>").arg(errstr).arg(retcode), i18n("Eject Failed")); + if (!sdevice->mountPath().isEmpty()) { + TDEStorageOpResult unmountResult = sdevice->unmountDevice(); + if (unmountResult["result"].toBool() == false) { + TQString errStr = unmountResult.contains("errStr") ? unmountResult["errStr"].toString() : TQString::null; + TQString retcodeStr = unmountResult.contains("retCode") ? unmountResult["retCode"].asString() : "not available"; + KMessageBox::error(0, i18n("<qt><b>Unable to eject device</b><p>Detailed error information:<br>%1 (error code %2)</qt>").arg(errStr).arg(retcodeStr), i18n("Eject Failed")); } return; } tdeioslave/media/mediamanager/tdehardwarebackend.cppdiff --git a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp index 4746f48..034bf67 100644 --- a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp +++ b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp @@ -1233,12 +1233,13 @@ if (!medium->isEncrypted()) { // normal volume - TQString mountMessages; - TQString mountedPath = sdevice->mountDevice(diskLabel, valids, &mountMessages); - if (mountedPath.isNull()) { + TDEStorageOpResult mountResult = sdevice->mountDevice(diskLabel, valids); + TQString mountedPath = mountResult.contains("mountPath") ? mountResult["mountPath"].toString() : TQString::null; + if (mountedPath.isEmpty()) { 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)); + TQString errStr = mountResult.contains("errStr") ? mountResult["errStr"].toString() : TQString::null; + if (!errStr.isEmpty()) { + qerror.append(i18n("<p>Technical details:<br>").append(errStr)); } qerror.append("</qt>"); } @@ -1285,17 +1286,16 @@ } // mount encrypted volume with password - int mountRetcode; - TQString mountMessages; - TQString mountedPath = sdevice->mountEncryptedDevice(m_decryptionPassword, diskLabel, valids, &mountMessages, &mountRetcode); - if (mountedPath.isNull()) { - if (mountRetcode == 0) { + TDEStorageOpResult mountResult = sdevice->mountEncryptedDevice(m_decryptionPassword, diskLabel, valids); + TQString mountedPath = mountResult.contains("mountPath") ? mountResult["mountPath"].toString() : TQString::null; + if (mountedPath.isEmpty()) { + if (mountResult.contains("retCode") && mountResult["retCode"].toInt() == 0) { // Mounting was successful // Because the TDE hardware backend is event driven it might take a little while for the new unencrypted mapped device to show up // Wait up to 30 seconds for it to appear... for (int i=0;i<300;i++) { mountedPath = sdevice->mountPath(); - if (!mountedPath.isNull()) { + if (!mountedPath.isEmpty()) { break; } tqApp->processEvents(50); @@ -1303,8 +1303,8 @@ } } } - if (mountedPath.isNull()) { - if (mountRetcode == 25600) { + if (mountedPath.isEmpty()) { + if (mountResult.contains("retCode") && mountResult["retCode"].toInt() == 25600) { // Probable LUKS failure // Retry m_decryptDialog->setEnabled(true); @@ -1312,8 +1312,9 @@ } else { 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<br>Incorrect encryption password"); - if (!mountMessages.isNull()) { - qerror.append(i18n("<p>Technical details:<br>").append(mountMessages)); + TQString errStr = mountResult.contains("errStr") ? mountResult["errStr"].toString() : TQString::null; + if (!errStr.isEmpty()) { + qerror.append(i18n("<p>Technical details:<br>").append(errStr)); } qerror.append("</qt>"); continue_trying_to_decrypt = false; @@ -1399,13 +1400,13 @@ TQString uid = sdevice->uniqueID(); TQString node = sdevice->deviceNode(); - TQString unmountMessages; - int unmountRetcode = 0; - if (!sdevice->unmountDevice(&unmountMessages, &unmountRetcode)) { + TDEStorageOpResult unmountResult = sdevice->unmountDevice(); + if (unmountResult["result"].toBool() == false) { // Unmount failed! qerror = "<qt>" + i18n("Unfortunately, the device <b>%1</b> (%2) named <b>'%3'</b> and currently mounted at <b>%4</b> could not be unmounted. ").arg("system:/media/" + medium->name(), medium->deviceNode(), medium->prettyLabel(), medium->prettyBaseURL().pathOrURL()); - if (!unmountMessages.isNull()) { - qerror.append(i18n("<p>Technical details:<br>").append(unmountMessages)); + TQString errStr = unmountResult.contains("errStr") ? unmountResult["errStr"].toString() : TQString::null; + if (!errStr.isEmpty()) { + qerror.append(i18n("<p>Technical details:<br>").append(errStr)); } qerror.append("</qt>"); } @@ -1413,17 +1414,19 @@ qerror = ""; } - if (unmountRetcode == 1280) { + if (unmountResult.contains("retCode") && unmountResult["retCode"].toInt() == 1280) { // Failed as BUSY TQString processesUsingDev = listUsingProcesses(medium); if (!processesUsingDev.isNull()) { if (KMessageBox::warningYesNo(0, i18n("<qt>The device <b>%1</b> (%2) named <b>'%3'</b> and currently mounted at <b>%4</b> can not be unmounted at this time.<p>%5<p><b>Would you like to forcibly terminate these processes?</b><br><i>All unsaved data would be lost</i>").arg("system:/media/" + medium->name()).arg(medium->deviceNode()).arg(medium->prettyLabel()).arg(medium->prettyBaseURL().pathOrURL()).arg(processesUsingDev)) == KMessageBox::Yes) { killUsingProcesses(medium); - if (!sdevice->unmountDevice(&unmountMessages, &unmountRetcode)) { + unmountResult = sdevice->unmountDevice(); + if (unmountResult["result"].toBool() == false) { // Unmount failed! qerror = "<qt>" + i18n("Unfortunately, the device <b>%1</b> (%2) named <b>'%3'</b> and currently mounted at <b>%4</b> could not be unmounted. ").arg("system:/media/" + medium->name(), medium->deviceNode(), medium->prettyLabel(), medium->prettyBaseURL().pathOrURL()); - if (!unmountMessages.isNull()) { - qerror.append(i18n("<p>Technical details:<br>").append(unmountMessages)); + TQString errStr = unmountResult.contains("errStr") ? unmountResult["errStr"].toString() : TQString::null; + if (!errStr.isEmpty()) { + qerror.append(i18n("<p>Technical details:<br>").append(errStr)); } qerror.append("</qt>"); } |
||
7d2c7f06 | 2019-07-08 01:33:33 | Michele Calgaro |
Adjusted to use new TQStringVariantMap type. Signed-off-by: Michele Calgaro <michele.calgaro@...> |
||
M kcontrol/hwmanager/devicepropsdlg.cpp M kcontrol/hwmanager/hwdevicetray.cpp M tdeioslave/media/mediamanager/tdehardwarebackend.cpp |
||
kcontrol/hwmanager/devicepropsdlg.cppdiff --git a/kcontrol/hwmanager/devicepropsdlg.cpp b/kcontrol/hwmanager/devicepropsdlg.cpp index c97c6de..be15b4e 100644 --- a/kcontrol/hwmanager/devicepropsdlg.cpp +++ b/kcontrol/hwmanager/devicepropsdlg.cpp @@ -885,7 +885,7 @@ diskLabel = i18n("%1 Removable Device").arg(sdevice->deviceFriendlySize()); } TDEStorageMountOptions mountOptions; - TDEStorageOpResult mountResult = sdevice->mountDevice(diskLabel, mountOptions); + TQStringVariantMap mountResult = sdevice->mountDevice(diskLabel, mountOptions); TQString mountedPath = mountResult.contains("mountPath") ? mountResult["mountPath"].toString() : TQString::null; if (mountedPath.isEmpty()) { 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"); @@ -908,7 +908,7 @@ TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(m_device); TQString qerror; - TDEStorageOpResult unmountResult = sdevice->unmountDevice(); + TQStringVariantMap unmountResult = sdevice->unmountDevice(); if (unmountResult["result"].toBool() == false) { // Unmount failed! qerror = "<qt>" + i18n("Unfortunately, the device could not be unmounted."); kcontrol/hwmanager/hwdevicetray.cppdiff --git a/kcontrol/hwmanager/hwdevicetray.cpp b/kcontrol/hwmanager/hwdevicetray.cpp index ae3a1db..f8e6b89 100644 --- a/kcontrol/hwmanager/hwdevicetray.cpp +++ b/kcontrol/hwmanager/hwdevicetray.cpp @@ -301,10 +301,10 @@ TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(hwdevice); if ((sdevice->diskUUID() == uuid) || (sdevice->systemPath() == uuid)) { if (!sdevice->mountPath().isEmpty()) { - TDEStorageOpResult unmountResult = sdevice->unmountDevice(); + TQStringVariantMap unmountResult = sdevice->unmountDevice(); if (unmountResult["result"].toBool() == false) { TQString errStr = unmountResult.contains("errStr") ? unmountResult["errStr"].toString() : TQString::null; - TQString retcodeStr = unmountResult.contains("retCode") ? unmountResult["retCode"].asString() : "not available"; + TQString retcodeStr = unmountResult.contains("retCode") ? unmountResult["retCode"].toString() : "not available"; KMessageBox::error(0, i18n("<qt><b>Unable to eject device</b><p>Detailed error information:<br>%1 (error code %2)</qt>").arg(errStr).arg(retcodeStr), i18n("Eject Failed")); } return; tdeioslave/media/mediamanager/tdehardwarebackend.cppdiff --git a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp index 034bf67..33d1fe4 100644 --- a/tdeioslave/media/mediamanager/tdehardwarebackend.cpp +++ b/tdeioslave/media/mediamanager/tdehardwarebackend.cpp @@ -1233,7 +1233,7 @@ if (!medium->isEncrypted()) { // normal volume - TDEStorageOpResult mountResult = sdevice->mountDevice(diskLabel, valids); + TQStringVariantMap mountResult = sdevice->mountDevice(diskLabel, valids); TQString mountedPath = mountResult.contains("mountPath") ? mountResult["mountPath"].toString() : TQString::null; if (mountedPath.isEmpty()) { 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"); @@ -1286,7 +1286,7 @@ } // mount encrypted volume with password - TDEStorageOpResult mountResult = sdevice->mountEncryptedDevice(m_decryptionPassword, diskLabel, valids); + TQStringVariantMap mountResult = sdevice->mountEncryptedDevice(m_decryptionPassword, diskLabel, valids); TQString mountedPath = mountResult.contains("mountPath") ? mountResult["mountPath"].toString() : TQString::null; if (mountedPath.isEmpty()) { if (mountResult.contains("retCode") && mountResult["retCode"].toInt() == 0) { @@ -1400,7 +1400,7 @@ TQString uid = sdevice->uniqueID(); TQString node = sdevice->deviceNode(); ** Diff limit reached (max: 250 lines) ** |
||
e44487e1 | 2019-07-08 01:33:33 | Michele Calgaro |
Improved media manager dcop interface for mount/unmount/decrypt/undecrypt methods by returning more information. Signed-off-by: Michele Calgaro <michele.calgaro@...> |
||
M tdeioslave/media/mediaimpl.cpp M tdeioslave/media/mediamanager/fstabbackend.cpp M tdeioslave/media/mediamanager/fstabbackend.h M tdeioslave/media/mediamanager/halbackend.cpp M tdeioslave/media/mediamanager/halbackend.h M tdeioslave/media/mediamanager/mediamanager.cpp M tdeioslave/media/mediamanager/mediamanager.h M tdeioslave/media/mediamanager/tdehardwarebackend.cpp M tdeioslave/media/mediamanager/tdehardwarebackend.h M tdeioslave/media/mounthelper/tdeio_media_mounthelper.cpp |
||
** Diff limit reached (max: 250 lines) **
|
||
b4754b0e | 2019-07-08 01:33:34 | Michele Calgaro |
Extended media manager dcop interface by adding functions to mount/unmount/decrypt/undecrypt a medium by device node (for example /dev/sdc). Signed-off-by: Michele Calgaro <michele.calgaro@...> |
||
M tdeioslave/media/mediamanager/medialist.cpp M tdeioslave/media/mediamanager/medialist.h M tdeioslave/media/mediamanager/mediamanager.cpp M tdeioslave/media/mediamanager/mediamanager.h |
||
** Diff limit reached (max: 250 lines) **
|
||
bd991348 | 2019-07-08 01:33:34 | Michele Calgaro |
Renamed methods decrypt/undecrypt to unlock/lock. Signed-off-by: Michele Calgaro <michele.calgaro@...> |
||
M tdeioslave/media/mediamanager/halbackend.cpp M tdeioslave/media/mediamanager/halbackend.h M tdeioslave/media/mediamanager/mediamanager.cpp M tdeioslave/media/mediamanager/mediamanager.h M tdeioslave/media/mediamanager/tdehardwarebackend.cpp M tdeioslave/media/mediamanager/tdehardwarebackend.h |
||
** Diff limit reached (max: 250 lines) **
|