┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/places/placesitem.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-05-14 22:08:32 +0200
committerPeter Penz <[email protected]>2012-05-14 22:09:09 +0200
commitd47d83c9ae484d489e3f3bb6be775e5bb002e0ab (patch)
tree7eb2463dfdfea9dc080a5cc98355a912ca981c82 /src/panels/places/placesitem.cpp
parentf74c72b9652ea4613156cc58b681c9244395cf72 (diff)
Let the places-item determine the group itself
Related improvements: When loading the bookmarks assure in any case that items having the same group are inserted as one single group.
Diffstat (limited to 'src/panels/places/placesitem.cpp')
-rw-r--r--src/panels/places/placesitem.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp
index 1fbc12a7d..436d69668 100644
--- a/src/panels/places/placesitem.cpp
+++ b/src/panels/places/placesitem.cpp
@@ -124,10 +124,18 @@ void PlacesItem::setBookmark(const KBookmark& bookmark)
setText(bookmark.description());
setUrl(bookmark.url());
setDataValue("address", bookmark.address());
- setGroup(i18nc("@item", "Places"));
} else {
initializeDevice(udi);
}
+
+ switch (groupType()) {
+ case PlacesType: setGroup(i18nc("@item", "Places")); break;
+ case RecentlyAccessedType: setGroup(i18nc("@item", "Recently Accessed")); break;
+ case SearchForType: setGroup(i18nc("@item", "Search For")); break;
+ case DevicesType: setGroup(i18nc("@item", "Devices")); break;
+ default: Q_ASSERT(false); break;
+ }
+
setHidden(bookmark.metaDataItem("IsHidden") == QLatin1String("true"));
}
@@ -136,6 +144,24 @@ KBookmark PlacesItem::bookmark() const
return m_bookmark;
}
+PlacesItem::GroupType PlacesItem::groupType() const
+{
+ if (udi().isEmpty()) {
+ const QString protocol = url().protocol();
+ if (protocol == QLatin1String("timeline")) {
+ return RecentlyAccessedType;
+ }
+
+ if (protocol == QLatin1String("search")) {
+ return SearchForType;
+ }
+
+ return PlacesType;
+ }
+
+ return DevicesType;
+}
+
KBookmark PlacesItem::createBookmark(KBookmarkManager* manager,
const QString& text,
const KUrl& url,
@@ -208,7 +234,6 @@ void PlacesItem::initializeDevice(const QString& udi)
setIcon(m_device.icon());
setIconOverlays(m_device.emblems());
setUdi(udi);
- setGroup(i18nc("@item", "Devices"));
if (m_access) {
setUrl(m_access->filePath());