]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
Allow compiling Dolphin with KF5
[dolphin.git] / src / dolphinmainwindow.cpp
index 01cc62fcebd6df9b8eb941188e50e4cb8029efa3..1fd9903442b7cbef1ba28574fad08912f55ceea7 100644 (file)
@@ -35,6 +35,7 @@
 #include "views/dolphinremoteencoding.h"
 #include "views/draganddrophelper.h"
 #include "views/viewproperties.h"
+#include "views/dolphinnewfilemenuobserver.h"
 
 #ifndef Q_OS_WIN
 #include "panels/terminal/terminalpanel.h"
 #include <kdeversion.h>
 #include <kdualaction.h>
 #include <KFileDialog>
-#include <KFilePlacesModel>
 #include <KGlobal>
+#include <KDialog>
+#include <KJobWidgets>
+#include <KMimeType>
 #include <KLineEdit>
 #include <KToolBar>
 #include <KIcon>
 #include <KUrlComboBox>
 #include <KToolInvocation>
 
-#include "views/dolphinplacesmodel.h"
-
 #include <QDesktopWidget>
 #include <QDBusMessage>
 #include <QKeyEvent>
 #include <QClipboard>
 #include <QToolButton>
 #include <QSplitter>
+#include <QTimer>
+#include <QPushButton>
 
 namespace {
     // Used for GeneralSettings::version() to determine whether
@@ -123,21 +126,15 @@ DolphinMainWindow::DolphinMainWindow() :
     m_updateToolBarTimer(0),
     m_lastHandleUrlStatJob(0)
 {
-    DolphinPlacesModel::setModel(new KFilePlacesModel(this));
-    connect(DolphinPlacesModel::instance(), SIGNAL(errorMessage(QString)),
-            this, SLOT(showErrorMessage(QString)));
-
-    // Workaround for a X11-issue in combination with KModifierInfo
-    // (see DolphinContextMenu::initializeModifierKeyInfo() for
-    // more information):
-    DolphinContextMenu::initializeModifierKeyInfo();
-
     setObjectName("Dolphin#");
 
     m_viewTab.append(ViewTab());
     ViewTab& viewTab = m_viewTab[m_tabIndex];
     viewTab.wasActive = true; // The first opened tab is automatically active
 
+    connect(&DolphinNewFileMenuObserver::instance(), SIGNAL(errorMessage(QString)),
+            this, SLOT(showErrorMessage(QString)));
+
     KIO::FileUndoManager* undoManager = KIO::FileUndoManager::self();
     undoManager->setUiInterface(new UndoUiInterface());
 
@@ -266,12 +263,12 @@ void DolphinMainWindow::openDirectories(const QList<KUrl>& dirs)
 
     // Open each directory inside a new tab. If the "split view" option has been enabled,
     // always show two directories within one tab.
-    QList<KUrl>::const_iterator it = dirs.begin();
-    while (it != dirs.end()) {
+    QList<KUrl>::const_iterator it = dirs.constBegin();
+    while (it != dirs.constEnd()) {
         openNewTab(*it);
         ++it;
 
-        if (hasSplitView && (it != dirs.end())) {
+        if (hasSplitView && (it != dirs.constEnd())) {
             const int tabIndex = m_viewTab.count() - 1;
             m_viewTab[tabIndex].secondaryView->setUrl(*it);
             ++it;
@@ -376,6 +373,13 @@ void DolphinMainWindow::changeUrl(const KUrl& url)
     }
 }
 
+void DolphinMainWindow::slotTerminalDirectoryChanged(const KUrl& url)
+{
+    m_activeViewContainer->setAutoGrabFocus(false);
+    changeUrl(url);
+    m_activeViewContainer->setAutoGrabFocus(true);
+}
+
 void DolphinMainWindow::slotEditableStateChanged(bool editable)
 {
     KToggleAction* editableLocationAction =
@@ -434,7 +438,7 @@ void DolphinMainWindow::updateFilterBarAction(bool show)
 
 void DolphinMainWindow::openNewMainWindow()
 {
-    KRun::run("dolphin", KUrl::List(), this);
+    KRun::run("dolphin %u", KUrl::List(), this);
 }
 
 void DolphinMainWindow::openNewTab()
@@ -525,11 +529,16 @@ void DolphinMainWindow::activatePrevTab()
 
 void DolphinMainWindow::openInNewTab()
 {
-    const KFileItemList list = m_activeViewContainer->view()->selectedItems();
+    const KFileItemList& list = m_activeViewContainer->view()->selectedItems();
     if (list.isEmpty()) {
         openNewTab(m_activeViewContainer->url());
-    } else if ((list.count() == 1) && list[0].isDir()) {
-        openNewTab(list[0].url());
+    } else {
+        foreach (const KFileItem& item, list) {
+            const KUrl& url = DolphinView::openItemAsFolderUrl(item);
+            if (!url.isEmpty()) {
+                openNewTab(url);
+            }
+        }
     }
 }
 
@@ -540,12 +549,13 @@ void DolphinMainWindow::openInNewWindow()
     const KFileItemList list = m_activeViewContainer->view()->selectedItems();
     if (list.isEmpty()) {
         newWindowUrl = m_activeViewContainer->url();
-    } else if ((list.count() == 1) && list[0].isDir()) {
-        newWindowUrl = list[0].url();
+    } else if (list.count() == 1) {
+        const KFileItem& item = list.first();
+        newWindowUrl = DolphinView::openItemAsFolderUrl(item);
     }
 
     if (!newWindowUrl.isEmpty()) {
-        KRun::run("dolphin", KUrl::List() << newWindowUrl, this);
+        KRun::run("dolphin %u", QList<QUrl>() << newWindowUrl, this);
     }
 }
 
@@ -588,18 +598,19 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
         // KDialog::Yes    -> Quit
         // KDialog::No     -> Close only the current tab
         // KDialog::Cancel -> do nothing
-        KDialog *dialog = new KDialog(this, Qt::Dialog);
-        dialog->setCaption(i18nc("@title:window", "Confirmation"));
-        dialog->setButtons(KDialog::Yes | KDialog::No | KDialog::Cancel);
+        QDialog *dialog = new QDialog(this, Qt::Dialog);
+        dialog->setWindowTitle(i18nc("@title:window", "Confirmation"));
         dialog->setModal(true);
-        dialog->setButtonGuiItem(KDialog::Yes, KStandardGuiItem::quit());
-        dialog->setButtonGuiItem(KDialog::No, KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")));
-        dialog->setButtonGuiItem(KDialog::Cancel, KStandardGuiItem::cancel());
-        dialog->setDefaultButton(KDialog::Yes);
+        QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No | QDialogButtonBox::Cancel);
+        KGuiItem::assign(buttons->button(QDialogButtonBox::Yes), KStandardGuiItem::quit());
+        KGuiItem::assign(buttons->button(QDialogButtonBox::No), KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")));
+        KGuiItem::assign(buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
+        buttons->button(QDialogButtonBox::Yes)->setDefault(true);
 
         bool doNotAskAgainCheckboxResult = false;
 
         const int result = KMessageBox::createKMessageBox(dialog,
+            buttons,
             QMessageBox::Warning,
             i18n("You have multiple tabs open in this window, are you sure you want to quit?"),
             QStringList(),
@@ -617,7 +628,7 @@ void DolphinMainWindow::closeEvent(QCloseEvent* event)
                 break;
             case KDialog::No:
                 // Close only the current tab
-              closeTab();
+                closeTab();
             default:
                 event->ignore();
                 return;
@@ -672,6 +683,13 @@ void DolphinMainWindow::readProperties(const KConfigGroup& group)
                 Q_ASSERT(cont);
             }
 
+            // The right view must be activated before the URL is set. Changing
+            // the URL in the right view will emit the right URL navigator's
+            // urlChanged(KUrl) signal, which is connected to the changeUrl(KUrl)
+            // slot. That slot will change the URL in the left view if it is still
+            // active. See https://bugs.kde.org/show_bug.cgi?id=330047.
+            setActiveViewContainer(cont);
+
             cont->setUrl(secondaryUrl);
             const bool editable = group.readEntry(tabProperty("Secondary Editable", i), false);
             cont->urlNavigator()->setUrlEditable(editable);
@@ -683,7 +701,7 @@ void DolphinMainWindow::readProperties(const KConfigGroup& group)
 
         // openNewTab() needs to be called only tabCount - 1 times
         if (i != tabCount - 1) {
-             openNewTab();
+            openNewTab();
         }
     }
 
@@ -985,50 +1003,23 @@ void DolphinMainWindow::goHome(Qt::MouseButtons buttons)
 
 void DolphinMainWindow::compareFiles()
 {
-    // The method is only invoked if exactly 2 files have
-    // been selected. The selected files may be:
-    // - both in the primary view
-    // - both in the secondary view
-    // - one in the primary view and the other in the secondary
-    //   view
-    Q_ASSERT(m_viewTab[m_tabIndex].primaryView);
-
-    KUrl urlA;
-    KUrl urlB;
+    const DolphinViewContainer* primaryViewContainer = m_viewTab[m_tabIndex].primaryView;
+    Q_ASSERT(primaryViewContainer);
+    KFileItemList items = primaryViewContainer->view()->selectedItems();
 
-    KFileItemList items = m_viewTab[m_tabIndex].primaryView->view()->selectedItems();
-
-    switch (items.count()) {
-    case 0: {
-        Q_ASSERT(m_viewTab[m_tabIndex].secondaryView);
-        items = m_viewTab[m_tabIndex].secondaryView->view()->selectedItems();
-        Q_ASSERT(items.count() == 2);
-        urlA = items[0].url();
-        urlB = items[1].url();
-        break;
-    }
-
-    case 1: {
-        urlA = items[0].url();
-        Q_ASSERT(m_viewTab[m_tabIndex].secondaryView);
-        items = m_viewTab[m_tabIndex].secondaryView->view()->selectedItems();
-        Q_ASSERT(items.count() == 1);
-        urlB = items[0].url();
-        break;
+    const DolphinViewContainer* secondaryViewContainer = m_viewTab[m_tabIndex].secondaryView;
+    if (secondaryViewContainer) {
+        items.append(secondaryViewContainer->view()->selectedItems());
     }
 
-    case 2: {
-        urlA = items[0].url();
-        urlB = items[1].url();
-        break;
+    if (items.count() != 2) {
+        // The action is disabled in this case, but it could have been triggered
+        // via D-Bus, see https://bugs.kde.org/show_bug.cgi?id=325517
+        return;
     }
 
-    default: {
-        // may not happen: compareFiles may only get invoked if 2
-        // files are selected
-        Q_ASSERT(false);
-    }
-    }
+    KUrl urlA = items.at(0).url();
+    KUrl urlB = items.at(1).url();
 
     QString command("kompare -c \"");
     command.append(urlA.pathOrUrl());
@@ -1247,7 +1238,7 @@ void DolphinMainWindow::handleUrl(const KUrl& url)
         // stat the URL to see if it is a dir or not
         m_lastHandleUrlStatJob = KIO::stat(url, KIO::HideProgressInfo);
         if (m_lastHandleUrlStatJob->ui()) {
-            m_lastHandleUrlStatJob->ui()->setWindow(this);
+            KJobWidgets::setWindow(m_lastHandleUrlStatJob, this);
         }
         connect(m_lastHandleUrlStatJob, SIGNAL(result(KJob*)),
                 this, SLOT(slotHandleUrlStatFinished(KJob*)));
@@ -1276,7 +1267,8 @@ void DolphinMainWindow::tabDropEvent(int tab, QDropEvent* event)
         const ViewTab& viewTab = m_viewTab[tab];
         const DolphinView* view = viewTab.isPrimaryViewActive ? viewTab.primaryView->view()
                                                               : viewTab.secondaryView->view();
-        const QString error = DragAndDropHelper::dropUrls(view->rootItem(), view->url(), event);
+        QString error;
+        DragAndDropHelper::dropUrls(view->rootItem(), view->url(), event, error);
         if (!error.isEmpty()) {
             activeViewContainer()->showMessage(error, DolphinViewContainer::Error);
         }
@@ -1299,12 +1291,13 @@ void DolphinMainWindow::openContextMenu(const QPoint& pos,
 
     switch (command) {
     case DolphinContextMenu::OpenParentFolderInNewWindow: {
-        KRun::run("dolphin", KUrl::List() << item.url().upUrl(), this);
+
+        KRun::run("dolphin %u", QList<QUrl>() << KIO::upUrl(item.url()), this);
         break;
     }
 
     case DolphinContextMenu::OpenParentFolderInNewTab:
-        openNewTab(item.url().upUrl());
+        openNewTab(KIO::upUrl(item.url()));
         break;
 
     case DolphinContextMenu::None:
@@ -1424,6 +1417,24 @@ void DolphinMainWindow::slotControlButtonDeleted()
     m_updateToolBarTimer->start();
 }
 
+void DolphinMainWindow::slotPanelErrorMessage(const QString& error)
+{
+    activeViewContainer()->showMessage(error, DolphinViewContainer::Error);
+}
+
+void DolphinMainWindow::slotPlaceActivated(const KUrl& url)
+{
+    DolphinViewContainer* view = activeViewContainer();
+
+    if (view->url() == url) {
+        // We can end up here if the user clicked a device in the Places Panel
+        // which had been unmounted earlier, see https://bugs.kde.org/show_bug.cgi?id=161385.
+        reloadView();
+    } else {
+        changeUrl(url);
+    }
+}
+
 void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContainer)
 {
     Q_ASSERT(viewContainer);
@@ -1475,26 +1486,27 @@ DolphinViewContainer* DolphinMainWindow::createViewContainer(const KUrl& url, QW
 void DolphinMainWindow::setupActions()
 {
     // setup 'File' menu
-    m_newFileMenu = new DolphinNewFileMenu(this);
-    KMenu* menu = m_newFileMenu->menu();
+    m_newFileMenu = new DolphinNewFileMenu(actionCollection(), this);
+    QMenu* menu = m_newFileMenu->menu();
     menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
     menu->setIcon(KIcon("document-new"));
+    m_newFileMenu->setDelayed(false);
     connect(menu, SIGNAL(aboutToShow()),
             this, SLOT(updateNewMenu()));
 
-    KAction* newWindow = actionCollection()->addAction("new_window");
+    QAction* newWindow = actionCollection()->addAction("new_window");
     newWindow->setIcon(KIcon("window-new"));
     newWindow->setText(i18nc("@action:inmenu File", "New &Window"));
     newWindow->setShortcut(Qt::CTRL | Qt::Key_N);
     connect(newWindow, SIGNAL(triggered()), this, SLOT(openNewMainWindow()));
 
-    KAction* newTab = actionCollection()->addAction("new_tab");
+    QAction* newTab = actionCollection()->addAction("new_tab");
     newTab->setIcon(KIcon("tab-new"));
     newTab->setText(i18nc("@action:inmenu File", "New Tab"));
-    newTab->setShortcut(KShortcut(Qt::CTRL | Qt::Key_T, Qt::CTRL | Qt::SHIFT | Qt::Key_N));
+    newTab->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL | Qt::Key_T) << QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N));
     connect(newTab, SIGNAL(triggered()), this, SLOT(openNewTab()));
 
-    KAction* closeTab = actionCollection()->addAction("close_tab");
+    QAction* closeTab = actionCollection()->addAction("close_tab");
     closeTab->setIcon(KIcon("tab-close"));
     closeTab->setText(i18nc("@action:inmenu File", "Close Tab"));
     closeTab->setShortcut(Qt::CTRL | Qt::Key_W);
@@ -1510,12 +1522,12 @@ void DolphinMainWindow::setupActions()
 
     // need to remove shift+del from cut action, else the shortcut for deletejob
     // doesn't work
-    KAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection());
-    KShortcut cutShortcut = cut->shortcut();
-    cutShortcut.remove(Qt::SHIFT | Qt::Key_Delete, KShortcut::KeepEmpty);
-    cut->setShortcut(cutShortcut);
+    QAction* cut = KStandardAction::cut(this, SLOT(cut()), actionCollection());
+    auto cutShortcuts = cut->shortcuts();
+    cutShortcuts.removeAll(QKeySequence(Qt::SHIFT | Qt::Key_Delete));
+    cut->setShortcuts(cutShortcuts);
     KStandardAction::copy(this, SLOT(copy()), actionCollection());
-    KAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection());
+    QAction* paste = KStandardAction::paste(this, SLOT(paste()), actionCollection());
     // The text of the paste-action is modified dynamically by Dolphin
     // (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes
     // due to the long text, the text "Paste" is used:
@@ -1523,12 +1535,12 @@ void DolphinMainWindow::setupActions()
 
     KStandardAction::find(this, SLOT(find()), actionCollection());
 
-    KAction* selectAll = actionCollection()->addAction("select_all");
+    QAction* selectAll = actionCollection()->addAction("select_all");
     selectAll->setText(i18nc("@action:inmenu Edit", "Select All"));
     selectAll->setShortcut(Qt::CTRL | Qt::Key_A);
     connect(selectAll, SIGNAL(triggered()), this, SLOT(selectAll()));
 
-    KAction* invertSelection = actionCollection()->addAction("invert_selection");
+    QAction* invertSelection = actionCollection()->addAction("invert_selection");
     invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
     invertSelection->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_A);
     connect(invertSelection, SIGNAL(triggered()), this, SLOT(invertSelection()));
@@ -1536,18 +1548,18 @@ void DolphinMainWindow::setupActions()
     // setup 'View' menu
     // (note that most of it is set up in DolphinViewActionHandler)
 
-    KAction* split = actionCollection()->addAction("split_view");
+    QAction* split = actionCollection()->addAction("split_view");
     split->setShortcut(Qt::Key_F3);
     updateSplitAction();
     connect(split, SIGNAL(triggered()), this, SLOT(toggleSplitView()));
 
-    KAction* reload = actionCollection()->addAction("reload");
+    QAction* reload = actionCollection()->addAction("reload");
     reload->setText(i18nc("@action:inmenu View", "Reload"));
     reload->setShortcut(Qt::Key_F5);
     reload->setIcon(KIcon("view-refresh"));
     connect(reload, SIGNAL(triggered()), this, SLOT(reloadView()));
 
-    KAction* stop = actionCollection()->addAction("stop");
+    QAction* stop = actionCollection()->addAction("stop");
     stop->setText(i18nc("@action:inmenu View", "Stop"));
     stop->setToolTip(i18nc("@info", "Stop loading"));
     stop->setIcon(KIcon("process-stop"));
@@ -1555,23 +1567,24 @@ void DolphinMainWindow::setupActions()
 
     KToggleAction* editableLocation = actionCollection()->add<KToggleAction>("editable_location");
     editableLocation->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
-    editableLocation->setShortcut(Qt::CTRL | Qt::Key_L);
+    editableLocation->setShortcut(Qt::Key_F6);
     connect(editableLocation, SIGNAL(triggered()), this, SLOT(toggleEditLocation()));
 
-    KAction* replaceLocation = actionCollection()->addAction("replace_location");
+    QAction* replaceLocation = actionCollection()->addAction("replace_location");
     replaceLocation->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
-    replaceLocation->setShortcut(Qt::Key_F6);
+    replaceLocation->setShortcut(Qt::CTRL | Qt::Key_L);
     connect(replaceLocation, SIGNAL(triggered()), this, SLOT(replaceLocation()));
 
     // setup 'Go' menu
-    KAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
+    QAction* backAction = KStandardAction::back(this, SLOT(goBack()), actionCollection());
     connect(backAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goBack(Qt::MouseButtons)));
-    KShortcut backShortcut = backAction->shortcut();
-    backShortcut.setAlternate(Qt::Key_Backspace);
-    backAction->setShortcut(backShortcut);
+    auto backShortcuts = backAction->shortcuts();
+    backShortcuts.append(QKeySequence(Qt::Key_Backspace));
+    backAction->setShortcuts(backShortcuts);
 
     m_recentTabsMenu = new KActionMenu(i18n("Recently Closed Tabs"), this);
     m_recentTabsMenu->setIcon(KIcon("edit-undo"));
+    m_recentTabsMenu->setDelayed(false);
     actionCollection()->addAction("closed_tabs", m_recentTabsMenu);
     connect(m_recentTabsMenu->menu(), SIGNAL(triggered(QAction*)),
             this, SLOT(restoreClosedTab(QAction*)));
@@ -1583,29 +1596,29 @@ void DolphinMainWindow::setupActions()
     m_recentTabsMenu->addSeparator();
     m_recentTabsMenu->setEnabled(false);
 
-    KAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection());
+    QAction* forwardAction = KStandardAction::forward(this, SLOT(goForward()), actionCollection());
     connect(forwardAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goForward(Qt::MouseButtons)));
 
-    KAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection());
+    QAction* upAction = KStandardAction::up(this, SLOT(goUp()), actionCollection());
     connect(upAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goUp(Qt::MouseButtons)));
 
