+ return m_viewAccessor.itemsExpandable();
+}
+
+void DolphinView::restoreState(QDataStream &stream)
+{
+ // current item
+ stream >> m_activeItemUrl;
+
+ // view position
+ stream >> m_restoredContentsPosition;
+
+ // expanded folders (only relevant for the details view - will be ignored by the view in other view modes)
+ QSet<KUrl> urlsToExpand;
+ stream >> urlsToExpand;
+ const DolphinDetailsViewExpander* expander = m_viewAccessor.setExpandedUrls(urlsToExpand);
+
+ if (expander) {
+ m_expanderActive = true;
+ connect (expander, SIGNAL(completed()), this, SLOT(slotLoadingCompleted()));
+ }
+ else {
+ m_expanderActive = false;
+ }
+}
+
+void DolphinView::saveState(QDataStream &stream)
+{
+ // current item
+ KFileItem currentItem;
+ const QAbstractItemView* view = m_viewAccessor.itemView();
+
+ if(view) {
+ const QModelIndex proxyIndex = view->currentIndex();
+ const QModelIndex dirModelIndex = m_viewAccessor.proxyModel()->mapToSource(proxyIndex);
+ currentItem = m_viewAccessor.dirModel()->itemForIndex(dirModelIndex);
+ }
+
+ KUrl currentUrl;
+ if (!currentItem.isNull())
+ currentUrl = currentItem.url();
+
+ stream << currentUrl;
+
+ // view position
+ stream << contentsPosition();
+
+ // expanded folders (only relevant for the details view - the set will be empty in other view modes)
+ stream << m_viewAccessor.expandedUrls();
+}
+
+void DolphinView::observeCreatedItem(const KUrl& url)
+{
+ m_createdItemUrl = url;
+ connect(m_viewAccessor.dirModel(), SIGNAL(rowsInserted(const QModelIndex&, int, int)),
+ this, SLOT(selectAndScrollToCreatedItem()));
+}
+
+void DolphinView::selectAndScrollToCreatedItem()
+{
+ const QModelIndex dirIndex = m_viewAccessor.dirModel()->indexForUrl(m_createdItemUrl);
+ if (dirIndex.isValid()) {
+ const QModelIndex proxyIndex = m_viewAccessor.proxyModel()->mapFromSource(dirIndex);
+ m_viewAccessor.itemView()->setCurrentIndex(proxyIndex);
+ }
+
+ disconnect(m_viewAccessor.dirModel(), SIGNAL(rowsInserted(const QModelIndex&, int, int)),
+ this, SLOT(selectAndScrollToCreatedItem()));
+ m_createdItemUrl = KUrl();
+}
+
+void DolphinView::restoreSelection()
+{
+ disconnect(m_viewAccessor.dirLister(), SIGNAL(completed()), this, SLOT(restoreSelection()));
+ changeSelection(m_selectedItems);