]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinview.cpp
The feature freeze is near: Add video support to the Information Panel. Phonon is...
[dolphin.git] / src / dolphinview.cpp
index 56fdf4ad1ae6c44ec04f3cc85d1388ba749af2e1..57a2551adf6c62f704d18756c8591f57e6d7e4ab 100644 (file)
@@ -106,6 +106,7 @@ DolphinView::DolphinView(QWidget* parent,
     m_rootUrl(),
     m_currentItemUrl(),
     m_createdItemUrl(),
+    m_selectedItems(),
     m_expandedDragSource(0)
 {
     m_topLayout = new QVBoxLayout(this);
@@ -1109,6 +1110,12 @@ void DolphinView::selectAndScrollToCreatedItem()
     m_createdItemUrl = KUrl();
 }
 
+void DolphinView::restoreSelection()
+{
+    disconnect(m_dirLister, SIGNAL(completed()), this, SLOT(restoreSelection()));
+    changeSelection(m_selectedItems);
+}
+
 void DolphinView::emitContentsMoved()
 {
     // only emit the contents moved signal if:
@@ -1183,6 +1190,11 @@ void DolphinView::loadDirectory(const KUrl& url, bool reload)
 
     m_loadingDirectory = true;
 
+    if (reload) {
+        m_selectedItems = selectedItems();
+        connect(m_dirLister, SIGNAL(completed()), this, SLOT(restoreSelection()));
+    }
+
     m_dirLister->stop();
     m_dirLister->openUrl(url, reload ? KDirLister::Reload : KDirLister::NoFlags);
 
@@ -1477,4 +1489,5 @@ QMimeData* DolphinView::selectionMimeData() const
     return m_dolphinModel->mimeData(selection.indexes());
 }
 
+
 #include "dolphinview.moc"