-    KAction* homeAction = KStandardAction::home(this, SLOT(goHome()), actionCollection());
+    QAction* homeAction = KStandardAction::home(this, SLOT(goHome()), actionCollection());
     connect(homeAction, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), this, SLOT(goHome(Qt::MouseButtons)));
 
     // setup 'Tools' menu
-    KAction* showFilterBar = actionCollection()->addAction("show_filter_bar");
+    QAction* showFilterBar = actionCollection()->addAction("show_filter_bar");
     showFilterBar->setText(i18nc("@action:inmenu Tools", "Show Filter Bar"));
     showFilterBar->setIcon(KIcon("view-filter"));
     showFilterBar->setShortcut(Qt::CTRL | Qt::Key_I);
     connect(showFilterBar, SIGNAL(triggered()), this, SLOT(showFilterBar()));
 
-    KAction* compareFiles = actionCollection()->addAction("compare_files");
+    QAction* compareFiles = actionCollection()->addAction("compare_files");
     compareFiles->setText(i18nc("@action:inmenu Tools", "Compare Files"));
     compareFiles->setIcon(KIcon("kompare"));
     compareFiles->setEnabled(false);
     connect(compareFiles, SIGNAL(triggered()), this, SLOT(compareFiles()));
 
-    KAction* openTerminal = actionCollection()->addAction("open_terminal");
+    QAction* openTerminal = actionCollection()->addAction("open_terminal");
     openTerminal->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
     openTerminal->setIcon(KIcon("utilities-terminal"));
     openTerminal->setShortcut(Qt::SHIFT | Qt::Key_F4);
