]> cloud.milkyroute.net Git - dolphin.git/commitdiff
* Adjust code to use the improved KUrlNavigator API.
authorPeter Penz <peter.penz19@gmail.com>
Mon, 25 Jan 2010 07:58:24 +0000 (07:58 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Mon, 25 Jan 2010 07:58:24 +0000 (07:58 +0000)
* Open a new tab if the URL navigator requests it.
* Get rid of a cyclic dependency between DolphinViewContainer and DolphinMainWindow.

BUG: 181223

svn path=/trunk/KDE/kdebase/apps/; revision=1079843

src/dolphinmainwindow.cpp
src/dolphinmainwindow.h
src/dolphinview.cpp
src/dolphinview.h
src/dolphinviewcontainer.cpp
src/dolphinviewcontainer.h

index 9349ca7be63fdfcf9f42e556a4553c4aea68acb6..00255131849e9846faf4fd78a8dcc836c00e2b0f 100644 (file)
@@ -29,6 +29,7 @@
 #endif
 
 #include "dolphinapplication.h"
 #endif
 
 #include "dolphinapplication.h"
+#include "dolphincontextmenu.h"
 #include "dolphinnewmenu.h"
 #include "search/dolphinsearchbox.h"
 #include "settings/dolphinsettings.h"
 #include "dolphinnewmenu.h"
 #include "search/dolphinsearchbox.h"
 #include "settings/dolphinsettings.h"
@@ -415,7 +416,7 @@ void DolphinMainWindow::openNewTab(const KUrl& url)
     ViewTab viewTab;
     viewTab.splitter = new QSplitter(this);
     viewTab.splitter->setChildrenCollapsible(false);
     ViewTab viewTab;
     viewTab.splitter = new QSplitter(this);
     viewTab.splitter->setChildrenCollapsible(false);
-    viewTab.primaryView = new DolphinViewContainer(this, viewTab.splitter, url);
+    viewTab.primaryView = new DolphinViewContainer(url, viewTab.splitter);
     viewTab.primaryView->setActive(false);
     connectViewSignals(viewTab.primaryView);
     viewTab.primaryView->view()->reload();
     viewTab.primaryView->setActive(false);
     connectViewSignals(viewTab.primaryView);
     viewTab.primaryView->view()->reload();
@@ -553,7 +554,7 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
                 break;
             case KDialog::No:
                 // Close only the current tab
                 break;
             case KDialog::No:
                 // Close only the current tab
-             closeTab();
+              closeTab();
             default:
                 event->ignore();
                 return;
             default:
                 event->ignore();
                 return;
@@ -576,12 +577,14 @@ void DolphinMainWindow::saveProperties(KConfigGroup& group)
     for (int i = 0; i < tabCount; ++i) {
         const DolphinViewContainer* cont = m_viewTab[i].primaryView;
         group.writeEntry(tabProperty("Primary URL", i), cont->url().url());
     for (int i = 0; i < tabCount; ++i) {
         const DolphinViewContainer* cont = m_viewTab[i].primaryView;
         group.writeEntry(tabProperty("Primary URL", i), cont->url().url());
-        group.writeEntry(tabProperty("Primary Editable", i), cont->isUrlEditable());
+        group.writeEntry(tabProperty("Primary Editable", i),
+                         cont->urlNavigator()->isUrlEditable());
 
         cont = m_viewTab[i].secondaryView;
         if (cont != 0) {
             group.writeEntry(tabProperty("Secondary URL", i), cont->url().url());
 
         cont = m_viewTab[i].secondaryView;
         if (cont != 0) {
             group.writeEntry(tabProperty("Secondary URL", i), cont->url().url());
-            group.writeEntry(tabProperty("Secondary Editable", i), cont->isUrlEditable());
+            group.writeEntry(tabProperty("Secondary Editable", i),
+                             cont->urlNavigator()->isUrlEditable());
         }
     }
 }
         }
     }
 }
@@ -840,7 +843,8 @@ void DolphinMainWindow::goBack(Qt::MouseButtons buttons)
     // The default case (left button pressed) is handled in goBack().
     if (buttons == Qt::MidButton) {
         KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
     // The default case (left button pressed) is handled in goBack().
     if (buttons == Qt::MidButton) {
         KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
-        openNewTab(urlNavigator->historyUrl(urlNavigator->historyIndex() + 1));
+        const int index = urlNavigator->historyIndex() + 1;
+        openNewTab(urlNavigator->locationUrl(index));
     }
 }
 
     }
 }
 
@@ -849,7 +853,8 @@ void DolphinMainWindow::goForward(Qt::MouseButtons buttons)
     // The default case (left button pressed) is handled in goForward().
     if (buttons == Qt::MidButton) {
         KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
     // The default case (left button pressed) is handled in goForward().
     if (buttons == Qt::MidButton) {
         KUrlNavigator* urlNavigator = activeViewContainer()->urlNavigator();
-        openNewTab(urlNavigator->historyUrl(urlNavigator->historyIndex() - 1));
+        const int index = urlNavigator->historyIndex() - 1;
+        openNewTab(urlNavigator->locationUrl(index));
     }
 }
 
     }
 }
 
@@ -1043,6 +1048,8 @@ void DolphinMainWindow::openTabContextMenu(int index, const QPoint& pos)
     QAction* newTabAction = menu.addAction(KIcon("tab-new"), i18nc("@action:inmenu", "New Tab"));
     newTabAction->setShortcut(actionCollection()->action("new_tab")->shortcut());
 
     QAction* newTabAction = menu.addAction(KIcon("tab-new"), i18nc("@action:inmenu", "New Tab"));
     newTabAction->setShortcut(actionCollection()->action("new_tab")->shortcut());
 
+    QAction* detachTabAction = menu.addAction(KIcon("tab-detach"), i18nc("@action:inmenu", "Detach Tab"));
+
     QAction* closeOtherTabsAction = menu.addAction(KIcon("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs"));
 
     QAction* closeTabAction = menu.addAction(KIcon("tab-close"), i18nc("@action:inmenu", "Close Tab"));
     QAction* closeOtherTabsAction = menu.addAction(KIcon("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs"));
 
     QAction* closeTabAction = menu.addAction(KIcon("tab-close"), i18nc("@action:inmenu", "Close Tab"));
