diff --git a/applet/interfacedetailswidget.cpp b/applet/interfacedetailswidget.cpp
index 3d0a030..ce3fdbb 100644
--- a/applet/interfacedetailswidget.cpp
+++ b/applet/interfacedetailswidget.cpp
@@ -61,15 +61,19 @@ along with this program. If not, see .
#include "nm-device-interface.h"
#include "../solidcontrolfuture/solid/networkmanager-0.9/dbus/nm-dhcp4-configinterface.h"
#include "nm-ip4-config-interface.h"
+#include "nm-ip6-config-interface.h"
#include "../libs/internals/settings/802-11-wireless.h"
+#include "../backends/NetworkManager/settings/ipv6dbus.h"
class InterfaceDetails
{
public:
Solid::Control::NetworkInterfaceNm09::Type type;
Solid::Control::NetworkInterfaceNm09::ConnectionState connectionState;
- QString ipAddress;
- QString ipGateway;
+ QString ip4Address;
+ QString ip4Gateway;
+ QString ip6Address;
+ QString ip6Gateway;
int bitRate;
QString interfaceName;
QString mac;
@@ -228,8 +232,10 @@ void InterfaceDetailsWidget::getDetails()
details->type = m_iface->type();
details->connectionState = static_cast(m_iface->connectionState());
- details->ipAddress = currentIpAddress();
- details->ipGateway = currentIpGateway();
+ details->ip4Address = currentIp4Address();
+ details->ip4Gateway = currentIp4Gateway();
+ details->ip6Address = currentIp6Address();
+ details->ip6Gateway = currentIp6Gateway();
details->bitRate = bitRate();
details->interfaceName = m_iface->ipInterfaceName();
if (details->interfaceName.isEmpty()) {
@@ -309,8 +315,10 @@ void InterfaceDetailsWidget::showDetails(bool reset)
if (!reset && m_iface) {
info += QString(format).arg(i18nc("interface details", "Type"), UiUtils::interfaceTypeLabel(details->type, m_iface));
info += QString(format).arg(i18nc("interface details", "Connection State"), connectionStateToString(details->connectionState));
- info += QString(format).arg(i18nc("interface details", "IP Address"), details->ipAddress);
- info += QString(format).arg(i18nc("interface details", "IP Gateway"), details->ipGateway);
+ info += QString(format).arg(i18nc("interface details", "IPv4 Address"), details->ip4Address);
+ info += QString(format).arg(i18nc("interface details", "IPv4 Gateway"), details->ip4Gateway);
+ info += QString(format).arg(i18nc("interface details", "IPv6 Address"), details->ip6Address);
+ info += QString(format).arg(i18nc("interface details", "IPv6 Gateway"), details->ip6Gateway);
info += QString(format).arg(i18nc("interface details", "Connection Speed"), details->bitRate ? UiUtils::connectionSpeed(details->bitRate) : i18nc("bitrate", "Unknown"));
info += QString(format).arg(i18nc("interface details", "System Name"), details->interfaceName);
info += QString(format).arg(i18nc("interface details", "MAC Address"), details->mac);
@@ -373,7 +381,7 @@ void InterfaceDetailsWidget::showDetails(bool reset)
update();
}
-QString InterfaceDetailsWidget::currentIpAddress()
+QString InterfaceDetailsWidget::currentIp4Address()
{
if (!m_iface)
return QString();
@@ -395,7 +403,7 @@ QString InterfaceDetailsWidget::currentIpAddress()
return addr.toString();
}
-QString InterfaceDetailsWidget::currentIpGateway()
+QString InterfaceDetailsWidget::currentIp4Gateway()
{
if (!m_iface)
return QString();
@@ -414,11 +422,11 @@ QString InterfaceDetailsWidget::currentIpGateway()
QHostAddress addr;
QList routes = m_iface->ipV4Config().routes();
if (routes.isEmpty()) {
- return i18nc("label of the network interface", "No IP gateway.");
+ return i18nc("label of the network interface", "No IPv4 gateway.");
} else {
addr.setAddress(ntohl(routes.first().route()));
if (addr.isNull()) {
- return i18nc("label of the network interface", "IP display error.");
+ return i18nc("label of the network interface", "IPv4 display error.");
}
}
return addr.toString();
@@ -433,6 +441,77 @@ QString InterfaceDetailsWidget::currentIpGateway()
return i18nc("label of the network interface", "No IP gateway.");
}
+QString InterfaceDetailsWidget::currentIp6Address()
+{
+ if (!m_iface)
+ return QString();
+
+ if (static_cast(m_iface->connectionState()) != Solid::Control::NetworkInterfaceNm09::Activated) {
+ return i18nc("label of the network interface", "No IPv6 address.");
+ }
+
+ QHostAddress addr;
+
+ OrgFreedesktopNetworkManagerDeviceInterface devIface(NM_DBUS_SERVICE, m_ifaceUni, QDBusConnection::systemBus());
+ if (devIface.isValid()) {
+ OrgFreedesktopNetworkManagerIP6ConfigInterface ipv6Config(NM_DBUS_SERVICE, devIface.ip6Config().path(), QDBusConnection::systemBus());
+ if (ipv6Config.isValid()) {
+ QList addresses = ipv6Config.addresses();
+ if (addresses.count()) {
+ IpV6AddressMap address = addresses.first();
+ Q_IPV6ADDR tmp;
+ for (int i = 0; i < 16; ++i) {
+ tmp[i] = address.address[i];
+ }
+ addr.setAddress(tmp);
+ }
+ }
+ }
+
+ if (addr.isNull()) {
+ return i18nc("label of the network interface", "IP display error.");
+ }
+ return addr.toString();
+}
+
+QString InterfaceDetailsWidget::currentIp6Gateway()
+{
+ if (!m_iface)
+ return QString();
+
+ if (static_cast(m_iface->connectionState()) != Solid::Control::NetworkInterfaceNm09::Activated) {
+ return i18nc("label of the network interface", "No IP gateway.");
+ }
+
+ QHostAddress addr;
+
+ OrgFreedesktopNetworkManagerDeviceInterface deviceIface(NM_DBUS_SERVICE, m_ifaceUni, QDBusConnection::systemBus());
+ if (!deviceIface.isValid()) {
+ return i18nc("label of the network interface", "IP display error.");
+ }
+
+ OrgFreedesktopNetworkManagerDeviceInterface devIface(NM_DBUS_SERVICE, m_ifaceUni, QDBusConnection::systemBus());
+ if (devIface.isValid()) {
+ OrgFreedesktopNetworkManagerIP6ConfigInterface ipv6Config(NM_DBUS_SERVICE, devIface.ip6Config().path(), QDBusConnection::systemBus());
+ if (ipv6Config.isValid()) {
+ QList addresses = ipv6Config.addresses();
+ if (addresses.count()) {
+ IpV6AddressMap address = addresses.first();
+ Q_IPV6ADDR tmp;
+ for (int i = 0; i < 16; ++i) {
+ tmp[i] = address.gateway[i];
+ }
+ addr.setAddress(tmp);
+ }
+ }
+ }
+
+ if (addr.isNull() || addr.toString() == "::") {
+ return i18nc("label of the network interface", "No IP gateway.");
+ }
+ return addr.toString();
+}
+
int InterfaceDetailsWidget::bitRate()
{
int bitRate = 0;
@@ -595,8 +674,10 @@ void InterfaceDetailsWidget::handleConnectionStateChange(int new_state, int old_
setInterface(0, false);
emit back();
} else {
- details->ipAddress = currentIpAddress();
- details->ipGateway = currentIpGateway();
+ details->ip4Address = currentIp4Address();
+ details->ip4Gateway = currentIp4Gateway();
+ details->ip6Address = currentIp6Address();
+ details->ip6Gateway = currentIp6Gateway();
details->connectionState = static_cast(new_state);
if (new_state > Solid::Control::NetworkInterfaceNm09::Unavailable && m_iface->type() == Solid::Control::NetworkInterfaceNm09::Bluetooth) {
QString interfaceName = m_iface->ipInterfaceName();
@@ -699,17 +780,17 @@ QString InterfaceDetailsWidget::getMAC()
if (m_iface) { // last resort, although using ifaceName is not portable
QList list = Solid::Device::listFromQuery(QString::fromLatin1("NetworkInterface.ifaceName == '%1'").arg(m_iface->interfaceName()));
QList::iterator it = list.begin();
-
+
if (it != list.end()) {
Solid::Device device = *it;
Solid::DeviceInterface *interface = it->asDeviceInterface(Solid::DeviceInterface::NetworkInterface);
-
+
if (interface) {
const QMetaObject *meta = interface->metaObject();
-
+
for (int i = meta->propertyOffset(); ipropertyCount(); i++) {
QMetaProperty property = meta->property(i);
-
+
if (QString(meta->className()).mid(7) + '.' + property.name() == QString::fromLatin1("NetworkInterface.hwAddress")) {
QVariant value = property.read(interface);
return value.toString();
@@ -792,8 +873,10 @@ void InterfaceDetailsWidget::disconnectSignals()
void InterfaceDetailsWidget::updateIpAddress()
{
- details->ipAddress = currentIpAddress();
- details->ipGateway = currentIpGateway();
+ details->ip4Address = currentIp4Address();
+ details->ip4Gateway = currentIp4Gateway();
+ details->ip6Address = currentIp6Address();
+ details->ip6Gateway = currentIp6Gateway();
showDetails();
}
diff --git a/applet/interfacedetailswidget.h b/applet/interfacedetailswidget.h
index dddc6f1..b9695bf 100644
--- a/applet/interfacedetailswidget.h
+++ b/applet/interfacedetailswidget.h
@@ -64,8 +64,10 @@ Q_OBJECT
Plasma::DataEngine* engine();
void updateWidgets();
int bitRate();
- QString currentIpAddress();
- QString currentIpGateway();
+ QString currentIp4Address();
+ QString currentIp4Gateway();
+ QString currentIp6Address();
+ QString currentIp6Gateway();
QString getMAC();
QString connectionStateToString(Solid::Control::NetworkInterfaceNm09::ConnectionState state, const QString &connectionName = QString());
void getDetails();
diff --git a/backends/NetworkManager/CMakeLists.txt b/backends/NetworkManager/CMakeLists.txt
index 70a0edc..37144b5 100644
--- a/backends/NetworkManager/CMakeLists.txt
+++ b/backends/NetworkManager/CMakeLists.txt
@@ -69,6 +69,8 @@ set(knm_nm_LIB_SRCS
nm-manager-interface.cpp
nm-device-interface.cpp
nm-ip4-config-interface.cpp
+ nm-ip6-config-interface.cpp
+
../../libs/service/events.cpp
)
diff --git a/backends/NetworkManager/nm-ip6-config-interface.cpp b/backends/NetworkManager/nm-ip6-config-interface.cpp
new file mode 100644
index 0000000..9442acb
--- /dev/null
+++ b/backends/NetworkManager/nm-ip6-config-interface.cpp
@@ -0,0 +1,29 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -N -m -i generic-types.h -p nm-ip6-configinterface /home/jgrulich/projects/libnm-qt/dbus/introspection/nm-ip6-config.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * This file may have been hand-edited. Look for HAND-EDIT comments
+ * before re-generating it.
+ */
+
+#include "nm-ip6-config-interface.h"
+
+/*
+ * Implementation of interface class OrgFreedesktopNetworkManagerIP6ConfigInterface
+ */
+
+OrgFreedesktopNetworkManagerIP6ConfigInterface::OrgFreedesktopNetworkManagerIP6ConfigInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
+ : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
+{
+ qDBusRegisterMetaType();
+ qDBusRegisterMetaType< QList >();
+}
+
+OrgFreedesktopNetworkManagerIP6ConfigInterface::~OrgFreedesktopNetworkManagerIP6ConfigInterface()
+{
+}
+
+#include "nm-ip6-config-interface.moc"
diff --git a/backends/NetworkManager/nm-ip6-config-interface.h b/backends/NetworkManager/nm-ip6-config-interface.h
new file mode 100644
index 0000000..4b4a8a8
--- /dev/null
+++ b/backends/NetworkManager/nm-ip6-config-interface.h
@@ -0,0 +1,62 @@
+/*
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -N -m -i generic-types.h -p nm-ip6-configinterface /home/jgrulich/projects/libnm-qt/dbus/introspection/nm-ip6-config.xml
+ *
+ * qdbusxml2cpp is Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+ *
+ * This is an auto-generated file.
+ * Do not edit! All changes made to it will be lost.
+ */
+
+#ifndef NM_IP6_CONFIG_INTERFACE_H
+#define NM_IP6_CONFIG_INTERFACE_H
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "settings/ipv6dbus.h"
+
+// Need ito export the class to use it externally (in the applet)
+#include "knm_export.h"
+
+/*
+ * Proxy class for interface org.freedesktop.NetworkManager.IP6Config
+ */
+class KNM_EXPORT OrgFreedesktopNetworkManagerIP6ConfigInterface: public QDBusAbstractInterface
+{
+ Q_OBJECT
+public:
+ static inline const char *staticInterfaceName()
+ { return "org.freedesktop.NetworkManager.IP6Config"; }
+
+public:
+ OrgFreedesktopNetworkManagerIP6ConfigInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
+
+ ~OrgFreedesktopNetworkManagerIP6ConfigInterface();
+
+ Q_PROPERTY(QList Addresses READ addresses)
+ inline QList addresses() const
+ { return qvariant_cast< QList >(property("Addresses")); }
+
+ Q_PROPERTY(QStringList Domains READ domains)
+ inline QStringList domains() const
+ { return qvariant_cast< QStringList >(property("Domains")); }
+
+ Q_PROPERTY(QList Nameservers READ nameservers)
+ inline QList nameservers() const
+ { return qvariant_cast< QList >(property("Nameservers")); }
+
+ Q_PROPERTY(QList Routes READ routes)
+ inline QList routes() const
+ { return qvariant_cast< QList >(property("Routes")); }
+
+public Q_SLOTS: // METHODS
+Q_SIGNALS: // SIGNALS
+};
+
+#endif
diff --git a/backends/NetworkManager/settings/ipv6dbus.h b/backends/NetworkManager/settings/ipv6dbus.h
index 6994cdd..6069133 100644
--- a/backends/NetworkManager/settings/ipv6dbus.h
+++ b/backends/NetworkManager/settings/ipv6dbus.h
@@ -14,7 +14,7 @@
#include "nm09dbus_export.h"
#include "settings/ipv6.h"
-#include "networkipv6config.h"
+#include "../solidcontrolfuture/networkipv6config.h"
typedef struct
{
diff --git a/libs/internals/settings/ipv6.h b/libs/internals/settings/ipv6.h
index b0e0cd6..8bf9af5 100644
--- a/libs/internals/settings/ipv6.h
+++ b/libs/internals/settings/ipv6.h
@@ -7,7 +7,7 @@
#include
#include
#include
-#include "networkipv6config.h"
+#include "../solidcontrolfuture/networkipv6config.h"
#include "setting.h"
#include "knminternals_export.h"
diff --git a/solidcontrolfuture/networkipv6config.h b/solidcontrolfuture/networkipv6config.h
index 3fe68a6..f1ae83d 100644
--- a/solidcontrolfuture/networkipv6config.h
+++ b/solidcontrolfuture/networkipv6config.h
@@ -25,7 +25,7 @@ along with this program. If not, see .
#include
#include
-#include
+#include "solid_control_export.h"
namespace Solid
{
diff --git a/solidcontrolfuture/solid/networkmanager-0.9/networkinterface.cpp b/solidcontrolfuture/solid/networkmanager-0.9/networkinterface.cpp
index 2a69e96..45340dd 100644
--- a/solidcontrolfuture/solid/networkmanager-0.9/networkinterface.cpp
+++ b/solidcontrolfuture/solid/networkmanager-0.9/networkinterface.cpp
@@ -6,7 +6,7 @@ modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
-by the membership of KDE e.V.), which shall act as a proxy
+by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
This program is distributed in the hope that it will be useful,
@@ -35,7 +35,7 @@ NMNetworkInterfacePrivate::NMNetworkInterfacePrivate( const QString & path, QObj
//isLinkUp = deviceIface.isLinkUp();
driver = deviceIface.driver();
interfaceName = deviceIface.interface();
- ipV4Address = deviceIface.ip4Address();
+ ipV4Address = deviceIface.ip4Address();
managed = deviceIface.managed();
udi = deviceIface.udi();
firmwareMissing = deviceIface.firmwareMissing();