From kde-commits Sun Jun 17 21:04:18 2012 From: Peter Penz Date: Sun, 17 Jun 2012 21:04:18 +0000 To: kde-commits Subject: [kde-baseapps] dolphin/src/panels/places: Allow to customize text for system-bookmarks Message-Id: <20120617210418.71FF1A60A9 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=133996727922401 Git commit b2877c10babce8c21eed14d4cada7cbddeb05b16 by Peter Penz. Committed on 16/06/2012 at 22:31. Pushed by ppenz into branch 'master'. Allow to customize text for system-bookmarks BUG: 301339 FIXED-IN: 4.9.0 M +22 -16 dolphin/src/panels/places/placesitemmodel.cpp http://commits.kde.org/kde-baseapps/b2877c10babce8c21eed14d4cada7cbddeb05b16 diff --git a/dolphin/src/panels/places/placesitemmodel.cpp b/dolphin/src/pa= nels/places/placesitemmodel.cpp index 5d89dfa..00ab967 100644 --- a/dolphin/src/panels/places/placesitemmodel.cpp +++ b/dolphin/src/panels/places/placesitemmodel.cpp @@ -738,10 +738,12 @@ void PlacesItemModel::loadBookmarks() if (missingSystemBookmarks.contains(url)) { missingSystemBookmarks.remove(url); = - // Apply the translated text to the system bookmarks, = otherwise an outdated - // translation might be shown. - const int index =3D m_systemBookmarksIndexes.value(url= ); - item->setText(m_systemBookmarks[index].text); + // Try to retranslate the text of system bookmarks to = have translated + // items when changing the language. In case if the us= er has applied a custom + // text, the retranslation will fail and the users cus= tom text is still used. + // It is important to use "KFile System Bookmarks" as = context (see + // createSystemBookmarks()). + item->setText(i18nc("KFile System Bookmarks", bookmark= .text().toUtf8().data())); item->setSystemItem(true); } = @@ -881,44 +883,48 @@ void PlacesItemModel::createSystemBookmarks() const QString timeLineIcon =3D "package_utility_time"; // TODO: Ask th= e Oxygen team to create // a custom icon = for the timeline-protocol = + // Note: The context of the I18N_NOOP2 must be "KFile System Bookmarks= ". The real + // i18nc call is done after reading the bookmark. The reason why the i= 18nc call is not + // done here is because otherwise switching the language would not res= ult in retranslating the + // bookmarks. m_systemBookmarks.append(SystemBookmarkData(KUrl(KUser().homeDir()), "user-home", - i18nc("@item", "Home"))); + I18N_NOOP2("KFile System B= ookmarks", "Home"))); m_systemBookmarks.append(SystemBookmarkData(KUrl("remote:/"), "network-workgroup", - i18nc("@item", "Network"))= ); + I18N_NOOP2("KFile System B= ookmarks", "Network"))); m_systemBookmarks.append(SystemBookmarkData(KUrl("/"), "folder-red", - i18nc("@item", "Root"))); + I18N_NOOP2("KFile System B= ookmarks", "Root"))); m_systemBookmarks.append(SystemBookmarkData(KUrl("trash:/"), "user-trash", - i18nc("@item", "Trash"))); + I18N_NOOP2("KFile System B= ookmarks", "Trash"))); = if (m_fileIndexingEnabled) { m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/today"= ), timeLineIcon, - i18nc("@item Recently = Accessed", "Today"))); + I18N_NOOP2("KFile Syst= em Bookmarks", "Today"))); m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/yester= day"), timeLineIcon, - i18nc("@item Recently = Accessed", "Yesterday"))); + I18N_NOOP2("KFile Syst= em Bookmarks", "Yesterday"))); m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/thismo= nth"), timeLineIcon, - i18nc("@item Recently = Accessed", "This Month"))); + I18N_NOOP2("KFile Syst= em Bookmarks", "This Month"))); m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/lastmo= nth"), timeLineIcon, - i18nc("@item Recently = Accessed", "Last Month"))); + I18N_NOOP2("KFile Syst= em Bookmarks", "Last Month"))); m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/document= s"), "folder-txt", - i18nc("@item Commonly = Accessed", "Documents"))); + I18N_NOOP2("KFile Syst= em Bookmarks", "Documents"))); m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/images"), "folder-image", - i18nc("@item Commonly = Accessed", "Images"))); + I18N_NOOP2("KFile Syst= em Bookmarks", "Images"))); m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/audio"), "folder-sound", - i18nc("@item Commonly = Accessed", "Audio Files"))); + I18N_NOOP2("KFile Syst= em Bookmarks", "Audio Files"))); m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/videos"), "folder-video", - i18nc("@item Commonly = Accessed", "Videos"))); + I18N_NOOP2("KFile Syst= em Bookmarks", "Videos"))); } = for (int i =3D 0; i < m_systemBookmarks.count(); ++i) {