@@ -1055,6 +1062,25 @@ void DolphinMainWindow::openTabContextMenu(int index, const QPoint& pos)
                          tab.secondaryView->url() : tab.primaryView->url();
         openNewTab(url);
         m_tabBar->setCurrentIndex(m_viewTab.count() - 1);
                          tab.secondaryView->url() : tab.primaryView->url();
         openNewTab(url);
         m_tabBar->setCurrentIndex(m_viewTab.count() - 1);
+    } else if (selectedAction == detachTabAction) {
+        const ViewTab& tab = m_viewTab[index];
+        Q_ASSERT(tab.primaryView != 0);
+        const KUrl primaryUrl = tab.primaryView->url();
+        DolphinMainWindow* window = DolphinApplication::app()->createMainWindow();
+        window->changeUrl(primaryUrl);
+
+        if (tab.secondaryView != 0) {
+            const KUrl secondaryUrl = tab.secondaryView->url();
+            window->toggleSplitView();
+            window->m_viewTab[0].secondaryView->setUrl(secondaryUrl);
+            if (tab.primaryView->isActive()) {
+                window->m_viewTab[0].primaryView->setActive(true);
+            } else {
+                window->m_viewTab[0].secondaryView->setActive(true);
+            }
+        }
+        window->show();
+        closeTab(index);
     } else if (selectedAction == closeOtherTabsAction) {
         const int count = m_tabBar->count();
         for (int i = 0; i < index; ++i) {
     } else if (selectedAction == closeOtherTabsAction) {
         const int count = m_tabBar->count();
         for (int i = 0; i < index; ++i) {
@@ -1068,6 +1094,12 @@ void DolphinMainWindow::openTabContextMenu(int index, const QPoint& pos)
     }
 }
 
     }
 }
 
