Fix duplicated "Internal shared storage" when opening MTP device from sidebar
Issue:
When opening an MTP device via the sidebar, Dolphin shows one "Internal shared storage" folder. However, clicking the entry again results in a duplicate folder being displayed.
This regression was introduced by !865 (merged) (commit 6c7c0471).
Reason:
The URL of an MTP device in the sidebar is mtp:udi=/org/kde/solid/udev/sys/devices/.... When clicking to open the MTP device, it is redirected to mtp:/....
- On the first click (no cache),
KCoreDirListerCache::slotUpdateResult()callsKCoreDirListerPrivate::emitItems(). - On the second click (with cache),
KCoreDirListerCache::slotRedirection()first callsKCoreDirListerPrivate::emitItems().
Besides,DolphinTabPage::slotViewUrlRedirection()callsKCoreDirLister::openUrl(), which triggersCachedItemsJob::start(), and eventually callsKCoreDirListerPrivate::emitItems()again.
As a result, twoKCoreDirLister::itemsAddedsignals are emitted, causingm_pendingItemsToInsertto be appended twice.
Change:
Add optional reload parameter to DolphinView::setUrl() and use it on URL redirection.