- const QModelIndex index = m_dirModel->indexForItem(item);
- if (index.isValid()) {
-#if defined(USE_PROXY_MODEL)
- // the item with the given URL is already part of the model
- const QModelIndex proxyIndex = m_proxyModel->mapFromSource(index);
- m_treeView->scrollTo(proxyIndex);
- selModel->setCurrentIndex(proxyIndex, QItemSelectionModel::Select);
-#else
- m_treeView->scrollTo(index);
- selModel->setCurrentIndex(index, QItemSelectionModel::Select);
-#endif
- }
- else {
- // The item with the given URL is not loaded by the model yet. Iterate
- // backward to the base URL and trigger the loading of the items for
- // each hierarchy level.
- connect(m_dirLister, SIGNAL(completed()),
- this, SLOT(expandSelectionParent()));
-
- KUrl parentUrl = url.upUrl();
- while (!parentUrl.isParentOf(baseUrl)) {
- m_dirLister->openUrl(parentUrl, true, false);
- parentUrl = parentUrl.upUrl();
- }
- }
+ emit changeSelection(KFileItemList());
+ TreeViewContextMenu contextMenu(this, item);
+ contextMenu.open();