┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/places/placesitemmodel.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2012-05-09 09:03:21 +0200
committerPeter Penz <[email protected]>2012-05-09 09:04:06 +0200
commit321f747ddf9cf71ed3c8fa4de287d131cd22c2d8 (patch)
tree0e75bf2126f335b38c0de4fe204654d2da8e5d6f /src/panels/places/placesitemmodel.cpp
parent02b251372efb53344388a9e3da098b08289e7e3b (diff)
Create items for devices that have not been added as bookmarks yet
Diffstat (limited to 'src/panels/places/placesitemmodel.cpp')
-rw-r--r--src/panels/places/placesitemmodel.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp
index b4fc49c2c..48f54b276 100644
--- a/src/panels/places/placesitemmodel.cpp
+++ b/src/panels/places/placesitemmodel.cpp
@@ -213,6 +213,16 @@ QString PlacesItemModel::groupName(const KUrl &url) const
QAction* PlacesItemModel::ejectAction(int index) const
{
+ const PlacesItem* item = placesItem(index);
+ if (item && item->device().is<Solid::OpticalDisc>()) {
+ return new QAction(KIcon("media-eject"), i18nc("@item", "Eject '%1'", item->text()), 0);
+ }
+
+ return 0;
+}
+
+QAction* PlacesItemModel::tearDownAction(int index) const
+{
// TODO: This is a dummy-implementation to have at least all
// translation-strings as part of the code before the freeze
QString iconName;
@@ -238,17 +248,6 @@ QAction* PlacesItemModel::ejectAction(int index) const
return 0;
}
-QAction* PlacesItemModel::tearDownAction(int index) const
-{
- // TODO: This is a dummy-implementation to have at least all
- // translation-strings as part of the code before the freeze
- Q_UNUSED(index);
- QString label;
- QAction action(KIcon("media-eject"), i18nc("@item", "Eject '%1'", label), 0);
- Q_UNUSED(action);
- return 0;
-}
-
void PlacesItemModel::onItemInserted(int index)
{
int modelIndex = 0;
@@ -319,7 +318,7 @@ void PlacesItemModel::loadBookmarks()
&& (m_nepomukRunning || url.protocol() != QLatin1String("timeline"));
if ((udi.isEmpty() && allowedHere) || deviceAvailable) {
- PlacesItem* item = new PlacesItem(bookmark, udi);
+ PlacesItem* item = new PlacesItem(bookmark);
if (deviceAvailable) {
devicesItems.append(item);
} else {
@@ -358,12 +357,13 @@ void PlacesItemModel::loadBookmarks()
}
}
- addItems(devicesItems);
+ // Create items for devices that have not stored as bookmark yet
+ foreach (const QString& udi, devices) {
+ PlacesItem* item = new PlacesItem(udi);
+ devicesItems.append(item);
+ }
- // TODO: add bookmarks for missing devices
- // foreach (const QString &udi, devices) {
- // bookmark = KFilePlacesItem::createDeviceBookmark(bookmarkManager, udi);
- // ...
+ addItems(devicesItems);
#ifdef PLACESITEMMODEL_DEBUG
kDebug() << "Loaded bookmarks";