Gökçen Eraslan
2010-11-19 16:40:10 UTC
Hello,
I've found another bug in KNM and prepared a patch for that. Problem is: I can
see wired system-wide connections in plasma applet but I can't see wireless
system-wide connections.
Steps to reproduce:
1- Add a system-wide wireless connection (using nm-applet unfortunately)
2- Try to connect it from KNM plasma applet.
Reason is that:
* kded module gets a system-wide wireless connection and calls
NMDBusSettingsConnectionProvider::initialiseAndRegisterRemoteConnection
method, in this method an empty Connection is created:
00096 Knm::Connection * connection = new Knm::Connection(QUuid(),
Knm::Connection::Wired);
At this point, connection type is wired but the setting gathered from NM DBus
interface is for a wireless connection. After that, empty connection gets
filled with ConnectionDbus class:
00097 ConnectionDbus dbusConverter(connection);
00098 dbusConverter.fromDbusMap(connectionIface->GetSettings());
and in fromDbusMap method:
00227 m_connection->setType(type);
is called. type of connection is changed using setType method, but Settings
objects of the connection are still for a wired connection because Connection
is initialized with Knm::Connection::Wired parameter. After that,
ConnectionDbus class tries change the settings :
00228
00229 // all other settings
00230 foreach (Setting * setting, m_connection->settings()) {
00231 if (settings.contains(setting->name())) {
00232 SettingDbus * sd = dbusFor(setting);
00233 sd->fromMap(settings.value(setting->name()));
00234 }
00235 }
but since the settings are all in wired type, this does not work and
connection has the wired settings. And in:
WirelessNetworkInterfaceActivatableProvider::handleAdd method:
00093 Knm::WirelessSetting * wirelessSetting =
dynamic_cast<Knm::WirelessSetting *>(addedConnection-
00095 if (wirelessSetting) {
it's checked whether the connection has a setting named 802-11-wireless, but
it doesn't since settings are still in wired type.
setType method of Connection class is wrong and must be changed since it just
changes the type and does not change Settings objects created in init method.
Here is the attached patch to regenerate Settings objects of connection when
setType is called with a second parameter regenerateSettings. An alternative
solution would be making ConnectionDbus and Connection classes friends, so
ConnectionDbus::fromDbusMap method can create new Settings objects itself.
Cheers.
I've found another bug in KNM and prepared a patch for that. Problem is: I can
see wired system-wide connections in plasma applet but I can't see wireless
system-wide connections.
Steps to reproduce:
1- Add a system-wide wireless connection (using nm-applet unfortunately)
2- Try to connect it from KNM plasma applet.
Reason is that:
* kded module gets a system-wide wireless connection and calls
NMDBusSettingsConnectionProvider::initialiseAndRegisterRemoteConnection
method, in this method an empty Connection is created:
00096 Knm::Connection * connection = new Knm::Connection(QUuid(),
Knm::Connection::Wired);
At this point, connection type is wired but the setting gathered from NM DBus
interface is for a wireless connection. After that, empty connection gets
filled with ConnectionDbus class:
00097 ConnectionDbus dbusConverter(connection);
00098 dbusConverter.fromDbusMap(connectionIface->GetSettings());
and in fromDbusMap method:
00227 m_connection->setType(type);
is called. type of connection is changed using setType method, but Settings
objects of the connection are still for a wired connection because Connection
is initialized with Knm::Connection::Wired parameter. After that,
ConnectionDbus class tries change the settings :
00228
00229 // all other settings
00230 foreach (Setting * setting, m_connection->settings()) {
00231 if (settings.contains(setting->name())) {
00232 SettingDbus * sd = dbusFor(setting);
00233 sd->fromMap(settings.value(setting->name()));
00234 }
00235 }
but since the settings are all in wired type, this does not work and
connection has the wired settings. And in:
WirelessNetworkInterfaceActivatableProvider::handleAdd method:
00093 Knm::WirelessSetting * wirelessSetting =
dynamic_cast<Knm::WirelessSetting *>(addedConnection-
setting(Knm::Setting::Wireless));
0009400095 if (wirelessSetting) {
it's checked whether the connection has a setting named 802-11-wireless, but
it doesn't since settings are still in wired type.
setType method of Connection class is wrong and must be changed since it just
changes the type and does not change Settings objects created in init method.
Here is the attached patch to regenerate Settings objects of connection when
setType is called with a second parameter regenerateSettings. An alternative
solution would be making ConnectionDbus and Connection classes friends, so
ConnectionDbus::fromDbusMap method can create new Settings objects itself.
Cheers.
--
G?k?en Eraslan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-system-wide-wireless-networks.diff
Type: text/x-patch
Size: 2189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-networkmanager/attachments/20101119/fea89622/attachment.diff
G?k?en Eraslan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-system-wide-wireless-networks.diff
Type: text/x-patch
Size: 2189 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-networkmanager/attachments/20101119/fea89622/attachment.diff