+void PlacesItem::onAccessibilityChanged()
+{
+ setIconOverlays(m_device.emblems());
+ setUrl(QUrl::fromLocalFile(m_access->filePath()));
+}
+
+void PlacesItem::onTrashDirListerCompleted()
+{
+ Q_ASSERT(url().scheme() == QLatin1String("trash"));
+
+ const bool isTrashEmpty = m_trashDirLister->items().isEmpty();
+ setIcon(isTrashEmpty ? QStringLiteral("user-trash") : QStringLiteral("user-trash-full"));
+}
+
+void PlacesItem::updateBookmarkForRole(const QByteArray& role)
+{
+ Q_ASSERT(!m_bookmark.isNull());
+ if (role == "iconName") {
+ m_bookmark.setIcon(icon());
+ } else if (role == "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") {
+ m_bookmark.setMetaDataItem(QStringLiteral("UDI"), udi());
+ } else if (role == "isSystemItem") {
+ m_bookmark.setMetaDataItem(QStringLiteral("isSystemItem"), isSystemItem() ? QStringLiteral("true") : QStringLiteral("false"));
+ } else if (role == "isHidden") {
+ m_bookmark.setMetaDataItem(QStringLiteral("IsHidden"), isHidden() ? QStringLiteral("true") : QStringLiteral("false"));
+ }
+}
+
+QString PlacesItem::generateNewId()
+{
+ // The ID-generation must be different as done in KFilePlacesItem from kdelibs
+ // to prevent identical IDs, because 'count' is of course not shared. We append a
+ // " (V2)" to indicate that the ID has been generated by
+ // a new version of the places view.
+ static int count = 0;
+ return QString::number(QDateTime::currentDateTimeUtc().toTime_t()) +
+ '/' + QString::number(count++) + " (V2)";
+}
+
+PlacesItemSignalHandler *PlacesItem::signalHandler() const
+{
+ return m_signalHandler.data();
+}