@@ -1619,30 +1632,35 @@ void DolphinMainWindow::setupActions()
 
     // not in menu actions
     QList<QKeySequence> nextTabKeys;
-    nextTabKeys.append(KStandardShortcut::tabNext().primary());
+    nextTabKeys.append(KStandardShortcut::tabNext().first()); //TODO: is this correct
     nextTabKeys.append(QKeySequence(Qt::CTRL | Qt::Key_Tab));
 
     QList<QKeySequence> prevTabKeys;
-    prevTabKeys.append(KStandardShortcut::tabPrev().primary());
+    prevTabKeys.append(KStandardShortcut::tabPrev().first()); //TODO: is this correct
     prevTabKeys.append(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Tab));
 
-    KAction* activateNextTab = actionCollection()->addAction("activate_next_tab");
+    QAction* activateNextTab = actionCollection()->addAction("activate_next_tab");
     activateNextTab->setText(i18nc("@action:inmenu", "Activate Next Tab"));
     connect(activateNextTab, SIGNAL(triggered()), SLOT(activateNextTab()));
     activateNextTab->setShortcuts(QApplication::isRightToLeft() ? prevTabKeys : nextTabKeys);
 
-    KAction* activatePrevTab = actionCollection()->addAction("activate_prev_tab");
+    QAction* activatePrevTab = actionCollection()->addAction("activate_prev_tab");
     activatePrevTab->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
     connect(activatePrevTab, SIGNAL(triggered()), SLOT(activatePrevTab()));
     activatePrevTab->setShortcuts(QApplication::isRightToLeft() ? nextTabKeys : prevTabKeys);
 
     // for context menu
