]> cloud.milkyroute.net Git - dolphin.git/commitdiff
DolphinContextMenu: Do not check if the clicked folder is in the Places
authorFrank Reininghaus <frank78ac@googlemail.com>
Wed, 27 Jan 2016 05:56:14 +0000 (06:56 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Wed, 10 Feb 2016 21:36:01 +0000 (22:36 +0100)
This prevents that the setup of the PlacesItemModel queries Solid for
the available devices, which can take some time.

Places can be added multiple times now using the context menu, but this
has always been possible with drag and drop anyway.

See https://forum.kde.org/viewtopic.php?f=223&t=130617 for a dicsussion
on this topic.

REVIEW: 126904

src/dolphincontextmenu.cpp

index af283cf009f7e6d17a017d0e0df922d5127af7f6..0830d4b8b73c8b9feca13306de3f1a4fb93721cc 100644 (file)
@@ -427,16 +427,11 @@ void DolphinContextMenu::addShowMenuBarAction()
 
 bool DolphinContextMenu::placeExists(const QUrl& url) const
 {
 
 bool DolphinContextMenu::placeExists(const QUrl& url) const
 {
-    PlacesItemModel model;
-
-    const int count = model.count();
-    for (int i = 0; i < count; ++i) {
-        const QUrl placeUrl = model.placesItem(i)->url();
-        if (placeUrl.matches(url, QUrl::StripTrailingSlash)) {
-            return true;
-        }
-    }
-
+    // Creating up a PlacesItemModel to find out if 'url' is one of the Places
+    // can be expensive because the model asks Solid for the devices which are
+    // available, which can take some time.
+    // TODO: Consider restoring this check if the handling of Places and devices
+    // will be decoupled in the future.
     return false;
 }
 
     return false;
 }