[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bnetworkmanagement/nm09=5D_/=3A_simplify_setting_the?=
From:       Lukas Tinkl <lukas () kde ! org>
Date:       2011-06-02 17:51:16
Message-ID: 20110602175116.3F7B1A60A4 () git ! kde ! org
[Download RAW message or body]

Git commit 609c32548e8218bfd4d93d7e4687c40d3b0618ad by Lukas Tinkl.
Committed on 02/06/2011 at 19:50.
Pushed by lukas into branch 'nm09'.

simplify setting the first IPv4 address

plus some other minor fixes

M  +2    -17   applet/interfacedetailswidget.cpp     
M  +1    -16   applet/interfaceitem.cpp     
M  +1    -1    libs/internals/uiutils.cpp     

http://commits.kde.org/networkmanagement/609c32548e8218bfd4d93d7e4687c40d3b0618ad

diff --git a/applet/interfacedetailswidget.cpp b/applet/interfacedetailswidget.cpp
index 6f15d25..f85c9eb 100644
--- a/applet/interfacedetailswidget.cpp
+++ b/applet/interfacedetailswidget.cpp
@@ -350,22 +350,7 @@ QString InterfaceDetailsWidget::currentIpAddress()
 
     OrgFreedesktopNetworkManagerDeviceInterface devIface(NM_DBUS_SERVICE, \
m_ifaceUni, QDBusConnection::systemBus());  if (devIface.isValid()) {
-        QDBusObjectPath ip4ConfigPath = devIface.ip4Config();
-
-        OrgFreedesktopNetworkManagerIP4ConfigInterface ip4Iface(NM_DBUS_SERVICE, \
                ip4ConfigPath.path(), QDBusConnection::systemBus());
-        if (ip4Iface.isValid()) {
-            QDBusObjectPath ip4ConfigPath;
-
-            // get the first IP address
-            qDBusRegisterMetaType<QList<QList<uint> > >();
-            QList<QList<uint> > addresses = ip4Iface.addresses();
-            foreach (QList<uint> addressList, addresses) {
-               if (addressList.count() == 3) {
-                    addr.setAddress(ntohl(addressList[0]));
-                    break;
-                }
-            }
-        }
+        addr.setAddress(ntohl(devIface.ip4Address()));
     }
 
     if (addr.isNull()) {
@@ -503,7 +488,7 @@ void InterfaceDetailsWidget::dataUpdated(const QString \
&sourceName, const Plasma  void \
InterfaceDetailsWidget::handleConnectionStateChange(int new_state, int old_state, int \
reason)  {
     Q_UNUSED(old_state)
-    if ((new_state == Solid::Control::NetworkInterfaceNm09::Unavailable || new_state \
== Solid::Control::NetworkInterfaceNm09::Unmanaged || \
Solid::Control::NetworkInterfaceNm09::UnknownState) && +    if ((new_state == \
Solid::Control::NetworkInterfaceNm09::Unavailable || new_state == \
Solid::Control::NetworkInterfaceNm09::Unmanaged || new_state == \
Solid::Control::NetworkInterfaceNm09::UnknownState) &&  (reason == \
                Solid::Control::NetworkInterfaceNm09::UnknownReason ||
          reason == Solid::Control::NetworkInterfaceNm09::DeviceRemovedReason)) {
         setInterface(0, false);
diff --git a/applet/interfaceitem.cpp b/applet/interfaceitem.cpp
index 96fb28b..d83b569 100644
--- a/applet/interfaceitem.cpp
+++ b/applet/interfaceitem.cpp
@@ -289,22 +289,7 @@ QString InterfaceItem::currentIpAddress()
 
     OrgFreedesktopNetworkManagerDeviceInterface devIface(NM_DBUS_SERVICE, \
m_iface.data()->uni(), QDBusConnection::systemBus());  if (devIface.isValid()) {
-        QDBusObjectPath ip4ConfigPath = devIface.ip4Config();
-
-        OrgFreedesktopNetworkManagerIP4ConfigInterface ip4Iface(NM_DBUS_SERVICE, \
                ip4ConfigPath.path(), QDBusConnection::systemBus());
-        if (ip4Iface.isValid()) {
-            QDBusObjectPath ip4ConfigPath;
-
-            // get the first IP address
-            qDBusRegisterMetaType<QList<QList<uint> > >();
-            QList<QList<uint> > addresses = ip4Iface.addresses();
-            foreach (QList<uint> addressList, addresses) {
-               if (addressList.count() == 3) {
-                    addr.setAddress(ntohl(addressList[0]));
-                    break;
-                }
-            }
-        }
+        addr.setAddress(ntohl(devIface.ip4Address()));
     }
 
     if (addr.isNull()) {
diff --git a/libs/internals/uiutils.cpp b/libs/internals/uiutils.cpp
index 78530f4..10acc0d 100644
--- a/libs/internals/uiutils.cpp
+++ b/libs/internals/uiutils.cpp
@@ -241,7 +241,7 @@ QString UiUtils::interfaceNameLabel(const QString & uni, const \
KNetworkManagerSe  case KNetworkManagerServicePrefs::VendorProductNames:
             if (dev) {
                 if (!dev->vendor().isEmpty() && !dev->product().isEmpty()) {
-                    label = QString(i18nc("Format for <Vendor> <Product>", "%1 - \
%2", dev->vendor(), dev->product())); +                    label = i18nc("Format for \
<Vendor> <Product>", "%1 - %2", dev->vendor(), dev->product());  }
             }
             break;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic