Commit 0b3ae973 authored by Francesco Bonanno's avatar Francesco Bonanno Committed by Nate Graham
Browse files

[Applet] Show more information in the Details tab

Summary:
I apologize if I annoy someone with this request, as here https://bugs.kde.org/show_bug.cgi?id=361414 I've seed it has been discussed the issue, and it was done a survey to choice the displayed info.

But, as written in comment #10 of the bug, I don't know why a mac address has more relevance for an average user than an nameserver or a gateway. And usually the average user don't see this section of the plasmoid.

So, I'm submitting to the review process this patch, with hope of being accepted.

It adds just the possibility to see, with the related present info, the current dns (first one) for IPv4 and v6 connectivity, and the current default gateway for the IPv4 connectivity.

FEATURE: 361414
FIXED-IN: 5.18.0

Reviewers: jgrulich

Reviewed By: jgrulich

Subscribers: ngraham, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D24940
parent 8b9eb873
......@@ -535,7 +535,7 @@ void NetworkModelItem::updateDetails() const
NetworkManager::Device::Ptr device = NetworkManager::findNetworkInterface(m_devicePath);
// Get IPv[46]Address
// Get IPv[46]Address and related nameservers + IPv4 default gateway
if (device && device->ipV4Config().isValid() && m_connectionState == NetworkManager::ActiveConnection::Activated) {
if (!device->ipV4Config().addresses().isEmpty()) {
QHostAddress addr = device->ipV4Config().addresses().first().ip();
......@@ -543,6 +543,18 @@ void NetworkModelItem::updateDetails() const
m_details << i18n("IPv4 Address") << addr.toString();
}
}
if (!device->ipV4Config().gateway().isEmpty()) {
QString addr = device->ipV4Config().gateway();
if (!addr.isNull()) {
m_details << i18n("IPv4 Default Gateway") << addr;
}
}
if (!device->ipV4Config().nameservers().isEmpty()) {
QHostAddress addr = device->ipV4Config().nameservers().first();
if (!addr.isNull()) {
m_details << i18n("IPv4 Nameserver") << addr.toString();
}
}
}
if (device && device->ipV6Config().isValid() && m_connectionState == NetworkManager::ActiveConnection::Activated) {
......@@ -552,6 +564,12 @@ void NetworkModelItem::updateDetails() const
m_details << i18n("IPv6 Address") << addr.toString();
}
}
if (!device->ipV6Config().nameservers().isEmpty()) {
QHostAddress addr = device->ipV6Config().nameservers().first();
if (!addr.isNull()) {
m_details << i18n("IPv6 Nameserver") << addr.toString();
}
}
}
if (m_type == NetworkManager::ConnectionSettings::Wired) {
NetworkManager::WiredDevice::Ptr wiredDevice = device.objectCast<NetworkManager::WiredDevice>();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment