Attached is a proposed patch to fix a couple of bugs and provide access to some information that was already indexed internally.<br><br>Index: libs/solid/control/networkinterface.h<br>===================================================================<br>
--- libs/solid/control/networkinterface.h (revision 782822)<br>+++ libs/solid/control/networkinterface.h (working copy)<br>@@ -203,6 +203,14 @@<br> */<br> NetworkList networks() const;<br> <br>+ /**<br>
+ * Retrieves the active network on the device<br>+ *<br>+ * For wired network interfaces this will always be the same network,<br>+ * but for wireless networks this will be the associated AP.<br>
+ */<br>+ QString activeNetwork() const;<br>+<br><br>This provides data that was stored in activeNetPath under NetworkManager-networkinterface.<br><br><br><br><br>Index: solid/networkmanager-0.6/NetworkManager-networkinterface.cpp<br>
===================================================================<br>--- solid/networkmanager-0.6/NetworkManager-networkinterface.cpp (revision 782822)<br>+++ solid/networkmanager-0.6/NetworkManager-networkinterface.cpp (working copy)<br>
@@ -53,27 +53,27 @@<br> {<br> //kDebug(1441) << /*"deserialize args: " << message.arguments() << */"signature: " << message.signature();<br> QList<QVariant> args = message.arguments();<br>
- device.path.setPath(args.takeFirst().toString());<br>- device.interface = args.takeFirst().toString();<br>- device.type = args.takeFirst().toUInt();<br>- device.udi = args.takeFirst().toString();<br>- device.active = args.takeFirst().toBool();<br>
- device.activationStage = args.takeFirst().toUInt();<br>- network.ipv4Address = args.takeFirst().toString();<br>- network.subnetMask = args.takeFirst().toString();<br>- network.broadcast = args.takeFirst().toString();<br>
- device.hardwareAddress = args.takeFirst().toString();<br>- network.route = args.takeFirst().toString();<br>- network.primaryDNS = args.takeFirst().toString();<br>- network.secondaryDNS = args.takeFirst().toString();<br>
- device.mode = args.takeFirst().toInt();<br>- device.strength = args.takeFirst().toInt();<br>- device.linkActive = args.takeFirst().toBool();<br>- device.speed = args.takeFirst().toInt();<br>- device.capabilities = args.takeFirst().toUInt();<br>
- device.capabilitiesType = args.takeFirst().toUInt();<br>- device.activeNetPath = args.takeFirst().toString();<br>- device.networks = args.takeFirst().toStringList();<br>+ device.path.setPath((args.size() != 0) ? args.takeFirst().toString() : QString());<br>
+ device.interface = (args.size() != 0) ? args.takeFirst().toString() : QString();<br>+ device.type = (args.size() != 0) ? args.takeFirst().toUInt() : 0;<br>+ device.udi = (args.size() != 0) ? args.takeFirst().toString() : QString();<br>
+ device.active = (args.size() != 0) ? args.takeFirst().toBool() : false;<br>+ device.activationStage = (args.size() != 0) ? args.takeFirst().toUInt() : 0;<br>+ network.ipv4Address = (args.size() != 0) ? args.takeFirst().toString() : QString();<br>
+ network.subnetMask = (args.size() != 0) ? args.takeFirst().toString() : QString();<br>+ network.broadcast = (args.size() != 0) ? args.takeFirst().toString() : QString();<br>+ device.hardwareAddress = (args.size() != 0) ? args.takeFirst().toString() : QString();<br>
+ network.route = (args.size() != 0) ? args.takeFirst().toString() : QString();<br>+ network.primaryDNS = (args.size() != 0) ? args.takeFirst().toString() : QString();<br>+ network.secondaryDNS = (args.size() != 0) ? args.takeFirst().toString() : QString();<br>
+ device.mode = (args.size() != 0) ? args.takeFirst().toInt() : 0;<br>+ device.strength = (args.size() != 0) ? args.takeFirst().toInt() : 0;<br>+ device.linkActive = (args.size() != 0) ? args.takeFirst().toBool() : false;<br>
+ device.speed = (args.size() != 0) ? args.takeFirst().toInt() : 0;<br>+ device.capabilities = (args.size() != 0) ? args.takeFirst().toUInt() : 0;<br>+ device.capabilitiesType = (args.size() != 0) ? args.takeFirst().toUInt() : 0;<br>
+ device.activeNetPath = (args.size() != 0) ? args.takeFirst().toString() : QString();<br>+ device.networks = (args.size() != 0) ? args.takeFirst().toStringList() : QStringList();<br><br><br>This prevents a crash when trying to create a networkinterface device with an invalid uni.<br>
<br><br>@@ -183,7 +183,7 @@<br> if (d->type == Solid::Control::NetworkInterface::Ieee8023)<br> {<br> net = new NMNetwork(uni);<br>- net->setActivated(true);<br>+ //net->setActivated(true);<br>
}<br> else if (d->type == Solid::Control::NetworkInterface::Ieee80211)<br> {<br><br>this prevents ethernet from becoming the active network which would make knetworkmanager do a little dance if ethernet was unplugged.<br>
<br>Let me know you thoughts,<br>Chris<br>