-    KAction* openInNewTab = actionCollection()->addAction("open_in_new_tab");
+    QAction* openInNewTab = actionCollection()->addAction("open_in_new_tab");
     openInNewTab->setText(i18nc("@action:inmenu", "Open in New Tab"));
     openInNewTab->setIcon(KIcon("tab-new"));
     connect(openInNewTab, SIGNAL(triggered()), this, SLOT(openInNewTab()));
 
-    KAction* openInNewWindow = actionCollection()->addAction("open_in_new_window");
+    QAction* openInNewTabs = actionCollection()->addAction("open_in_new_tabs");
+    openInNewTabs->setText(i18nc("@action:inmenu", "Open in New Tabs"));
+    openInNewTabs->setIcon(KIcon("tab-new"));
+    connect(openInNewTabs, SIGNAL(triggered()), this, SLOT(openInNewTab()));
+
+    QAction* openInNewWindow = actionCollection()->addAction("open_in_new_window");
     openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window"));
     openInNewWindow->setIcon(KIcon("window-new"));
     connect(openInNewWindow, SIGNAL(triggered()), this, SLOT(openInNewWindow()));
@@ -1699,7 +1717,9 @@ void DolphinMainWindow::setupDockWidgets()
     connect(foldersPanel, SIGNAL(folderActivated(KUrl)),
             this, SLOT(changeUrl(KUrl)));
     connect(foldersPanel, SIGNAL(folderMiddleClicked(KUrl)),
-            this, SLOT(openNewActivatedTab(KUrl)));
+            this, SLOT(openNewTab(KUrl)));
+    connect(foldersPanel, SIGNAL(errorMessage(QString)),
+            this, SLOT(slotPanelErrorMessage(QString)));
 
     // Setup "Terminal"
 #ifndef Q_OS_WIN
@@ -1712,6 +1732,7 @@ void DolphinMainWindow::setupDockWidgets()
     terminalDock->setWidget(terminalPanel);
 
     connect(terminalPanel, SIGNAL(hideTerminalPanel()), terminalDock, SLOT(hide()));
+    connect(terminalPanel, SIGNAL(changeUrl(KUrl)), this, SLOT(slotTerminalDirectoryChanged(KUrl)));
     connect(terminalDock, SIGNAL(visibilityChanged(bool)),
             terminalPanel, SLOT(dockVisibilityChanged()));
 
@@ -1746,13 +1767,17 @@ void DolphinMainWindow::setupDockWidgets()
 
     addDockWidget(Qt::LeftDockWidgetArea, placesDock);
     connect(placesPanel, SIGNAL(placeActivated(KUrl)),
-            this, SLOT(changeUrl(KUrl)));
+            this, SLOT(slotPlaceActivated(KUrl)));
     connect(placesPanel, SIGNAL(placeMiddleClicked(KUrl)),
-            this, SLOT(openNewActivatedTab(KUrl)));
+            this, SLOT(openNewTab(KUrl)));
+    connect(placesPanel, SIGNAL(errorMessage(QString)),
+            this, SLOT(slotPanelErrorMessage(QString)));
     connect(this, SIGNAL(urlChanged(KUrl)),
             placesPanel, SLOT(setUrl(KUrl)));
     connect(placesDock, SIGNAL(visibilityChanged(bool)),
             this, SLOT(slotPlacesPanelVisibilityChanged(bool)));
