[Kde-hardware-devel] Proposed patch for Solid::Control
Christopher Blauvelt
cblauvelt at gmail.com
Thu Mar 6 08:10:50 CET 2008
Attached is a proposed patch to fix a couple of bugs and provide access to
some information that was already indexed internally.
Index: libs/solid/control/networkinterface.h
===================================================================
--- libs/solid/control/networkinterface.h (revision 782822)
+++ libs/solid/control/networkinterface.h (working copy)
@@ -203,6 +203,14 @@
*/
NetworkList networks() const;
+ /**
+ * Retrieves the active network on the device
+ *
+ * For wired network interfaces this will always be the same
network,
+ * but for wireless networks this will be the associated AP.
+ */
+ QString activeNetwork() const;
+
This provides data that was stored in activeNetPath under
NetworkManager-networkinterface.
Index: solid/networkmanager-0.6/NetworkManager-networkinterface.cpp
===================================================================
--- solid/networkmanager-0.6/NetworkManager-networkinterface.cpp
(revision 782822)
+++ solid/networkmanager-0.6/NetworkManager-networkinterface.cpp (working
copy)
@@ -53,27 +53,27 @@
{
//kDebug(1441) << /*"deserialize args: " << message.arguments() <<
*/"signature: " << message.signature();
QList<QVariant> args = message.arguments();
- device.path.setPath(args.takeFirst().toString());
- device.interface = args.takeFirst().toString();
- device.type = args.takeFirst().toUInt();
- device.udi = args.takeFirst().toString();
- device.active = args.takeFirst().toBool();
- device.activationStage = args.takeFirst().toUInt();
- network.ipv4Address = args.takeFirst().toString();
- network.subnetMask = args.takeFirst().toString();
- network.broadcast = args.takeFirst().toString();
- device.hardwareAddress = args.takeFirst().toString();
- network.route = args.takeFirst().toString();
- network.primaryDNS = args.takeFirst().toString();
- network.secondaryDNS = args.takeFirst().toString();
- device.mode = args.takeFirst().toInt();
- device.strength = args.takeFirst().toInt();
- device.linkActive = args.takeFirst().toBool();
- device.speed = args.takeFirst().toInt();
- device.capabilities = args.takeFirst().toUInt();
- device.capabilitiesType = args.takeFirst().toUInt();
- device.activeNetPath = args.takeFirst().toString();
- device.networks = args.takeFirst().toStringList();
+ device.path.setPath((args.size() != 0) ? args.takeFirst().toString() :
QString());
+ device.interface = (args.size() != 0) ? args.takeFirst().toString() :
QString();
+ device.type = (args.size() != 0) ? args.takeFirst().toUInt() : 0;
+ device.udi = (args.size() != 0) ? args.takeFirst().toString() :
QString();
+ device.active = (args.size() != 0) ? args.takeFirst().toBool() : false;
+ device.activationStage = (args.size() != 0) ? args.takeFirst().toUInt()
: 0;
+ network.ipv4Address = (args.size() != 0) ? args.takeFirst().toString()
: QString();
+ network.subnetMask = (args.size() != 0) ? args.takeFirst().toString() :
QString();
+ network.broadcast = (args.size() != 0) ? args.takeFirst().toString() :
QString();
+ device.hardwareAddress = (args.size() != 0) ? args.takeFirst().toString()
: QString();
+ network.route = (args.size() != 0) ? args.takeFirst().toString() :
QString();
+ network.primaryDNS = (args.size() != 0) ? args.takeFirst().toString() :
QString();
+ network.secondaryDNS = (args.size() != 0) ? args.takeFirst().toString()
: QString();
+ device.mode = (args.size() != 0) ? args.takeFirst().toInt() : 0;
+ device.strength = (args.size() != 0) ? args.takeFirst().toInt() : 0;
+ device.linkActive = (args.size() != 0) ? args.takeFirst().toBool() :
false;
+ device.speed = (args.size() != 0) ? args.takeFirst().toInt() : 0;
+ device.capabilities = (args.size() != 0) ? args.takeFirst().toUInt() :
0;
+ device.capabilitiesType = (args.size() != 0) ? args.takeFirst().toUInt()
: 0;
+ device.activeNetPath = (args.size() != 0) ? args.takeFirst().toString()
: QString();
+ device.networks = (args.size() != 0) ? args.takeFirst().toStringList()
: QStringList();
This prevents a crash when trying to create a networkinterface device with
an invalid uni.
@@ -183,7 +183,7 @@
if (d->type == Solid::Control::NetworkInterface::Ieee8023)
{
net = new NMNetwork(uni);
- net->setActivated(true);
+ //net->setActivated(true);
}
else if (d->type == Solid::Control::NetworkInterface::Ieee80211)
{
this prevents ethernet from becoming the active network which would make
knetworkmanager do a little dance if ethernet was unplugged.
Let me know you thoughts,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-hardware-devel/attachments/20080306/02cd75e2/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nmpatch.diff
Type: text/x-diff
Size: 7735 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-hardware-devel/attachments/20080306/02cd75e2/attachment-0001.bin
More information about the Kde-hardware-devel
mailing list