Changeset View
Changeset View
Standalone View
Standalone View
src/filewidgets/kfileplacesitem.cpp
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Line(s) | 115 | case KFilePlacesModel::SearchForType: | |||
---|---|---|---|---|---|
116 | m_groupName = i18nc("@item", "Search For"); | 116 | m_groupName = i18nc("@item", "Search For"); | ||
117 | break; | 117 | break; | ||
118 | case KFilePlacesModel::DevicesType: | 118 | case KFilePlacesModel::DevicesType: | ||
119 | m_groupName = i18nc("@item", "Devices"); | 119 | m_groupName = i18nc("@item", "Devices"); | ||
120 | break; | 120 | break; | ||
121 | case KFilePlacesModel::RemovableDevicesType: | 121 | case KFilePlacesModel::RemovableDevicesType: | ||
122 | m_groupName = i18nc("@item", "Removable Devices"); | 122 | m_groupName = i18nc("@item", "Removable Devices"); | ||
123 | break; | 123 | break; | ||
124 | case KFilePlacesModel::TagsType: | ||||
125 | m_groupName = i18nc("@item", "Tags"); | ||||
126 | break; | ||||
124 | default: | 127 | default: | ||
125 | Q_UNREACHABLE(); | 128 | Q_UNREACHABLE(); | ||
126 | break; | 129 | break; | ||
127 | } | 130 | } | ||
128 | } | 131 | } | ||
129 | 132 | | |||
130 | Solid::Device KFilePlacesItem::device() const | 133 | Solid::Device KFilePlacesItem::device() const | ||
131 | { | 134 | { | ||
Show All 25 Lines | 152 | if (!isDevice()) { | |||
157 | } | 160 | } | ||
158 | 161 | | |||
159 | if (protocol == QLatin1String("bluetooth") || | 162 | if (protocol == QLatin1String("bluetooth") || | ||
160 | protocol == QLatin1String("obexftp") || | 163 | protocol == QLatin1String("obexftp") || | ||
161 | protocol == QLatin1String("kdeconnect")) { | 164 | protocol == QLatin1String("kdeconnect")) { | ||
162 | return KFilePlacesModel::DevicesType; | 165 | return KFilePlacesModel::DevicesType; | ||
163 | } | 166 | } | ||
164 | 167 | | |||
168 | if (protocol == QLatin1String("tags")) { | ||||
169 | return KFilePlacesModel::TagsType; | ||||
170 | } | ||||
171 | | ||||
165 | if (protocol == QLatin1String("remote") || | 172 | if (protocol == QLatin1String("remote") || | ||
166 | KProtocolInfo::protocolClass(protocol) != QLatin1String(":local")) { | 173 | KProtocolInfo::protocolClass(protocol) != QLatin1String(":local")) { | ||
167 | return KFilePlacesModel::RemoteType; | 174 | return KFilePlacesModel::RemoteType; | ||
168 | } else { | 175 | } else { | ||
169 | return KFilePlacesModel::PlacesType; | 176 | return KFilePlacesModel::PlacesType; | ||
170 | } | 177 | } | ||
171 | } | 178 | } | ||
172 | 179 | | |||
▲ Show 20 Lines • Show All 160 Lines • ▼ Show 20 Line(s) | 339 | if (root.isNull()) { | |||
333 | return KBookmark(); | 340 | return KBookmark(); | ||
334 | } | 341 | } | ||
335 | KBookmark bookmark = root.createNewSeparator(); | 342 | KBookmark bookmark = root.createNewSeparator(); | ||
336 | bookmark.setMetaDataItem(QStringLiteral("UDI"), udi); | 343 | bookmark.setMetaDataItem(QStringLiteral("UDI"), udi); | ||
337 | bookmark.setMetaDataItem(QStringLiteral("isSystemItem"), QStringLiteral("true")); | 344 | bookmark.setMetaDataItem(QStringLiteral("isSystemItem"), QStringLiteral("true")); | ||
338 | return bookmark; | 345 | return bookmark; | ||
339 | } | 346 | } | ||
340 | 347 | | |||
348 | KBookmark KFilePlacesItem::createTagBookmark(KBookmarkManager *manager, | ||||
349 | const QString &tag) | ||||
350 | { | ||||
351 | KBookmark bookmark = createSystemBookmark(manager, tag, tag, QUrl(QStringLiteral("tags:/") + tag), QStringLiteral("tag")); | ||||
kossebau: @nicolasfella Hi. this is passing the tag string both as translation context as well as the… | |||||
Tags are user-defined string and not supposed to be translated at all. So yeah, passing the tag as a context makes no sense here. Most likely I didn't even understand the concept of a translation context at the time of writing nicolasfella: Tags are user-defined string and not supposed to be translated at all.
So yeah, passing the… | |||||
352 | bookmark.setMetaDataItem(QStringLiteral("tag"), tag); | ||||
353 | bookmark.setMetaDataItem(QStringLiteral("isSystemItem"), QStringLiteral("true")); | ||||
354 | | ||||
355 | return bookmark; | ||||
356 | } | ||||
357 | | ||||
341 | QString KFilePlacesItem::generateNewId() | 358 | QString KFilePlacesItem::generateNewId() | ||
342 | { | 359 | { | ||
343 | static int count = 0; | 360 | static int count = 0; | ||
344 | 361 | | |||
345 | // return QString::number(count++); | 362 | // return QString::number(count++); | ||
346 | 363 | | |||
347 | return QString::number(QDateTime::currentDateTimeUtc().toTime_t()) | 364 | return QString::number(QDateTime::currentDateTimeUtc().toTime_t()) | ||
348 | + QLatin1Char('/') + QString::number(count++); | 365 | + QLatin1Char('/') + QString::number(count++); | ||
▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines |
@nicolasfella Hi. this is passing the tag string both as translation context as well as the string to translate as well. Is this on purpose? Even more as the context parameter is ignored anyway and just there to force a context for the other cases being used with I18NC_NOOP values, to make sure a context is set at all.
So where are those tag names coming from, are they expected to be translated at all?