tdehw: avoid crashing kded when using udisks/udisks2 to operate on

drives that contain dashes. This relates to issue #32.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 32566accda)
r14.0.x
Michele Calgaro 5 years ago
parent 0f7cda9d52
commit c90f6c3e50
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -112,6 +112,7 @@ bool ejectDriveUDisks(TDEStorageDevice* sdevice) {
if (dbusConn.isConnected()) {
TQString blockDeviceString = sdevice->deviceNode();
blockDeviceString.replace("/dev/", "");
blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString;
// Eject the drive!
@ -142,6 +143,7 @@ bool ejectDriveUDisks2(TDEStorageDevice* sdevice) {
if (dbusConn.isConnected()) {
TQString blockDeviceString = sdevice->deviceNode();
blockDeviceString.replace("/dev/", "");
blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks2/block_devices/" + blockDeviceString;
TQT_DBusProxy hardwareControl("org.freedesktop.UDisks2", blockDeviceString, "org.freedesktop.DBus.Properties", dbusConn);
if (hardwareControl.canSend()) {
@ -208,6 +210,7 @@ int mountDriveUDisks(TQString deviceNode, TQString fileSystemType, TQStringList
if (dbusConn.isConnected()) {
TQString blockDeviceString = deviceNode;
blockDeviceString.replace("/dev/", "");
blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString;
// Mount the drive!
@ -250,6 +253,7 @@ int mountDriveUDisks2(TQString deviceNode, TQString fileSystemType, TQString mou
if (dbusConn.isConnected()) {
TQString blockDeviceString = deviceNode;
blockDeviceString.replace("/dev/", "");
blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks2/block_devices/" + blockDeviceString;
// Mount the drive!
@ -296,6 +300,7 @@ int unMountDriveUDisks(TQString deviceNode, TQStringList unMountOptions, TQStrin
if (dbusConn.isConnected()) {
TQString blockDeviceString = deviceNode;
blockDeviceString.replace("/dev/", "");
blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString;
// Mount the drive!
@ -337,6 +342,7 @@ int unMountDriveUDisks2(TQString deviceNode, TQString unMountOptions, TQString*
if (dbusConn.isConnected()) {
TQString blockDeviceString = deviceNode;
blockDeviceString.replace("/dev/", "");
blockDeviceString.replace("-", "_2d");
blockDeviceString = "/org/freedesktop/UDisks2/block_devices/" + blockDeviceString;
// Mount the drive!

Loading…
Cancel
Save