]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphincontextmenu.cpp
DolphinContextMenu: Do not check if the clicked folder is in the Places
[dolphin.git] / src / dolphincontextmenu.cpp
index 0f6ffd48e1ca5b17758081020b684c8cf800a075..0830d4b8b73c8b9feca13306de3f1a4fb93721cc 100644 (file)
@@ -286,8 +286,9 @@ void DolphinContextMenu::openItemContextMenu()
 
     // insert 'Copy To' and 'Move To' sub menus
     if (GeneralSettings::showCopyMoveMenu()) {
-        m_copyToMenu.setItems(m_selectedItems);
+        m_copyToMenu.setUrls(m_selectedItems.urlList());
         m_copyToMenu.setReadOnly(!selectedItemsProps.supportsWriting());
+        m_copyToMenu.setAutoErrorHandlingEnabled(true);
         m_copyToMenu.addActionsTo(this);
     }
 
@@ -304,6 +305,7 @@ void DolphinContextMenu::openItemContextMenu()
                 const QString text = selectedUrl.fileName();
                 PlacesItem* item = model.createPlacesItem(text, selectedUrl);
                 model.appendItemToGroup(item);
+                model.saveBookmarks();
             }
         } else if (activatedAction == openParentAction) {
             m_command = OpenParentFolder;
@@ -369,6 +371,7 @@ void DolphinContextMenu::openViewportContextMenu()
             PlacesItem* item = model.createPlacesItem(container->placesText(),
                                                       container->url());
             model.appendItemToGroup(item);
+            model.saveBookmarks();
         }
     }
 }
@@ -424,16 +427,11 @@ void DolphinContextMenu::addShowMenuBarAction()
 
 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;
 }