+void DolphinMainWindow::slotTabMoved(int from, int to)
+{
+    m_viewTab.move(from, to);
+    m_tabIndex = m_tabBar->currentIndex();
+}
+
 void DolphinMainWindow::handlePlacesClick(const KUrl& url, Qt::MouseButtons buttons)
 {
     if (buttons & Qt::MidButton) {
 void DolphinMainWindow::handlePlacesClick(const KUrl& url, Qt::MouseButtons buttons)
 {
     if (buttons & Qt::MidButton) {
@@ -1091,12 +1123,6 @@ void DolphinMainWindow::searchItems()
 #endif
 }
 
 #endif
 }
 
-void DolphinMainWindow::slotTabMoved(int from, int to)
-{
-    m_viewTab.move(from, to);
-    m_tabIndex = m_tabBar->currentIndex();
-}
-
 void DolphinMainWindow::showSearchOptions()
 {
 #ifdef HAVE_NEPOMUK
 void DolphinMainWindow::showSearchOptions()
 {
 #ifdef HAVE_NEPOMUK
@@ -1104,6 +1130,37 @@ void DolphinMainWindow::showSearchOptions()
 #endif
 }
 
 #endif
 }
 
+void DolphinMainWindow::handleUrl(const KUrl& url)
+{
+    if (KProtocolManager::supportsListing(url)) {
+        activeViewContainer()->setUrl(url);
+    } else {
+        new KRun(url, this);
+    }
+}
+
+void DolphinMainWindow::slotCaptionStatFinished(KJob* job)
+{
+    m_captionStatJob = 0;
+    const KIO::UDSEntry entry = static_cast<KIO::StatJob*>(job)->statResult();
+    const QString name = entry.stringValue(KIO::UDSEntry::UDS_DISPLAY_NAME);
+    setCaption(name);
+}
+
+void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable)
+{
+    newMenu()->setEnabled(isFolderWritable);
+}
+
+void DolphinMainWindow::openContextMenu(const KFileItem& item,
+                                        const KUrl& url,
+                                        const QList<QAction*>& customActions)
+{
+    DolphinContextMenu contextMenu(this, item, url);
+    contextMenu.setCustomActions(customActions);
+    contextMenu.open();
+}
+
 void DolphinMainWindow::init()
 {
     DolphinSettings& settings = DolphinSettings::instance();
 void DolphinMainWindow::init()
 {
     DolphinSettings& settings = DolphinSettings::instance();
@@ -1129,9 +1186,8 @@ void DolphinMainWindow::init()
     connect(m_actionHandler, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
     connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
     ViewProperties props(homeUrl);
     connect(m_actionHandler, SIGNAL(actionBeingHandled()), SLOT(clearStatusBar()));
     connect(m_actionHandler, SIGNAL(createDirectory()), SLOT(createDirectory()));
     ViewProperties props(homeUrl);
-    m_viewTab[m_tabIndex].primaryView = new DolphinViewContainer(this,
-                                                                 m_viewTab[m_tabIndex].splitter,
-                                                                 homeUrl);
+    m_viewTab[m_tabIndex].primaryView = new DolphinViewContainer(homeUrl,
+                                                                 m_viewTab[m_tabIndex].splitter);
 
     m_activeViewContainer = m_viewTab[m_tabIndex].primaryView;
     connectViewSignals(m_activeViewContainer);
 
     m_activeViewContainer = m_viewTab[m_tabIndex].primaryView;
     connectViewSignals(m_activeViewContainer);
@@ -1166,7 +1222,7 @@ void DolphinMainWindow::init()
     connect(m_tabBar, SIGNAL(testCanDecode(const QDragMoveEvent*, bool&)),
             this, SLOT(slotTestCanDecode(const QDragMoveEvent*, bool&)));
     connect(m_tabBar, SIGNAL(wheelDelta(int)),
     connect(m_tabBar, SIGNAL(testCanDecode(const QDragMoveEvent*, bool&)),
             this, SLOT(slotTestCanDecode(const QDragMoveEvent*, bool&)));
     connect(m_tabBar, SIGNAL(wheelDelta(int)),
-           this, SLOT(slotWheelMoved(int)));
+            this, SLOT(slotWheelMoved(int)));
     connect(m_tabBar, SIGNAL(mouseMiddleClick(int)),
             this, SLOT(closeTab(int)));
     connect(m_tabBar, SIGNAL(tabMoved(int, int)),
     connect(m_tabBar, SIGNAL(mouseMiddleClick(int)),
             this, SLOT(closeTab(int)));
     connect(m_tabBar, SIGNAL(tabMoved(int, int)),
@@ -1633,6 +1689,8 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
 {
     connect(container, SIGNAL(showFilterBarChanged(bool)),
             this, SLOT(updateFilterBarAction(bool)));
 {
     connect(container, SIGNAL(showFilterBarChanged(bool)),
             this, SLOT(updateFilterBarAction(bool)));
+    connect(container, SIGNAL(writeStateChanged(bool)),
+            this, SLOT(slotWriteStateChanged(bool)));
 
     DolphinView* view = container->view();
     connect(view, SIGNAL(selectionChanged(KFileItemList)),
 
     DolphinView* view = container->view();
     connect(view, SIGNAL(selectionChanged(KFileItemList)),
@@ -1643,6 +1701,8 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
             this, SLOT(toggleActiveView()));
     connect(view, SIGNAL(tabRequested(const KUrl&)),
             this, SLOT(openNewTab(const KUrl&)));
             this, SLOT(toggleActiveView()));
     connect(view, SIGNAL(tabRequested(const KUrl&)),
             this, SLOT(openNewTab(const KUrl&)));
+    connect(view, SIGNAL(requestContextMenu(KFileItem, const KUrl&, const QList<QAction*>&)),
+            this, SLOT(openContextMenu(KFileItem, const KUrl&, const QList<QAction*>&)));
 
     const KUrlNavigator* navigator = container->urlNavigator();
     connect(navigator, SIGNAL(urlChanged(const KUrl&)),
 
     const KUrlNavigator* navigator = container->urlNavigator();
     connect(navigator, SIGNAL(urlChanged(const KUrl&)),
@@ -1710,7 +1770,7 @@ void DolphinMainWindow::createSecondaryView(int tabIndex)
     const int newWidth = (m_viewTab[tabIndex].primaryView->width() - splitter->handleWidth()) / 2;
 
     const DolphinView* view = m_viewTab[tabIndex].primaryView->view();
     const int newWidth = (m_viewTab[tabIndex].primaryView->width() - splitter->handleWidth()) / 2;
 
     const DolphinView* view = m_viewTab[tabIndex].primaryView->view();
-    m_viewTab[tabIndex].secondaryView = new DolphinViewContainer(this, 0, view->rootUrl());
+    m_viewTab[tabIndex].secondaryView = new DolphinViewContainer(view->rootUrl(), 0);
     splitter->addWidget(m_viewTab[tabIndex].secondaryView);
     splitter->setSizes(QList<int>() << newWidth << newWidth);
     connectViewSignals(m_viewTab[tabIndex].secondaryView);
     splitter->addWidget(m_viewTab[tabIndex].secondaryView);
     splitter->setSizes(QList<int>() << newWidth << newWidth);
     connectViewSignals(m_viewTab[tabIndex].secondaryView);
@@ -1748,23 +1808,6 @@ void DolphinMainWindow::setUrlAsCaption(const KUrl& url)
     }
 }
 
     }
 }
 
-void DolphinMainWindow::handleUrl(const KUrl& url)
-{
-    if (KProtocolManager::supportsListing(url)) {
-        activeViewContainer()->setUrl(url);
-    } else {
-        new KRun(url, this);
-    }
-}
-
-void DolphinMainWindow::slotCaptionStatFinished(KJob* job)
-{  
-    m_captionStatJob = 0;
-    const KIO::UDSEntry entry = static_cast<KIO::StatJob*>(job)->statResult();
-    const QString name = entry.stringValue(KIO::UDSEntry::UDS_DISPLAY_NAME);
-    setCaption(name);
-}
-
 QString DolphinMainWindow::squeezedText(const QString& text) const
 {
     const QFontMetrics fm = fontMetrics();
 QString DolphinMainWindow::squeezedText(const QString& text) const
 {
     const QFontMetrics fm = fontMetrics();
index a70aa4c23e792721fa901c6acaa8adfabfc9bef7..bdc80b35909dd30068f1df5c5239d130c3d45aab 100644 (file)
@@ -379,13 +379,19 @@ private slots:
      */
     void closeTab(int index);
 
      */
     void closeTab(int index);
 
-
     /**
      * Opens a context menu for the tab with the index \a index
      * on the position \a pos.
      */
     void openTabContextMenu(int index, const QPoint& pos);
 
     /**
      * Opens a context menu for the tab with the index \a index
      * on the position \a pos.
      */
     void openTabContextMenu(int index, const QPoint& pos);
 
+    /**
+     * Is connected to the QTabBar signal tabMoved(int from, int to).
+     * Reorders the list of tabs after a tab was moved in the tab bar
+     * and sets m_tabIndex to the new index of the current tab.
+     */
+    void slotTabMoved(int from, int to);
+
     /**
      * Handles a click on a places item: if the middle mouse button is
      * clicked, a new tab is opened for \a url, otherwise the current
     /**
      * Handles a click on a places item: if the middle mouse button is
      * clicked, a new tab is opened for \a url, otherwise the current
@@ -405,13 +411,6 @@ private slots:
      */
     void searchItems();
 
      */
     void searchItems();
 
-    /**
-     * Is connected to the QTabBar signal tabMoved(int from, int to).
-     * Reorders the list of tabs after a tab was moved in the tab bar
-     * and sets m_tabIndex to the new index of the current tab.
-     */
-    void slotTabMoved(int from, int to);
-
     /**
      * Is connected to the searchbox signal 'requestSearchOptions' and
      * takes care to show the search options.
     /**
      * Is connected to the searchbox signal 'requestSearchOptions' and
      * takes care to show the search options.
@@ -430,6 +429,24 @@ private slots:
      */
     void slotCaptionStatFinished(KJob* job);
 
      */
     void slotCaptionStatFinished(KJob* job);
 
+    /**
+     * Is invoked when the write state of a folder has been changed and
+     * enables/disables the "Create New..." menu entry.
+     */
+    void slotWriteStateChanged(bool isFolderWritable);
+
+    /**
+     * Opens the context menu on the current mouse position.
+     * @item          File item context. If item is null, the context menu
+     *                should be applied to \a url.
+     * @url           URL which contains \a item.
+     * @customActions Actions that should be added to the context menu,
+     *                if the file item is null.
+     */
+    void openContextMenu(const KFileItem& item,
+                         const KUrl& url,
+                         const QList<QAction*>& customActions);
+
 private:
     DolphinMainWindow(int id);
     void init();
 private:
     DolphinMainWindow(int id);
     void init();
index 06e694f349d41f5deda3e2b5ac644d4e35291fcd..21404745084c648207a179db5f6c9be41c0c4189 100644 (file)
@@ -347,35 +347,6 @@ QItemSelectionModel* DolphinView::selectionModel() const
     return m_viewAccessor.itemView()->selectionModel();
 }
 
     return m_viewAccessor.itemView()->selectionModel();
 }
 
-void DolphinView::setContentsPosition(int x, int y)
-{
-    QAbstractItemView* view = m_viewAccessor.itemView();
-    Q_ASSERT(view != 0);
-    view->horizontalScrollBar()->setValue(x);
-    view->verticalScrollBar()->setValue(y);
-
-    m_loadingDirectory = false;
-}
-
-void DolphinView::setRestoredContentsPosition(const QPoint& pos)
-{
-    // TODO: This function is called by DolphinViewContainer.
-    // If it makes use of DolphinView::restoreState(...) to restore the
-    // view state in KDE 4.5, this function can be removed.
-    m_restoredContentsPosition = pos;
-}
-
-QPoint DolphinView::contentsPosition() const
-{
-    // TODO: If DolphinViewContainer uses DolphinView::saveState(...) to save the
-    // view state in KDE 4.5, this code can be moved to DolphinView::saveState.
-    QAbstractItemView* view = m_viewAccessor.itemView();
-    Q_ASSERT(view != 0);
-    const int x = view->horizontalScrollBar()->value();
-    const int y = view->verticalScrollBar()->value();
-    return QPoint(x, y);
-}
-
 void DolphinView::setZoomLevel(int level)
 {
     if (level < ZoomLevelInfo::minimumLevel()) {
 void DolphinView::setZoomLevel(int level)
 {
     if (level < ZoomLevelInfo::minimumLevel()) {
@@ -480,26 +451,6 @@ void DolphinView::refresh()
     updateZoomLevel(oldZoomLevel);
 }
 
     updateZoomLevel(oldZoomLevel);
 }
 
-void DolphinView::updateView(const KUrl& url, const KUrl& rootUrl)
-{
-    Q_UNUSED(rootUrl); // TODO: remove after columnview-cleanup has been finished
-
-    if (m_controller->url() == url) {
-        return;
-    }
-
-    m_controller->setUrl(url); // emits urlChanged, which we forward
-    m_viewAccessor.prepareUrlChange(url);
-    applyViewProperties();
-    loadDirectory(url);
-
-    // When changing the URL there is no need to keep the version
-    // data of the previous URL.
-    m_viewAccessor.dirModel()->clearVersionData();
-
-    emit startedPathLoading(url);
-}
-
 void DolphinView::setNameFilter(const QString& nameFilter)
 {
     m_controller->setNameFilter(nameFilter);
 void DolphinView::setNameFilter(const QString& nameFilter)
 {
     m_controller->setNameFilter(nameFilter);
@@ -585,8 +536,22 @@ QList<QAction*> DolphinView::versionControlActions(const KFileItemList& items) c
 
 void DolphinView::setUrl(const KUrl& url)
 {
 
 void DolphinView::setUrl(const KUrl& url)
 {
+    if (m_controller->url() == url) {
+        return;
+    }
+
     m_newFileNames.clear();
     m_newFileNames.clear();
-    updateView(url, KUrl());
+
+    m_controller->setUrl(url); // emits urlChanged, which we forward
+    m_viewAccessor.prepareUrlChange(url);
+    applyViewProperties();
+    loadDirectory(url);
+
+    // When changing the URL there is no need to keep the version
+    // data of the previous URL.
+    m_viewAccessor.dirModel()->clearVersionData();
+
+    emit startedPathLoading(url);
 }
 
 void DolphinView::selectAll()
 }
 
 void DolphinView::selectAll()
@@ -1072,9 +1037,9 @@ bool DolphinView::itemsExpandable() const
     return m_viewAccessor.itemsExpandable();
 }
 
     return m_viewAccessor.itemsExpandable();
 }
 
-void DolphinView::restoreState(QDataStream &stream)
+void DolphinView::restoreState(QDataStreamstream)
 {
 {
-     // current item
+    // current item
     stream >> m_activeItemUrl;
 
     // view position
     stream >> m_activeItemUrl;
 
     // view position
@@ -1084,8 +1049,7 @@ void DolphinView::restoreState(QDataStream &stream)
     QSet<KUrl> urlsToExpand;
     stream >> urlsToExpand;
     const DolphinDetailsViewExpander* expander = m_viewAccessor.setExpandedUrls(urlsToExpand);
     QSet<KUrl> urlsToExpand;
     stream >> urlsToExpand;
     const DolphinDetailsViewExpander* expander = m_viewAccessor.setExpandedUrls(urlsToExpand);
-
-    if (expander) {
+    if (expander != 0) {
         m_expanderActive = true;
         connect (expander, SIGNAL(completed()), this, SLOT(slotLoadingCompleted()));
     }
         m_expanderActive = true;
         connect (expander, SIGNAL(completed()), this, SLOT(slotLoadingCompleted()));
     }
@@ -1094,26 +1058,29 @@ void DolphinView::restoreState(QDataStream &stream)
     }
 }
 
     }
 }
 
-void DolphinView::saveState(QDataStream &stream)
+void DolphinView::saveState(QDataStreamstream)
 {
     // current item
     KFileItem currentItem;
     const QAbstractItemView* view = m_viewAccessor.itemView();
 
 {
     // current item
     KFileItem currentItem;
     const QAbstractItemView* view = m_viewAccessor.itemView();
 
-    if(view) {
+    if (view != 0) {
         const QModelIndex proxyIndex = view->currentIndex();
         const QModelIndex dirModelIndex = m_viewAccessor.proxyModel()->mapToSource(proxyIndex);
         currentItem = m_viewAccessor.dirModel()->itemForIndex(dirModelIndex);
     }
 
     KUrl currentUrl;
         const QModelIndex proxyIndex = view->currentIndex();
         const QModelIndex dirModelIndex = m_viewAccessor.proxyModel()->mapToSource(proxyIndex);
         currentItem = m_viewAccessor.dirModel()->itemForIndex(dirModelIndex);
     }
 
     KUrl currentUrl;
-    if (!currentItem.isNull())
+    if (!currentItem.isNull()) {
         currentUrl = currentItem.url();
         currentUrl = currentItem.url();
+    }
 
     stream << currentUrl;
 
     // view position
 
     stream << currentUrl;
 
     // view position
-    stream << contentsPosition();
+    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();
 
     // expanded folders (only relevant for the details view - the set will be empty in other view modes)
     stream << m_viewAccessor.expandedUrls();
@@ -1139,21 +1106,6 @@ void DolphinView::selectAndScrollToCreatedItem()
     m_createdItemUrl = KUrl();
 }
 
     m_createdItemUrl = KUrl();
 }
 
-void DolphinView::emitContentsMoved()
-{
-    // TODO: If DolphinViewContainer uses DolphinView::saveState(...) to save the
-    // view state in KDE 4.5, the contentsMoved signal might not be needed anymore,
-    // depending on how the implementation is done.
-    // In that case, the code in contentsPosition() can be moved to saveState().
-
-    // only emit the contents moved signal if no directory loading is ongoing
-    // (this would reset the contents position always to (0, 0))
-    if (!m_loadingDirectory) {
-        const QPoint pos(contentsPosition());
-        emit contentsMoved(pos.x(), pos.y());
-    }
-}
-
 void DolphinView::showHoverInformation(const KFileItem& item)
 {
     emit requestItemInfo(item);
 void DolphinView::showHoverInformation(const KFileItem& item)
 {
     emit requestItemInfo(item);
@@ -1388,11 +1340,6 @@ void DolphinView::createView()
     connect(view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
             this, SLOT(slotSelectionChanged(const QItemSelection&, const QItemSelection&)));
 
     connect(view->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
             this, SLOT(slotSelectionChanged(const QItemSelection&, const QItemSelection&)));
 
-    connect(view->verticalScrollBar(), SIGNAL(valueChanged(int)),
-            this, SLOT(emitContentsMoved()));
-    connect(view->horizontalScrollBar(), SIGNAL(valueChanged(int)),
-            this, SLOT(emitContentsMoved()));
-
     setFocusProxy(m_viewAccessor.layoutTarget());
     m_topLayout->insertWidget(1, m_viewAccessor.layoutTarget());
 }
     setFocusProxy(m_viewAccessor.layoutTarget());
     m_topLayout->insertWidget(1, m_viewAccessor.layoutTarget());
 }
@@ -1415,10 +1362,6 @@ void DolphinView::deleteView()
         disconnect(view);
         m_controller->disconnect(view);
         view->disconnect();
         disconnect(view);
         m_controller->disconnect(view);
         view->disconnect();
-        disconnect(view->verticalScrollBar(), SIGNAL(valueChanged(int)),
-                   this, SLOT(emitContentsMoved()));
-        disconnect(view->horizontalScrollBar(), SIGNAL(valueChanged(int)),
-                   this, SLOT(emitContentsMoved()));
 
         m_viewAccessor.deleteView();
     }
 
         m_viewAccessor.deleteView();
     }
@@ -1651,8 +1594,16 @@ void DolphinView::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl)
 void DolphinView::restoreContentsPosition()
 {
     if (!m_restoredContentsPosition.isNull()) {
 void DolphinView::restoreContentsPosition()
 {
     if (!m_restoredContentsPosition.isNull()) {
-        setContentsPosition(m_restoredContentsPosition.x(), m_restoredContentsPosition.y());
+        const int x = m_restoredContentsPosition.x();
+        const int y = m_restoredContentsPosition.y();
         m_restoredContentsPosition = QPoint();
         m_restoredContentsPosition = QPoint();
+
+        QAbstractItemView* view = m_viewAccessor.itemView();
+        Q_ASSERT(view != 0);
+        view->horizontalScrollBar()->setValue(x);
+        view->verticalScrollBar()->setValue(y);
+
+        m_loadingDirectory = false;
     }
 }
 
     }
 }
 
index 17f1395acf8bf5acd6a96335ff3943f9dfea8410..6c2f9aaf29b53fd3f82144050c1a1c354c535b87 100644 (file)
@@ -208,23 +208,6 @@ public:
 
     QItemSelectionModel* selectionModel() const;
 
 
     QItemSelectionModel* selectionModel() const;
 
-    /**
-     * Sets the upper left position of the view content
-     * to (x,y). The content of the view might be larger than the visible area
-     * and hence a scrolling must be done.
-     */
-    void setContentsPosition(int x, int y);
-
-    /**
-     * Sets the upper left position of the view content
-     * to (x,y) after the directory loading is finished.
-     * This is useful when going back or forward in history.
-     */
-    void setRestoredContentsPosition(const QPoint& pos);
-
-    /** Returns the upper left position of the view content. */
-    QPoint contentsPosition() const;
-
     /**
      * Sets the zoom level to \a level. It is assured that the used
      * level is adjusted to be inside the range ZoomLevelInfo::minimumLevel() and
     /**
      * Sets the zoom level to \a level. It is assured that the used
      * level is adjusted to be inside the range ZoomLevelInfo::minimumLevel() and
@@ -279,16 +262,6 @@ public:
      */
     void refresh();
 
      */
     void refresh();
 
-    /**
-     * Changes the directory of the view to \a url. If \a rootUrl is empty, the view
-     * properties from \a url are used for adjusting the view mode and the other properties.
-     * If \a rootUrl is not empty, the view properties from the root URL are considered
-     * instead. Specifying a root URL is only required if a view having a different root URL
-     * (e. g. the column view) should be restored. Usually using DolphinView::setUrl()
-     * is enough for changing the current URL.
-     */
-    void updateView(const KUrl& url, const KUrl& rootUrl);
-
     /**
      * Filters the currently shown items by \a nameFilter. All items
      * which contain the given filter string will be shown.
     /**
      * Filters the currently shown items by \a nameFilter. All items
      * which contain the given filter string will be shown.
@@ -356,12 +329,12 @@ public:
     /**
      * Restores the view state (current item, contents position, details view expansion state)
      */
     /**
      * Restores the view state (current item, contents position, details view expansion state)
      */
-    void restoreState(QDataStream &stream);
+    void restoreState(QDataStreamstream);
 
     /**
      * Saves the view state (current item, contents position, details view expansion state)
      */
 
     /**
      * Saves the view state (current item, contents position, details view expansion state)
      */
-    void saveState(QDataStream &stream);
+    void saveState(QDataStreamstream);
 
 public slots:
     /**
 
 public slots:
     /**
@@ -523,9 +496,6 @@ signals:
      */
     void requestItemInfo(const KFileItem& item);
 
      */
     void requestItemInfo(const KFileItem& item);
 
-    /** Is emitted if the contents has been moved to \a x, \a y. */
-    void contentsMoved(int x, int y);
-
     /**
      * Is emitted whenever the selection has been changed.
      */
     /**
      * Is emitted whenever the selection has been changed.
      */
@@ -647,12 +617,6 @@ private slots:
      */
     void updateAdditionalInfo(const KFileItemDelegate::InformationList& info);
 
      */
     void updateAdditionalInfo(const KFileItemDelegate::InformationList& info);
 
-    /**
-     * Emits the signal contentsMoved with the current coordinates
-     * of the viewport as parameters.
-     */
-    void emitContentsMoved();
-
     /**
      * Updates the status bar to show hover information for the
      * item \a item. If currently other items are selected,
     /**
      * Updates the status bar to show hover information for the
      * item \a item. If currently other items are selected,
index 8ff1179ab8a1639e41574acc51b2ac0631430846..53b1c75293d05b103eef6d7787261cc4d1fc64b0 100644 (file)
@@ -55,7 +55,6 @@
 #include "dolphinsortfilterproxymodel.h"
 #include "dolphindetailsview.h"
 #include "dolphiniconsview.h"
 #include "dolphinsortfilterproxymodel.h"
 #include "dolphindetailsview.h"
 #include "dolphiniconsview.h"
-#include "dolphincontextmenu.h"
 #include "draganddrophelper.h"
 #include "filterbar.h"
 #include "statusbar/dolphinstatusbar.h"
 #include "draganddrophelper.h"
 #include "filterbar.h"
 #include "statusbar/dolphinstatusbar.h"
 #include "settings/dolphinsettings.h"
 #include "dolphin_generalsettings.h"
 
 #include "settings/dolphinsettings.h"
 #include "dolphin_generalsettings.h"
 
-DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
-                                           QWidget* parent,
-                                           const KUrl& url) :
+DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
     QWidget(parent),
     m_isFolderWritable(false),
     QWidget(parent),
     m_isFolderWritable(false),
-    m_mainWindow(mainWindow),
     m_topLayout(0),
     m_urlNavigator(0),
     m_view(0),
     m_topLayout(0),
     m_urlNavigator(0),
     m_view(0),
@@ -89,13 +85,15 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
             this, SLOT(dropUrls(const KUrl&, QDropEvent*)));
     connect(m_urlNavigator, SIGNAL(activated()),
             this, SLOT(activate()));
             this, SLOT(dropUrls(const KUrl&, QDropEvent*)));
     connect(m_urlNavigator, SIGNAL(activated()),
             this, SLOT(activate()));
+    //connect(m_urlNavigator, SIGNAL(tabRequested(const KUrl&)),
+    //        this,
     connect(m_urlNavigator->editor(), SIGNAL(completionModeChanged(KGlobalSettings::Completion)),
             this, SLOT(saveUrlCompletionMode(KGlobalSettings::Completion)));
 
     const GeneralSettings* settings = DolphinSettings::instance().generalSettings();
     m_urlNavigator->setUrlEditable(settings->editableUrl());
     m_urlNavigator->setShowFullPath(settings->showFullPath());
     connect(m_urlNavigator->editor(), SIGNAL(completionModeChanged(KGlobalSettings::Completion)),
             this, SLOT(saveUrlCompletionMode(KGlobalSettings::Completion)));
 
     const GeneralSettings* settings = DolphinSettings::instance().generalSettings();
     m_urlNavigator->setUrlEditable(settings->editableUrl());
     m_urlNavigator->setShowFullPath(settings->showFullPath());
-    m_urlNavigator->setHomeUrl(settings->homeUrl());
+    m_urlNavigator->setHomeUrl(KUrl(settings->homeUrl()));
     KUrlComboBox* editor = m_urlNavigator->editor();
     editor->setCompletionMode(KGlobalSettings::Completion(settings->urlCompletionMode()));
 
     KUrlComboBox* editor = m_urlNavigator->editor();
     editor->setCompletionMode(KGlobalSettings::Completion(settings->urlCompletionMode()));
 
@@ -132,10 +130,6 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
     m_view = new DolphinView(this, url, m_proxyModel);
     connect(m_view, SIGNAL(urlChanged(const KUrl&)),
             m_urlNavigator, SLOT(setUrl(const KUrl&)));
     m_view = new DolphinView(this, url, m_proxyModel);
     connect(m_view, SIGNAL(urlChanged(const KUrl&)),
             m_urlNavigator, SLOT(setUrl(const KUrl&)));
-    connect(m_view, SIGNAL(requestContextMenu(KFileItem, const KUrl&, const QList<QAction*>&)),
-            this, SLOT(openContextMenu(KFileItem, const KUrl&, const QList<QAction*>&)));
-    connect(m_view, SIGNAL(contentsMoved(int, int)),
-            this, SLOT(saveContentsPos(int, int)));
     connect(m_view, SIGNAL(requestItemInfo(KFileItem)),
             this, SLOT(showItemInfo(KFileItem)));
     connect(m_view, SIGNAL(errorMessage(const QString&)),
     connect(m_view, SIGNAL(requestItemInfo(KFileItem)),
             this, SLOT(showItemInfo(KFileItem)));
     connect(m_view, SIGNAL(errorMessage(const QString&)),
@@ -146,15 +140,15 @@ DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
             this, SLOT(showOperationCompletedMessage(const QString&)));
     connect(m_view, SIGNAL(itemTriggered(KFileItem)),
             this, SLOT(slotItemTriggered(KFileItem)));
             this, SLOT(showOperationCompletedMessage(const QString&)));
     connect(m_view, SIGNAL(itemTriggered(KFileItem)),
             this, SLOT(slotItemTriggered(KFileItem)));
-    connect(m_view, SIGNAL(startedPathLoading(const KUrl&)),
-            this, SLOT(saveRootUrl(const KUrl&)));
     connect(m_view, SIGNAL(redirection(KUrl, KUrl)),
             this, SLOT(redirect(KUrl, KUrl)));
     connect(m_view, SIGNAL(selectionChanged(const KFileItemList&)),
             this, SLOT(delayedStatusBarUpdate()));
 
     connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)),
     connect(m_view, SIGNAL(redirection(KUrl, KUrl)),
             this, SLOT(redirect(KUrl, KUrl)));
     connect(m_view, SIGNAL(selectionChanged(const KFileItemList&)),
             this, SLOT(delayedStatusBarUpdate()));
 
     connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)),
-            this, SLOT(restoreView(const KUrl&)));
+            this, SLOT(slotUrlNavigatorLocationChanged(const KUrl&)));
+    connect(m_urlNavigator, SIGNAL(urlAboutToBeChanged(const KUrl&)),
+            this, SLOT(saveViewState()));
     connect(m_urlNavigator, SIGNAL(historyChanged()),
             this, SLOT(slotHistoryChanged()));
 
     connect(m_urlNavigator, SIGNAL(historyChanged()),
             this, SLOT(slotHistoryChanged()));
 
@@ -197,9 +191,9 @@ DolphinViewContainer::~DolphinViewContainer()
     m_dirLister = 0; // deleted by m_dolphinModel
 }
 
     m_dirLister = 0; // deleted by m_dolphinModel
 }
 
-const KUrl& DolphinViewContainer::url() const
+KUrl DolphinViewContainer::url() const
 {
 {
-    return m_urlNavigator->url();
+    return m_urlNavigator->locationUrl();
 }
 
 void DolphinViewContainer::setActive(bool active)
 }
 
 void DolphinViewContainer::setActive(bool active)
@@ -207,7 +201,7 @@ void DolphinViewContainer::setActive(bool active)
     m_urlNavigator->setActive(active);
     m_view->setActive(active);
     if (active) {
     m_urlNavigator->setActive(active);
     m_view->setActive(active);
     if (active) {
-        m_mainWindow->newMenu()->menu()->setEnabled(m_isFolderWritable);
+        emit writeStateChanged(m_isFolderWritable);
     }
 }
 
     }
 }
 
@@ -230,14 +224,14 @@ bool DolphinViewContainer::isFilterBarVisible() const
 
 void DolphinViewContainer::setUrl(const KUrl& newUrl)
 {
 
 void DolphinViewContainer::setUrl(const KUrl& newUrl)
 {
-    if (newUrl != m_urlNavigator->url()) {
-        m_urlNavigator->setUrl(newUrl);
+    if (newUrl != m_urlNavigator->locationUrl()) {
+        m_urlNavigator->setLocationUrl(newUrl);
         // Temporary disable the 'File'->'Create New...' menu until
         // the write permissions can be checked in a fast way at
         // DolphinViewContainer::slotDirListerCompleted().
         m_isFolderWritable = false;
         if (isActive()) {
         // Temporary disable the 'File'->'Create New...' menu until
         // the write permissions can be checked in a fast way at
         // DolphinViewContainer::slotDirListerCompleted().
         m_isFolderWritable = false;
         if (isActive()) {
-            m_mainWindow->newMenu()->menu()->setEnabled(false);
+            emit writeStateChanged(false);
         }
     }
 }
         }
     }
 }
@@ -252,11 +246,6 @@ void DolphinViewContainer::showFilterBar(bool show)
     }
 }
 
     }
 }
 
-bool DolphinViewContainer::isUrlEditable() const
-{
-    return m_urlNavigator->isUrlEditable();
-}
-
 void DolphinViewContainer::delayedStatusBarUpdate()
 {
     // Invoke updateStatusBar() with a small delay. This assures that
 void DolphinViewContainer::delayedStatusBarUpdate()
 {
     // Invoke updateStatusBar() with a small delay. This assures that
@@ -320,6 +309,7 @@ void DolphinViewContainer::slotDirListerCompleted()
     } else {
         updateStatusBar();
     }
     } else {
         updateStatusBar();
     }
+    QMetaObject::invokeMethod(this, "restoreViewState", Qt::QueuedConnection);
 
     // Enable the 'File'->'Create New...' menu only if the directory
     // supports writing.
 
     // Enable the 'File'->'Create New...' menu only if the directory
     // supports writing.
@@ -333,7 +323,7 @@ void DolphinViewContainer::slotDirListerCompleted()
     }
 
     if (isActive()) {
     }
 
     if (isActive()) {
-        m_mainWindow->newMenu()->menu()->setEnabled(m_isFolderWritable);
+        emit writeStateChanged(m_isFolderWritable);
     }
 }
 
     }
 }
 
@@ -381,31 +371,30 @@ void DolphinViewContainer::setNameFilter(const QString& nameFilter)
     delayedStatusBarUpdate();
 }
 
     delayedStatusBarUpdate();
 }
 
-void DolphinViewContainer::openContextMenu(const KFileItem& item,
-                                           const KUrl& url,
-                                           const QList<QAction*>& customActions)
+void DolphinViewContainer::restoreViewState()
 {
 {
-    DolphinContextMenu contextMenu(m_mainWindow, item, url);
-    contextMenu.setCustomActions(customActions);
-    contextMenu.open();
+    QByteArray locationState = m_urlNavigator->locationState();
+    QDataStream stream(&locationState, QIODevice::ReadOnly);
+    m_view->restoreState(stream);
 }
 
 }
 
-void DolphinViewContainer::saveContentsPos(int x, int y)
+void DolphinViewContainer::activate()
 {
 {
-    // TODO: If DolphinViewContainer uses DolphinView::saveState(...) to save the
-    // view state in KDE 4.5, this funciton can be removed.
-    m_urlNavigator->savePosition(x, y);
+    setActive(true);
 }
 
 }
 
-void DolphinViewContainer::activate()
+void DolphinViewContainer::saveViewState()
 {
 {
-    setActive(true);
+    QByteArray locationState;
+    QDataStream stream(&locationState, QIODevice::WriteOnly);
+    m_view->saveState(stream);
+    m_urlNavigator->saveLocationState(locationState);
 }
 
 }
 
-void DolphinViewContainer::restoreView(const KUrl& url)
+void DolphinViewContainer::slotUrlNavigatorLocationChanged(const KUrl& url)
 {
     if (KProtocolManager::supportsListing(url)) {
 {
     if (KProtocolManager::supportsListing(url)) {
-        m_view->updateView(url, m_urlNavigator->savedRootUrl());
+        m_view->setUrl(url);
         if (isActive()) {
             // When an URL has been entered, the view should get the focus.
             // The focus must be requested asynchronously, as changing the URL might create
         if (isActive()) {
             // When an URL has been entered, the view should get the focus.
             // The focus must be requested asynchronously, as changing the URL might create
@@ -443,12 +432,6 @@ void DolphinViewContainer::restoreView(const KUrl& url)
     }
 }
 
     }
 }
 
-void DolphinViewContainer::saveRootUrl(const KUrl& url)
-{
-    Q_UNUSED(url);
-    m_urlNavigator->saveRootUrl(m_view->rootUrl());
-}
-
 void DolphinViewContainer::dropUrls(const KUrl& destination, QDropEvent* event)
 {
     DragAndDropHelper::instance().dropUrls(KFileItem(), destination, event, this);
 void DolphinViewContainer::dropUrls(const KUrl& destination, QDropEvent* event)
 {
     DragAndDropHelper::instance().dropUrls(KFileItem(), destination, event, this);
@@ -459,7 +442,7 @@ void DolphinViewContainer::redirect(const KUrl& oldUrl, const KUrl& newUrl)
     Q_UNUSED(oldUrl);
     const bool block = m_urlNavigator->signalsBlocked();
     m_urlNavigator->blockSignals(true);
     Q_UNUSED(oldUrl);
     const bool block = m_urlNavigator->signalsBlocked();
     m_urlNavigator->blockSignals(true);
-    m_urlNavigator->setUrl(newUrl);
+    m_urlNavigator->setLocationUrl(newUrl);
     m_urlNavigator->blockSignals(block);
 }
 
     m_urlNavigator->blockSignals(block);
 }
 
@@ -478,13 +461,11 @@ void DolphinViewContainer::saveUrlCompletionMode(KGlobalSettings::Completion com
 void DolphinViewContainer::slotHistoryChanged()
 {
     const int index = m_urlNavigator->historyIndex();
 void DolphinViewContainer::slotHistoryChanged()
 {
     const int index = m_urlNavigator->historyIndex();
-    if (index > 0) {
+    if (index > 0) {       
         // The "Go Forward" action is enabled. Try to mark
         // the previous directory as active item:
         // The "Go Forward" action is enabled. Try to mark
         // the previous directory as active item:
-        const KUrl url = m_urlNavigator->historyUrl(index - 1);
+        const KUrl url = m_urlNavigator->locationUrl(index - 1);
         m_view->activateItem(url);
         m_view->activateItem(url);
-        QPoint pos = m_urlNavigator->savedPosition();
-        m_view->setRestoredContentsPosition(pos);
     }
 }
 
     }
 }
 
index 0f2ab9aad387ab8b61d55cccb87d126ed772f514..ce5badfa286bc9224e649bb923bc6646d2bbeb13 100644 (file)
@@ -41,7 +41,6 @@ class KUrl;
 class DolphinModel;
 class KUrlNavigator;
 class DolphinDirLister;
 class DolphinModel;
 class KUrlNavigator;
 class DolphinDirLister;
-class DolphinMainWindow;
 class DolphinSortFilterProxyModel;
 class DolphinStatusBar;
 
 class DolphinSortFilterProxyModel;
 class DolphinStatusBar;
 
@@ -62,17 +61,14 @@ class DolphinViewContainer : public QWidget
     Q_OBJECT
 
 public:
     Q_OBJECT
 
 public:
-    DolphinViewContainer(DolphinMainWindow* mainwindow,
-                         QWidget *parent,
-                         const KUrl& url);
-
+    DolphinViewContainer(const KUrl& url, QWidget* parent);
     virtual ~DolphinViewContainer();
 
     /**
      * Returns the current active URL, where all actions are applied.
      * The URL navigator is synchronized with this URL.
      */
     virtual ~DolphinViewContainer();
 
     /**
      * Returns the current active URL, where all actions are applied.
      * The URL navigator is synchronized with this URL.
      */
-    const KUrl& url() const;
+    KUrl url() const;
 
     /**
      * If \a active is true, the view container will marked as active. The active
 
     /**
      * If \a active is true, the view container will marked as active. The active
@@ -84,12 +80,6 @@ public:
     const DolphinStatusBar* statusBar() const;
     DolphinStatusBar* statusBar();
 
     const DolphinStatusBar* statusBar() const;
     DolphinStatusBar* statusBar();
 
-    /**
-     * Returns true, if the URL shown by the navigation bar is editable.
-     * @see KUrlNavigator
-     */
-    bool isUrlEditable() const;
-
     const KUrlNavigator* urlNavigator() const;
     KUrlNavigator* urlNavigator();
 
     const KUrlNavigator* urlNavigator() const;
     KUrlNavigator* urlNavigator();
 
@@ -125,6 +115,13 @@ signals:
      */
     void showFilterBarChanged(bool shown);
 
      */
     void showFilterBarChanged(bool shown);
 
+    /**
+     * Is emitted when the write state of the folder has been changed. The application
+     * should disable all actions like "Create New..." that depend on the write
+     * state.
+     */
+    void writeStateChanged(bool isFolderWritable);
+
 private slots:
     /**
      * Updates the number of items (= number of files + number of
 private slots:
     /**
      * Updates the number of items (= number of files + number of
@@ -188,23 +185,7 @@ private slots:
      */
     void setNameFilter(const QString& nameFilter);
 
      */
     void setNameFilter(const QString& nameFilter);
 
-    /**
-     * Opens the context menu on the current mouse position.
-     * @item          File item context. If item is null, the context menu
-     *                should be applied to \a url.
-     * @url           URL which contains \a item.
-     * @customActions Actions that should be added to the context menu,
-     *                if the file item is null.
-     */
-    void openContextMenu(const KFileItem& item,
-                         const KUrl& url,
-                         const QList<QAction*>& customActions);
-
-    /**
-     * Saves the position of the contents to the
-     * current history element.
-     */
-    void saveContentsPos(int x, int y);
+    void restoreViewState();
 
     /**
      * Marks the view container as active
 
     /**
      * Marks the view container as active
@@ -213,16 +194,16 @@ private slots:
     void activate();
 
     /**
     void activate();
 
     /**
-     * Restores the current view to show \a url and assures
-     * that the root URL of the view is respected.
+     * Saves the state of the current view: contents position,
+     * root URL, ...
      */
      */
-    void restoreView(const KUrl& url);
+    void saveViewState();
 
     /**
 
     /**
-     * Saves the root URL of the current URL \a url
-     * into the URL navigator.
+     * Restores the current view to show \a url and assures
+     * that the root URL of the view is respected.
      */
      */
-    void saveRootUrl(const KUrl& url);
+    void slotUrlNavigatorLocationChanged(const KUrl& url);
 
     /**
      * Is connected with the URL navigator and drops the URLs
 
     /**
      * Is connected with the URL navigator and drops the URLs
@@ -251,7 +232,6 @@ private slots:
 private:
     bool m_isFolderWritable;
 
 private:
     bool m_isFolderWritable;
 
-    DolphinMainWindow* m_mainWindow;
     QVBoxLayout* m_topLayout;
     KUrlNavigator* m_urlNavigator;
 
     QVBoxLayout* m_topLayout;
     KUrlNavigator* m_urlNavigator;