Bug 207445 - JJ: toggle option to show either device description or interface name in UI
Summary: JJ: toggle option to show either device description or interface name in UI
Status: RESOLVED FIXED
Alias: None
Product: knetworkmanager
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Rahman Duran
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2009-09-15 12:06 UTC by Will Stephenson
Modified: 2009-10-03 15:13 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch (11.95 KB, patch)
2009-09-28 10:51 UTC, Rahman Duran
Details
patch (12.47 KB, patch)
2009-09-30 18:10 UTC, Rahman Duran
Details
Updated (12.41 KB, patch)
2009-10-01 09:29 UTC, Rahman Duran
Details
Just modified a bit. This should be the final, if nothing is wrong (12.40 KB, patch)
2009-10-01 11:07 UTC, Rahman Duran
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Will Stephenson 2009-09-15 12:06:26 UTC
Version:            (using Devel)
Installed from:    Compiled sources

Some users prefer descriptive names eg 'Wireless Interface', others prefer technical names eg 'eth0, wlan0'.  This junior-job is about making it possible to choose.   

The different styles are illustrated in the UnconfiguredInterfaceItem constructor in monolithic/unconfiguredinterfaceitem.cpp

For this job you would have to 

1) extend KNetworkManagerServicePrefs (via libs/internals/knmserviceprefs.kcfg) to store this preference

2) provide a checkbox somewhere in settings/config/traysettings.ui and settings/config/managetraywidget.cpp to control this setting

3) use this setting throughout monolithic and libs/ui to show either the Solid::Device description or interface name.  At some points in the code I have already provided an if clause to do this, see UnconfiguredInterfaceItem as above.  You can probably find all the places to change by grepping for Solid::Device.
Comment 1 Rahman Duran 2009-09-28 10:51:27 UTC
Created attachment 37211 [details]
Patch
Comment 2 Rahman Duran 2009-09-28 10:52:52 UTC
Here is a patch. Fell free to advice any change.
Comment 3 Will Stephenson 2009-09-30 14:23:18 UTC
The only changes I would advise are 

1) Change Technical Names throughout to 'Interface Name'.  Possibly the best solution would be to change the bool kconfigxt type to an enum and use a combobox with 2 entries' 'System Interface Names' and 'Descriptive Names'.

2) The patch adds ipv4 to gsm which is something else.
Comment 4 Rahman Duran 2009-09-30 18:10:00 UTC
Created attachment 37265 [details]
patch

Modified it as suggested. I will commit if its ok.
Comment 5 Will Stephenson 2009-09-30 20:45:31 UTC
1) In networkmanager.cpp and wiredwidget.cpp the indentation is not right - it's 4 spaces per indent

+                    deviceText = iface->interfaceName();

2) and there is no need to #define DESCRIPTIVE, because in the KConfigXT-generated knmservicepref.h (look in libs/internals in the _build_ tree) there is a public enum:

enum InterfaceNamingChoices { DescriptiveNames, SystemNames };
 
that are the values returned by 

KNetworkManagerServicePrefs::self()->interfaceNamingStyle()
Comment 6 Rahman Duran 2009-10-01 09:29:27 UTC
Created attachment 37282 [details]
Updated
Comment 7 Rahman Duran 2009-10-01 11:07:22 UTC
Created attachment 37284 [details]
Just modified a bit. This should be the final, if nothing is wrong
Comment 8 Will Stephenson 2009-10-02 11:54:09 UTC
It's good, commit it!
Comment 9 Rahman Duran 2009-10-03 15:13:57 UTC
SVN commit 1030904 by rduran:

BUG: 207445

Now users can configure different interface naming styles. Like "WLAN Interface" or "wlan0"

 M  +13 -2     applet/interfaceitem.cpp  
 M  +13 -2     applet/networkmanager.cpp  
 M  +6 -0      libs/internals/knmserviceprefs.kcfg  
 M  +13 -2     libs/service/notificationmanager.cpp  
 M  +15 -2     libs/ui/802_11_wirelesswidget.cpp  
 M  +13 -2     libs/ui/wiredwidget.cpp  
 M  +16 -0     monolithic/otherwirelessnetworkdialog.cpp  
 M  +7 -3      monolithic/unconfiguredinterfaceitem.cpp  
 M  +38 -9     settings/config/traysettings.ui  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1030904