Hi,

        After applying those two patches (one for Solid and one for Plasma NM) 
the disconnect works as expected, at least in my tests. The Solid patch 
changes the API, it will have to wait until KDE SC 4.7, which is going to be 
released in the middle of this year.

        Can you add your patch and my two patches to 
http://git.reviewboard.kde.org? This way anybody can improve it until we apply 
it to KDE's trunk. If you do not have a reviewboard account I can add them for 
you.

Em Thursday 13 January 2011, Gökçen Eraslan escreveu:
> Hello,
> 
> Yesterday, I have spent all my day to fix disconnect issue of KNM. The
> issue is, when you disconnect using plasmoid, something automatically
> reconnects interface. In current Solid::Control::NetworkManager we have a
> DeactivateConnection method[1], and this method is used in KNM. But this
> method just deactivate the connection and then NM tries to reconnect to
> another connection which is set as autoconnect.
> 
> The bug here is using DeactivateConnection method of NM[2], here is another
> guy mentioning about the same problem[3]. Solution is to call Disconnect
> method of the according interface instead[4], which is added in NM 0.8.
> Unfortunately this method does not exist in current Solid.
> 
> Attached patch (created against KDe 4.5.5) tries to implement this method
> in Solid by updating solid/networkmanager-0.7/dbus/nm-deviceinterface.h
> file which is autogenerated using qdbusxml2cpp and adding method to:
> 
> * libs/solid/control/ifaces/networkinterface.*
> * libs/solid/control/backends/fakenet/fakenetworkinterface.*
> * solid/networkmanager-0.7/networkinterface.*
> * solid/wicd/networkinterface.*
> 
> However when I try to call it using:
> 
> Solid::Control::NetworkInterface* iface =
> Solid::Control::NetworkManager::findNetworkInterface(deviceUni);
> 
> if (iface)
>   iface->disconnect();
> 
> 
> the method is not called. I put debug lines to every method I've
> implemented, but nothing is printed and connection is not disconnected.
> 
> Any ideas about that? I'm not familiar with solid, the patch may have
> mistakes.
> 
> Cheers.
> 
> [1] http://api.kde.org/4.5-api/kdebase-workspace-
> apidocs/libs/solid/html/namespaceSolid_1_1Control_1_1NetworkManager.html#db
> d96918b07abc71b8618b96aad9814d
> 
> [2]
> http://projects.gnome.org/NetworkManager/developers/spec-08.html#org.freede
> sktop.NetworkManager
> 
> [3] http://osdir.com/ml/networkmanager-list/2011-01/msg00007.html
> 
> [4]
> http://projects.gnome.org/NetworkManager/developers/spec-08.html#org.freede
> sktop.NetworkManager.Device


-- 
Lamarque V. Souza
http://www.geographicguide.com/brazil.htm
Linux User #57137 - http://counter.li.org/
http://www.kde-mg.org
diff -Nru --show-c-function solid-4.5.4-teste_orig/work/solid-4.5.4/libs/solid/control/networkinterface.cpp solid-4.5.4/work/solid-4.5.4/libs/solid/control/networkinterface.cpp
--- solid-4.5.4-teste_orig/work/solid-4.5.4/libs/solid/control/networkinterface.cpp	2011-01-05 13:17:04.428982875 -0200
+++ solid-4.5.4/work/solid-4.5.4/libs/solid/control/networkinterface.cpp	2011-01-18 19:56:38.616067907 -0200
@@ -83,6 +83,12 @@ QString Solid::Control::NetworkInterface
     return_SOLID_CALL(Ifaces::NetworkInterface *, d->backendObject(), QString(), driver());
 }
 
+void Solid::Control::NetworkInterface::disconnect() const
+{
+    Q_D(const NetworkInterface);
+    SOLID_CALL(Ifaces::NetworkInterface *, d->backendObject(), disconnect());
+}
+
 Solid::Control::IPv4Config Solid::Control::NetworkInterface::ipV4Config() const
 {
     Q_D(const NetworkInterface);
diff -Nru --show-c-function solid-4.5.4-teste_orig/work/solid-4.5.4/libs/solid/control/networkinterface.h solid-4.5.4/work/solid-4.5.4/libs/solid/control/networkinterface.h
--- solid-4.5.4-teste_orig/work/solid-4.5.4/libs/solid/control/networkinterface.h	2011-01-05 13:17:04.638982875 -0200
+++ solid-4.5.4/work/solid-4.5.4/libs/solid/control/networkinterface.h	2011-01-18 19:56:02.139401241 -0200
@@ -147,6 +147,8 @@ namespace Control
          */
         QString driver() const;
 
+        void disconnect() const;
+
         Solid::Control::IPv4Config ipV4Config() const;
         /**
          * Retrieves the activation status of this network interface.
diff -Nru --show-c-function knetworkmanager-9999-orig/work/knetworkmanager-9999/backends/NetworkManager/nmdbussettingsservice.cpp knetworkmanager-9999/work/knetworkmanager-9999/backends/NetworkManager/nmdbussettingsservice.cpp
--- knetworkmanager-9999-orig/work/knetworkmanager-9999/backends/NetworkManager/nmdbussettingsservice.cpp	2011-01-16 01:48:45.697984368 -0200
+++ knetworkmanager-9999/work/knetworkmanager-9999/backends/NetworkManager/nmdbussettingsservice.cpp	2011-01-18 20:06:26.669174573 -0200
@@ -234,7 +234,13 @@ void NMDBusSettingsService::interfaceCon
 void NMDBusSettingsService::interfaceConnectionDeactivated()
 {
     Knm::InterfaceConnection * ic = qobject_cast<Knm::InterfaceConnection*>(sender());
-    Solid::Control::NetworkManager::deactivateConnection(ic->property("NMDBusActiveConnectionObject").toString());
+    /*Solid::Control::NetworkManager::deactivateConnection(ic->property("NMDBusActiveConnectionObject").toString());*/
+
+    /* Lamarque */
+    Solid::Control::NetworkInterface *iface = Solid::Control::NetworkManager::findNetworkInterface(ic->deviceUni());
+    if (iface) {
+    	iface->disconnect();
+    }
 }
 
 void NMDBusSettingsService::handleUpdate(Knm::Activatable *)
_______________________________________________
Kde-hardware-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-hardware-devel

Reply via email to