Update the Places Panel entries when switching the language
Review Request #113850 - Created Nov. 14, 2013 and submitted
Currently, we store the translated "Places" in .kde4/share/apps/kfileplaces/bookmarks.xml. This is not intentional - it only happens because PlacesItem::updateBookmarkForRole(const QByteArray& role) always stores the translated text (returned by PlacesItem::text()) in the KBookmark. This can be fixed by first checking if the text() is equal to the translation of the text that is already stored in the KBookmark, and not updating it in that case. Note that we have to make sure that all "Places"-related use the same context "KFile System Bookmarks" to make that work. The first version of the patch (see https://bugs.kde.org/show_bug.cgi?id=319282#c11) had a small problem: the "Places" texts would be reset to the en_US values on first use after less than a second. This was caused by PlacesItem::setBookmark(const KBookmark& bookmark), which reset the PlacesItem's values to the ones from the untranslated bookmark, even if the bookmark had not changed at all. This is fixed by the new check in that function.
Fixes the bug for me - now it always shows the correct translation for me even after switching the language, at least if I delete the file .kde4/share/apps/kfileplaces/bookmarks.xml initially (it still had the translated value from the buggy old version written to it).