mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +00:00
DolphinContextMenu: Do not check if the clicked folder is in the Places
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
This commit is contained in:
parent
2257b94e4f
commit
d094c8ffe6
|
@ -427,16 +427,11 @@ void DolphinContextMenu::addShowMenuBarAction()
|
||||||
|
|
||||||
bool DolphinContextMenu::placeExists(const QUrl& url) const
|
bool DolphinContextMenu::placeExists(const QUrl& url) const
|
||||||
{
|
{
|
||||||
PlacesItemModel model;
|
// 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
|
||||||
const int count = model.count();
|
// available, which can take some time.
|
||||||
for (int i = 0; i < count; ++i) {
|
// TODO: Consider restoring this check if the handling of Places and devices
|
||||||
const QUrl placeUrl = model.placesItem(i)->url();
|
// will be decoupled in the future.
|
||||||
if (placeUrl.matches(url, QUrl::StripTrailingSlash)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue