Branch: master

32566acc 2019-07-07 08:50:00 Michele Calgaro
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@...>
M tdecore/tdehw/tdestoragedevice.cpp

tdecore/tdehw/tdestoragedevice.cpp

diff --git a/tdecore/tdehw/tdestoragedevice.cpp b/tdecore/tdehw/tdestoragedevice.cpp
index 7dd2365..5489dfc 100644
--- a/tdecore/tdehw/tdestoragedevice.cpp
+++ b/tdecore/tdehw/tdestoragedevice.cpp
@@ -328,6 +328,7 @@
 	if (dbusConn.isConnected()) {
 		TQString blockDeviceString = sdevice->deviceNode();
 		blockDeviceString.replace("/dev/", "");
+		blockDeviceString.replace("-", "_2d");
 		blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString;
 
 		// Eject the drive!
@@ -358,6 +359,7 @@
 	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()) {
@@ -424,6 +426,7 @@
 	if (dbusConn.isConnected()) {
 		TQString blockDeviceString = deviceNode;
 		blockDeviceString.replace("/dev/", "");
+		blockDeviceString.replace("-", "_2d");
 		blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString;
 
 		// Mount the drive!
@@ -466,6 +469,7 @@
 	if (dbusConn.isConnected()) {
 		TQString blockDeviceString = deviceNode;
 		blockDeviceString.replace("/dev/", "");
+		blockDeviceString.replace("-", "_2d");
 		blockDeviceString = "/org/freedesktop/UDisks2/block_devices/" + blockDeviceString;
 
 		// Mount the drive!
@@ -512,6 +516,7 @@
 	if (dbusConn.isConnected()) {
 		TQString blockDeviceString = deviceNode;
 		blockDeviceString.replace("/dev/", "");
+		blockDeviceString.replace("-", "_2d");
 		blockDeviceString = "/org/freedesktop/UDisks/devices/" + blockDeviceString;
 
 		// Mount the drive!
@@ -553,6 +558,7 @@
 	if (dbusConn.isConnected()) {
 		TQString blockDeviceString = deviceNode;
 		blockDeviceString.replace("/dev/", "");
+		blockDeviceString.replace("-", "_2d");
 		blockDeviceString = "/org/freedesktop/UDisks2/block_devices/" + blockDeviceString;
 
 		// Mount the drive!
c76553c4 2019-07-07 13:37:13 Michele Calgaro
tdehw: TRUE/FALSE --> true/false renaming.

Signed-off-by: Michele Calgaro <michele.calgaro@...>
M tdecore/tdehw/networkbackends/network-manager/dbus-introspection/nm-device.xml
M tdecore/tdehw/networkbackends/network-manager/dbus-introspection/nm-manager.xml
M tdecore/tdehw/networkbackends/network-manager/network-manager.cpp
M tdecore/tdehw/tdebacklightdevice.cpp
M tdecore/tdehw/tdebacklightdevice.h
M tdecore/tdehw/tdebatterydevice.h
M tdecore/tdehw/tdecpudevice.cpp
M tdecore/tdehw/tdecpudevice.h
M tdecore/tdehw/tdecryptographiccarddevice.cpp
M tdecore/tdehw/tdeeventdevice.cpp
M tdecore/tdehw/tdehardwaredevices.cpp
M tdecore/tdehw/tdehardwaredevices.h
M tdecore/tdehw/tdemainspowerdevice.h
M tdecore/tdehw/tdemonitordevice.h
M tdecore/tdehw/tdenetworkconnections.cpp
M tdecore/tdehw/tdenetworkdevice.h
M tdecore/tdehw/tderootsystemdevice.cpp
M tdecore/tdehw/tderootsystemdevice.h
M tdecore/tdehw/tdestoragedevice.cpp
M tdecore/tdehw/tdestoragedevice.h

tdecore/tdehw/networkbackends/network-manager/dbus-introspection/nm-device.xml

diff --git a/tdecore/tdehw/networkbackends/network-manager/dbus-introspection/nm-device.xml b/tdecore/tdehw/networkbackends/network-manager/dbus-introspection/nm-device.xml
index 5b2c98b..4223eeb 100644
--- a/tdecore/tdehw/networkbackends/network-manager/dbus-introspection/nm-device.xml
+++ b/tdecore/tdehw/networkbackends/network-manager/dbus-introspection/nm-device.xml
@@ -103,15 +103,15 @@
     </property>
     <property name="Autoconnect" type="b" access="readwrite">
       <tp:docstring>
-        If TRUE, indicates the device is allowed to autoconnect.  If FALSE,
+        If true, indicates the device is allowed to autoconnect.  If false,
         manual intervention is required before the device will automatically
         connect to a known network, such as activating a connection using the
-        device, or setting this property to TRUE.
+        device, or setting this property to true.
       </tp:docstring>
     </property>
     <property name="FirmwareMissing" type="b" access="read">
       <tp:docstring>
-        If TRUE, indicates the device is likely missing firmware necessary for
+        If true, indicates the device is likely missing firmware necessary for
         its operation.
       </tp:docstring>
     </property>

tdecore/tdehw/networkbackends/network-manager/dbus-introspection/nm-manager.xml

diff --git a/tdecore/tdehw/networkbackends/network-manager/dbus-introspection/nm-manager.xml b/tdecore/tdehw/networkbackends/network-manager/dbus-introspection/nm-manager.xml
index f5fd7ab..4394694 100644
--- a/tdecore/tdehw/networkbackends/network-manager/dbus-introspection/nm-manager.xml
+++ b/tdecore/tdehw/networkbackends/network-manager/dbus-introspection/nm-manager.xml
@@ -168,7 +168,7 @@
       </tp:docstring>
       <arg name="enable" type="b" direction="in">
         <tp:docstring>
-          If FALSE, indicates that all networking should be disabled.  If TRUE,
+          If false, indicates that all networking should be disabled.  If true,
           indicates that NetworkManager should begin managing network devices.
         </tp:docstring>
       </arg>

tdecore/tdehw/networkbackends/network-manager/network-manager.cpp

diff --git a/tdecore/tdehw/networkbackends/network-manager/network-manager.cpp b/tdecore/tdehw/networkbackends/network-manager/network-manager.cpp
index f889a58..a7ca751 100644
--- a/tdecore/tdehw/networkbackends/network-manager/network-manager.cpp
+++ b/tdecore/tdehw/networkbackends/network-manager/network-manager.cpp
@@ -1623,7 +1623,7 @@
 		// Wait for the asynchronous call to return...
 		d->nmConnectionSettingsAsyncCallWaiting[asyncCallID] = true;
 		TQTimer nmCallTimeoutTimer;
-		nmCallTimeoutTimer.start(NM_ASYNC_TIMEOUT_MS, TRUE);
+		nmCallTimeoutTimer.start(NM_ASYNC_TIMEOUT_MS, true);
 		while (d->nmConnectionSettingsAsyncCallWaiting[asyncCallID]) {
 			tqApp->processEvents();
 			if (!nmCallTimeoutTimer.isActive()) {
@@ -1966,7 +1966,7 @@
 					// Wait for the asynchronous call to return...
 					d->nmConnectionSettingsAsyncCallWaiting[asyncCallID] = true;
 					TQTimer nmCallTimeoutTimer;
-					nmCallTimeoutTimer.start(NM_ASYNC_TIMEOUT_MS, TRUE);
+					nmCallTimeoutTimer.start(NM_ASYNC_TIMEOUT_MS, true);
 					while (d->nmConnectionSettingsAsyncCallWaiting[asyncCallID]) {
 						tqApp->processEvents();
 						if (!nmCallTimeoutTimer.isActive()) {
@@ -2465,7 +2465,7 @@
 											TQT_DBusDataValueList::const_iterator it4;
 											for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
 												TQT_DBusData innerDataValue = *it4;
-												TQStringList pieces = TQStringList::split(":", innerDataValue.toString(), TRUE);
+												TQStringList pieces = TQStringList::split(":", innerDataValue.toString(), true);
 												vlanConnection->ingressPriorityMap[pieces[0].toUInt()] = pieces[1].toUInt();;
 											}
 										}
@@ -2474,7 +2474,7 @@
 											TQT_DBusDataValueList::const_iterator it4;
 											for (it4 = valueList.begin(); it4 != valueList.end(); ++it4) {
 												TQT_DBusData innerDataValue = *it4;
-												TQStringList pieces = TQStringList::split(":", innerDataValue.toString(), TRUE);
+												TQStringList pieces = TQStringList::split(":", innerDataValue.toString(), true);
 												vlanConnection->egressPriorityMap[pieces[0].toUInt()] = pieces[1].toUInt();;
 											}
 										}
@@ -3030,7 +3030,7 @@
 	TDENetworkConnection* connection = findConnectionByUUID(uuid);
 	if (!connection) {
 		PRINT_ERROR(TQString("Unable to locate connection with uuid '%1' in local database.  Did you run loadConnectionInformation() first?"));
-		return FALSE;
+		return false;
 	}
 	//TDEWiredEthernetConnection* ethernetConnection = dynamic_cast<TDEWiredEthernetConnection*>(connection);
 	//TDEWiredInfinibandConnection* infinibandConnection = dynamic_cast<TDEWiredInfinibandConnection*>(connection);
@@ -3042,7 +3042,7 @@
 	//TDEBluetoothConnection* bluetoothConnection = dynamic_cast<TDEBluetoothConnection*>(connection);
 	TDEModemConnection* modemConnection = dynamic_cast<TDEModemConnection*>(connection);
 
-	bool ret = TRUE;
+	bool ret = true;
 	ret = ret && loadConnectionSecretsForGroup(uuid, "802-1x");
 	if (wiFiConnection) {
 		ret = ret && loadConnectionSecretsForGroup(uuid, "802-11-wireless-security");
@@ -3062,7 +3062,7 @@
 	TDENetworkConnection* connection = findConnectionByUUID(uuid);
 	if (!connection) {
 		PRINT_ERROR(TQString("Unable to locate connection with uuid '%1' in local database.  Did you run loadConnectionInformation() first?"));
-		return FALSE;
+		return false;
 	}
 	//TDEWiredEthernetConnection* ethernetConnection = dynamic_cast<TDEWiredEthernetConnection*>(connection);
 	//TDEWiredInfinibandConnection* infinibandConnection = dynamic_cast<TDEWiredInfinibandConnection*>(connection);
@@ -3104,7 +3104,7 @@
 			// Wait for the asynchronous call to return...
 			d->nmConnectionSettingsAsyncCallWaiting[asyncCallID] = true;
 			TQTimer nmCallTimeoutTimer;
-			nmCallTimeoutTimer.start(NM_ASYNC_SECRETS_INTERACTION_TIMEOUT_MS, TRUE);
+			nmCallTimeoutTimer.start(NM_ASYNC_SECRETS_INTERACTION_TIMEOUT_MS, true);
 			while (d->nmConnectionSettingsAsyncCallWaiting[asyncCallID]) {
 				tqApp->processEvents();
 				if (!nmCallTimeoutTimer.isActive()) {
@@ -3242,26 +3242,26 @@
 					}
 				}
 			}
-			return TRUE;
+			return true;
 		}
 		else {
 			PRINT_ERROR(TQString("Unable to load secrets for connection with uuid '%1'").arg(uuid))
-			return FALSE;
+			return false;
 		}
 	}
 	else {
 		PRINT_WARNING(TQString("connection for provided uuid '%1' was not found").arg(uuid));
-		return FALSE;
+		return false;
 	}
 }
 
 bool TDENetworkConnectionManager_BackendNM::saveConnection(TDENetworkConnection* connection) {
-	bool timed_out = FALSE;
-	bool command_failed = FALSE;
+	bool timed_out = false;
+	bool command_failed = false;
 
 	if (!connection) {
 		PRINT_ERROR(TQString("connection cannot be NULL!"));
-		return FALSE;
+		return false;
 	}
 
 	// If the UUID is blank, generate a new UUID for this connection and also guarantee that it it truly unique
@@ -3321,7 +3321,7 @@
 			// Wait for the asynchronous call to return...
 			d->nmConnectionSettingsAsyncCallWaiting[asyncCallID] = true;
 			TQTimer nmCallTimeoutTimer;
-			nmCallTimeoutTimer.start(NM_ASYNC_TIMEOUT_MS, TRUE);
+			nmCallTimeoutTimer.start(NM_ASYNC_TIMEOUT_MS, true);
 			while (d->nmConnectionSettingsAsyncCallWaiting[asyncCallID]) {
 				tqApp->processEvents();
 				if (!nmCallTimeoutTimer.isActive()) {
@@ -3402,7 +3402,7 @@
 			dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
 			groupValid = (settingsMap.count() > 0);
 		}
-		if (groupValid) outerMap.insert("connection", dbusData, TRUE); else outerMap.remove("connection");
+		if (groupValid) outerMap.insert("connection", dbusData, true); else outerMap.remove("connection");
 
 		groupValid = false;
 		dbusData = outerMap["802-1x"];
@@ -3633,7 +3633,7 @@
 			dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
 			groupValid = (settingsMap.count() > 0);
 		}
-		if (groupValid) outerMap.insert("802-1x", dbusData, TRUE); else outerMap.remove("802-1x");
+		if (groupValid) outerMap.insert("802-1x", dbusData, true); else outerMap.remove("802-1x");
 
 		groupValid = false;
 		dbusData = outerMap["802-3-ethernet"];
@@ -3679,7 +3679,7 @@
 			dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
 			groupValid = (settingsMap.count() > 0);
 		}
-		if (groupValid) outerMap.insert("802-3-ethernet", dbusData, TRUE); else outerMap.remove("802-3-ethernet");
+		if (groupValid) outerMap.insert("802-3-ethernet", dbusData, true); else outerMap.remove("802-3-ethernet");
 
 		groupValid = false;
 		dbusData = outerMap["infiniband"];
@@ -3711,7 +3711,7 @@
 			dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
 			groupValid = (settingsMap.count() > 0);
 		}
-		if (groupValid) outerMap.insert("infiniband", dbusData, TRUE); else outerMap.remove("infiniband");
+		if (groupValid) outerMap.insert("infiniband", dbusData, true); else outerMap.remove("infiniband");
 
 		groupValid = false;
 		dbusData = outerMap["802-11-wireless"];
@@ -3831,7 +3831,7 @@
 			dbusData = TQT_DBusData::fromStringKeyMap(TQT_DBusDataMap<TQString>(settingsMap));
 			groupValid = (settingsMap.count() > 0);
 		}
-		if (groupValid) outerMap.insert("802-11-wireless", dbusData, TRUE); else outerMap.remove("802-11-wireless");
+		if (groupValid) outerMap.insert("802-11-wireless", dbusData, true); else outerMap.remove("802-11-wireless");
 
 		groupValid = false;
** Diff limit reached (max: 250 lines) **
7214a7b6 2019-07-07 13:40:46 Michele Calgaro
tdehw: code restructuring for tdestoragedevice.
1. added disk helper source files
2. removed WITH_UDISKS2, WITH_UDISK, WITH_UDEVIL defines. The respective code is always included
3. order of execution for mount/umount activities: udisks2, udisk, udevil, pmount.

Signed-off-by: Michele Calgaro <michele.calgaro@...>
A tdecore/tdehw/disksHelper.cpp
A tdecore/tdehw/disksHelper.h
M CMakeLists.txt
M tdecore/tdehw/CMakeLists.txt
M tdecore/tdehw/tdestoragedevice.cpp
M tdeioslave/file/file.cc
** Diff limit reached (max: 250 lines) **