]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fixes Bug 304878 - Dolphin shows "ghost" folders in places after autofs umount nfs...
authorEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Thu, 20 Sep 2012 15:56:00 +0000 (17:56 +0200)
committerEmmanuel Pescosta <emmanuelpescosta099@gmail.com>
Thu, 20 Sep 2012 15:56:00 +0000 (17:56 +0200)
BUG: 304878
REVIEW: 106456
FIXED-IN: 4.9.2

src/panels/places/placesitemmodel.cpp

index bd50c9a4baa2d8b122888cc7d285f5431c25d4ea..706092bc7324dfc1b3a565e469c4887fe59f39a6 100644 (file)
@@ -659,11 +659,22 @@ void PlacesItemModel::updateBookmarks()
             }
 
             if (!found) {
-                PlacesItem* item = new PlacesItem(newBookmark);
-                if (item->isHidden() && !m_hiddenItemsShown) {
-                    m_bookmarkedItems.append(item);
-                } else {
-                    appendItemToGroup(item);
+                const QString udi = newBookmark.metaDataItem("UDI");
+
+                /*
+                 * See Bug 304878
+                 * Only add a new places item, if the item text is not empty
+                 * and if the device is available. Fixes the strange behaviour -
+                 * add a places item without text in the Places section - when you
+                 * remove a device (e.g. a usb stick) without unmounting.
+                 */
+                if (udi.isEmpty() || Solid::Device(udi).isValid()) {
+                    PlacesItem* item = new PlacesItem(newBookmark);
+                    if (item->isHidden() && !m_hiddenItemsShown) {
+                        m_bookmarkedItems.append(item);
+                    } else {
+                        appendItemToGroup(item);
+                    }
                 }
             }
         }