Review Request: enable additional addresses even on DHCP

Ilia Kats ilia-kats at gmx.net
Thu Apr 21 01:35:03 CEST 2011



> On April 20, 2011, 11:16 p.m., Commit Hook wrote:
> > This review has been submitted with commit ab05f9a030eab2f19af25ea7a535c56d14ce66e6 by Lamarque V. Souza.

Can't figure out how to update the diff, it keeps saying "revision xxx not found". Anyway, improved handling of switch from manual to DHCP: instead of just being greyed out, the address is pushed to additional addresses, the fields in the main ip widget are then cleared:

diff --git a/libs/ui/ipv4widget.cpp b/libs/ui/ipv4widget.cpp
index 1509084..2af67c4 100644
--- a/libs/ui/ipv4widget.cpp
+++ b/libs/ui/ipv4widget.cpp
@@ -311,10 +311,31 @@ void IpV4Widget::methodChanged(int currentIndex)
         advancedSettingsPartEnabled = false;
     }

-    if (!addressPartEnabled && !advancedSettingsPartEnabled) {
+    if (!addressPartEnabled && advancedSettingsPartEnabled)
+    {
+        QList<Solid::Control::IPv4Address> addresses = d->ui.advancedSettings->additionalAddresses();
+        QNetworkAddressEntry entry;
+        // we need to set up IP before prefix/netmask manipulation
+        entry.setIp(QHostAddress(d->ui.address->text()));
+        entry.setNetmask(QHostAddress(d->ui.netMask->text()));
+
+        QHostAddress gateway(d->ui.gateway->text());
+        if (entry.ip() != QHostAddress::Null)
+        {
+            Solid::Control::IPv4Address addr(entry.ip().toIPv4Address(),
+                                            entry.prefixLength(), gateway.toIPv4Address());
+            addresses.prepend(addr);
+        }
+        d->ui.advancedSettings->setAdditionalAddresses(addresses);
+    }
+    if (!addressPartEnabled)
+    {
         d->ui.address->clear();
         d->ui.netMask->clear();
         d->ui.gateway->clear();
+    }
+    if (!advancedSettingsPartEnabled)
+    {
         d->ui.advancedSettings->setAdditionalAddresses(QList<Solid::Control::IPv4Address>());
     }


- Ilia


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/101165/#review2782
-----------------------------------------------------------


On April 20, 2011, 10:44 p.m., Ilia Kats wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/101165/
> -----------------------------------------------------------
> 
> (Updated April 20, 2011, 10:44 p.m.)
> 
> 
> Review request for Network Management.
> 
> 
> Summary
> -------
> 
> This is supported by NetworkManager, so let's add it to KDE. This patch also cleans up libs/ui/802_11_wirelesswidget.cpp (use enums instead of hardcoded values)
> 
> 
> This addresses bug 249016.
>     http://bugs.kde.org/show_bug.cgi?id=249016
> 
> 
> Diffs
> -----
> 
>   libs/ui/802_11_wirelesswidget.cpp cb103d2 
>   libs/ui/ipv4widget.cpp 732a94e 
> 
> Diff: http://git.reviewboard.kde.org/r/101165/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Ilia
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-networkmanager/attachments/20110420/0c2e6a9f/attachment.html 


More information about the kde-networkmanager mailing list