diff options
| author | Kai Uwe Broulik <[email protected]> | 2019-06-07 10:37:06 +0200 |
|---|---|---|
| committer | Kai Uwe Broulik <[email protected]> | 2019-06-07 10:37:19 +0200 |
| commit | 10d8a5731507881aa12f166a7d233e8c434894eb (patch) | |
| tree | 3917bf88bd1a3c7f08192547cf76c2c556d83a4f /src/dolphincontextmenu.cpp | |
| parent | 038565b62f6ca6323cae2c5a23a97d66fc3dc0cd (diff) | |
[DolphinContextMenu] Restore check for whether place already exists
Now that we have a places singleton it adds no real overhead.
Differential Revision: https://phabricator.kde.org/D21600
Diffstat (limited to 'src/dolphincontextmenu.cpp')
| -rw-r--r-- | src/dolphincontextmenu.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index d32d35dd3..1dfbe054d 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -23,6 +23,7 @@ #include "dolphin_generalsettings.h" #include "dolphinmainwindow.h" #include "dolphinnewfilemenu.h" +#include "dolphinplacesmodelsingleton.h" #include "dolphinremoveaction.h" #include "dolphinviewcontainer.h" #include "panels/places/placesitem.h" @@ -460,13 +461,11 @@ void DolphinContextMenu::addShowMenuBarAction() bool DolphinContextMenu::placeExists(const QUrl& url) const { - Q_UNUSED(url) - // 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; + const KFilePlacesModel* placesModel = DolphinPlacesModelSingleton::instance().placesModel(); + + const auto& matchedPlaces = placesModel->match(placesModel->index(0,0), KFilePlacesModel::UrlRole, url, 1, Qt::MatchExactly); + + return !matchedPlaces.isEmpty(); } QAction* DolphinContextMenu::createPasteAction() |
