+bool DolphinView::itemsExpandable() const
+{
+ 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 != 0) {
+ 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 != 0) {
+ 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
+ const int x = view->horizontalScrollBar()->value();
+ const int y = view->verticalScrollBar()->value();
+ stream << QPoint(x, y);
+
+ // 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()