[haiku-bugs] Re: [Haiku] #9666: NetworkStatus: indicate if network is protected

  • From: "axeld" <trac@xxxxxxxxxxxx>
  • Date: Fri, 08 Nov 2013 21:14:38 -0000

#9666: NetworkStatus: indicate if network is protected
------------------------------------------+----------------------------
   Reporter:  dsjonny                     |      Owner:  axeld
       Type:  enhancement                 |     Status:  new
   Priority:  normal                      |  Milestone:  R1
  Component:  Applications/NetworkStatus  |    Version:  R1/Development
 Resolution:                              |   Keywords:
 Blocked By:                              |   Blocking:
Has a Patch:  1                           |   Platform:  All
------------------------------------------+----------------------------

Comment (by axeld):

 Thanks! The patch is not bad, but there are a few issues:
 * You leak the BString. Generally, you should put things on the stack when
 you can.
 * 'bName' is not a good name. 'label' would have been better.
 * The way you build the string is not really localize friendly. You should
 do it like this:
 {{{
 BString label=B_TRANSLATE("%name% (%authenticationMode%)");
 label.Replace("%name%", name);
 label.Replace("%authenticationMode%",
 AuthenticationName(authenticationMode));
 }}}
 where the AuthenticationName() method would looke like:
 {{{
 switch (authenticationMode) {
     case B_NETWORK_AUTHENTICATION_NONE:
         return B_TRANSLATE_CONTEXT("open", "Open network");
     ...
 }}}

 }}}

--
Ticket URL: <http://dev.haiku-os.org/ticket/9666#comment:3>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: