andrew-bibb/cmst — pull request #65 by afontenot (2014-11-28 10:44:05+00:00)
Title: Fix api breakage and improve connman api translation method

The current methodology for translating status strings and other strings from the Connman api is as follows:
Pull property from dbus --> translate property in local variable --> run string comparisons in internal code to determine status -> display properties in GUI

I think this is a bad (and possibly dangerous) way to approach it. If we slip up anywhere we end up comparing a bunch of correct names coming from the Connman api to a bunch of mistranslated names internally, resulting in breakage.

Case in point: the .ts for english translates "online" to "Online". Capitalizing it is correct for the GUI, but internally we were checking "Online" == "online" whenever we ran ```assembleTrayIcon()``` when reconnecting after a disconnect. This happened because ```properties_map.insert(name, value)``` in ```dbsPropertyChanged``` took the status (from the Connman api) and put it directly into the QMap without translating it first.

We could try making sure that we always compare the right values and hope the translation files are all always right, or we could just use the correct api strings internally and then translate when we send to the GUI. I think the latter is better and much less error prone. This pull request implements this change, and fixes [#64](https://github.com/andrew-bibb/cmst/issues/64) as a side effect. It also fixes the symptoms of [#59](https://github.com/andrew-bibb/cmst/issues/59) for me, although I have only tested this in combination with my other pull request, [#63](https://github.com/andrew-bibb/cmst/pull/63).

I think eventually we'll probably end up wanting all the API strings defined in a ```connman-api.h``` file, or perhaps in a namespace? I might take that to work on if you like the idea, but it might be a while before I have time to come back to it.