+    connect(this, SIGNAL(settingsChanged()),
+           placesPanel, SLOT(readSettings()));
 
     // Add actions into the "Panels" menu
     KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
@@ -1877,7 +1902,7 @@ bool DolphinMainWindow::addActionToMenu(QAction* action, KMenu* menu)
 
 void DolphinMainWindow::rememberClosedTab(int index)
 {
-    KMenu* tabsMenu = m_recentTabsMenu->menu();
+    QMenu* tabsMenu = m_recentTabsMenu->menu();
 
     const QString primaryPath = m_viewTab[index].primaryView->url().path();
     const QString iconName = KMimeType::iconNameForUrl(primaryPath);
@@ -1943,6 +1968,8 @@ void DolphinMainWindow::refreshViews()
             toggleSplitView();
         }
     }
+
+    emit settingsChanged();
 }
 
 void DolphinMainWindow::clearStatusBar()
@@ -2047,7 +2074,13 @@ void DolphinMainWindow::createSecondaryView(int tabIndex)
     const int newWidth = (viewTab.primaryView->width() - splitter->handleWidth()) / 2;
 
     const DolphinView* view = viewTab.primaryView->view();
-    viewTab.secondaryView = createViewContainer(view->url(), 0);
+    // The final parent of the new view container will be set by adding it
+    // to the splitter. However, we must make sure that the DolphinMainWindow
+    // is a parent of the view container already when it is constructed
+    // because this enables the container's KFileItemModel to assign its
+    // dir lister to the right main window. The dir lister can then cache
+    // authentication data.
+    viewTab.secondaryView = createViewContainer(view->url(), this);
     splitter->addWidget(viewTab.secondaryView);
     splitter->setSizes(QList<int>() << newWidth << newWidth);
 
@@ -2089,7 +2122,7 @@ void DolphinMainWindow::createPanelAction(const KIcon& icon,
                                           QAction* dockAction,
                                           const QString& actionName)
 {
-    KAction* panelAction = actionCollection()->addAction(actionName);
+    QAction* panelAction = actionCollection()->addAction(actionName);
     panelAction->setCheckable(true);
     panelAction->setChecked(dockAction->isChecked());
     panelAction->setText(dockAction->text());