+void TreeViewSidebarPage::dropUrls(const KUrl::List& urls,
+ const QModelIndex& index)
+{
+ if (index.isValid()) {
+ const QModelIndex dirIndex = m_proxyModel->mapToSource(index);
+ KFileItem item = m_dolphinModel->itemForIndex(dirIndex);
+ Q_ASSERT(!item.isNull());
+ if (item.isDir()) {
+ emit urlsDropped(urls, item.url());
+ }
+ }
+}
+
+void TreeViewSidebarPage::triggerExpanding()
+{
+ // the expanding of the folders may not be done in the context
+ // of this slot
+ QMetaObject::invokeMethod(this, "expandToLeafDir", Qt::QueuedConnection);
+}
+
+void TreeViewSidebarPage::triggerLoadSubTree()
+{
+ // the loading of the sub tree may not be done in the context
+ // of this slot
+ QMetaObject::invokeMethod(this, "loadSubTree", Qt::QueuedConnection);
+}
+
+void TreeViewSidebarPage::expandToLeafDir()
+{
+ // expand all directories until the parent directory of m_leafDir
+ const KUrl parentUrl = m_leafDir.upUrl();
+ QModelIndex dirIndex = m_dolphinModel->indexForUrl(parentUrl);
+ QModelIndex proxyIndex = m_proxyModel->mapFromSource(dirIndex);
+ m_treeView->setExpanded(proxyIndex, true);
+ selectLeafDirectory();
+}
+
+
+void TreeViewSidebarPage::loadSubTree()
+{
+ m_treeView->selectionModel()->clearSelection();
+
+ if (m_leafDir.isParentOf(m_dirLister->url())) {
+ // The leaf directory is not a child of the base URL, hence
+ // no sub directory must be loaded or selected.