diff options
| author | Frank Reininghaus <[email protected]> | 2013-11-15 09:16:22 +0100 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2013-11-15 09:20:10 +0100 |
| commit | ac8722dc7d1a6b2f7669b270d65c3ed834582d7e (patch) | |
| tree | da31bc83023e2e423fd7b775722a4855eba51611 /src | |
| parent | 980846ab36eef12c152aa913267145b8bab2f326 (diff) | |
Update the Places Panel entries when switching the language
Before this commit, we stored the translated "Places" in
.kde4/share/apps/kfileplaces/bookmarks.xml. This was not intentional -
it only happened because
PlacesItem::updateBookmarkForRole(const QByteArray& role) always stored
the translated text (returned by PlacesItem::text()) in the KBookmark.
This is 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.
Thanks to Burkhard Lück and Albert Astals Cid for helping to fix this
problem!
BUG: 319282
FIXED-IN: 4.12.0
REVIEW: 113850
Diffstat (limited to 'src')
| -rw-r--r-- | src/panels/places/placesitem.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp index 76b51e3aa..41f22cce4 100644 --- a/src/panels/places/placesitem.cpp +++ b/src/panels/places/placesitem.cpp @@ -120,6 +120,10 @@ Solid::Device PlacesItem::device() const void PlacesItem::setBookmark(const KBookmark& bookmark) { + if (bookmark == m_bookmark) { + return; + } + m_bookmark = bookmark; delete m_access; @@ -302,7 +306,15 @@ void PlacesItem::updateBookmarkForRole(const QByteArray& role) if (role == "iconName") { m_bookmark.setIcon(icon()); } else if (role == "text") { - m_bookmark.setFullText(text()); + // Only store the text in the KBookmark if it is not the translation of + // the current text. This makes sure that the text is re-translated if + // the user chooses another language, or the translation itself changes. + // + // NOTE: It is important to use "KFile System Bookmarks" as context + // (see PlacesItemModel::createSystemBookmarks()). + if (text() != i18nc("KFile System Bookmarks", m_bookmark.text().toUtf8().data())) { + m_bookmark.setFullText(text()); + } } else if (role == "url") { m_bookmark.setUrl(url()); } else if (role == "udi)") { |
