Skip to content

Fix bug due to addition of new sky culture by saving config differently

Adding asterisms as a Sky Culture recently (see !541 (merged)) caused constellation lines to show up weird for some users. This is because the sky culture setting was saved as the index in a sorted ordering of sky culture names. So by the addition of asterisms, the indices of all sky cultures with lexicographic order after "Asterisms" would be increased by 1. Therefore the saved sky culture would then correspond to the string prior to the one it should have loaded, and the wrong Sky Culture was loaded.

This commit fixes the problem by changing what we save from the index (which is the default behavior of KConfigXT's Qt UI magic [1]) to the value of the entry in the combo box. This requires us to do so "manually" without relying on KConfigXT's kcfg_-prefix magic, i.e. by calling Options::setSkyCulture() every time the Sky Culture combo box value is changed.

The first time this new code is run, everyone's Sky Culture setting will be reset to the default, which is Western. So anyone who was erlier using a different Sky Culture will have to make a one-time change to set their favourite Sky Culture again. After that, it should persist correctly, as a string in the config file. This makes it future proof if and when we add new sky cultures.

[1] http://web.archive.org/web/20090212161515/http://techbase.kde.org/Development/Tutorials/Using_KConfig_XT

Merge request reports