diff options
| author | Peter Penz <[email protected]> | 2012-04-30 18:26:21 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-04-30 18:27:56 +0200 |
| commit | cb1f42a1eb3584742fa33e28759ed8fbab199c5b (patch) | |
| tree | 84aee132d0fdb4d00abefb6b4ee4acdb3c6a36a0 /src/panels/places/placesitemmodel.cpp | |
| parent | b419cfc5974192f3445b6a439b40bae4af119615 (diff) | |
Places Panel: Minor fixes/improvements
- Determine group of a new entry dependent from the protocol
- Allow panels to forward error-messages to the view-container
(also applied to Folders Panel)
Diffstat (limited to 'src/panels/places/placesitemmodel.cpp')
| -rw-r--r-- | src/panels/places/placesitemmodel.cpp | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index ae6163e03..023e873eb 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -37,6 +37,7 @@ #include <KBookmarkGroup> #include <KBookmarkManager> #include <KComponentData> +#include <KDebug> #include <KIcon> #include <kitemviews/kstandarditem.h> #include <KLocale> @@ -47,6 +48,7 @@ PlacesItemModel::PlacesItemModel(QObject* parent) : KStandardItemModel(parent), m_nepomukRunning(false), + m_hiddenItemsShown(false), m_availableDevices(), m_bookmarkManager(0), m_systemBookmarks(), @@ -71,6 +73,18 @@ int PlacesItemModel::hiddenCount() const return 0; } +void PlacesItemModel::setHiddenItemsShown(bool show) +{ + if (m_hiddenItemsShown != show) { + m_hiddenItemsShown = show; + } +} + +bool PlacesItemModel::hiddenItemsShown() const +{ + return m_hiddenItemsShown; +} + bool PlacesItemModel::isSystemItem(int index) const { if (index >= 0 && index < count()) { @@ -99,19 +113,19 @@ int PlacesItemModel::closestItem(const KUrl& url) const return foundIndex; } -QString PlacesItemModel::placesGroupName() const +QString PlacesItemModel::groupName(const KUrl &url) const { - return i18nc("@item", "Places"); -} + const QString protocol = url.protocol(); -QString PlacesItemModel::recentlyAccessedGroupName() const -{ - return i18nc("@item", "Recently Accessed"); -} + if (protocol.contains(QLatin1String("search"))) { + return searchForGroupName(); + } -QString PlacesItemModel::searchForGroupName() const -{ - return i18nc("@item", "Search For"); + if (protocol == QLatin1String("timeline")) { + return recentlyAccessedGroupName(); + } + + return placesGroupName(); } QAction* PlacesItemModel::ejectAction(int index) const @@ -262,8 +276,22 @@ void PlacesItemModel::createSystemBookmarks() } } +QString PlacesItemModel::placesGroupName() +{ + return i18nc("@item", "Places"); +} + +QString PlacesItemModel::recentlyAccessedGroupName() +{ + return i18nc("@item", "Recently Accessed"); +} + +QString PlacesItemModel::searchForGroupName() +{ + return i18nc("@item", "Search For"); +} -KUrl PlacesItemModel::translatedSystemBookmarkUrl(const KUrl& url) const +KUrl PlacesItemModel::translatedSystemBookmarkUrl(const KUrl& url) { KUrl translatedUrl = url; if (url.protocol() == QLatin1String("timeline")) { |
