X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/aa0b09dac43ec2a58bd32a1e08d59acd35bd86aa..6efdfda5006621c691095a732ea8a5ad2812de6c:/src/dolphinmainwindow.cpp diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 48f085e33..1106c434f 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -21,7 +21,6 @@ #include "dolphinmainwindow.h" #include "dolphinviewactionhandler.h" -#include "dolphindropcontroller.h" #include @@ -58,6 +57,7 @@ #include #include #include +#include #include #include #include @@ -182,9 +182,12 @@ void DolphinMainWindow::refreshViews() // the secondary view DolphinViewContainer* activeViewContainer = m_activeViewContainer; - m_viewTab[m_tabIndex].primaryView->view()->refresh(); - if (m_viewTab[m_tabIndex].secondaryView != 0) { - m_viewTab[m_tabIndex].secondaryView->view()->refresh(); + const int tabCount = m_viewTab.count(); + for (int i = 0; i < tabCount; ++i) { + m_viewTab[i].primaryView->refresh(); + if (m_viewTab[i].secondaryView != 0) { + m_viewTab[i].secondaryView->refresh(); + } } setActiveViewContainer(activeViewContainer); @@ -197,6 +200,13 @@ void DolphinMainWindow::pasteIntoFolder() void DolphinMainWindow::changeUrl(const KUrl& url) { + if (!KProtocolManager::supportsListing(url)) { + // The URL navigator only checks for validity, not + // if the URL can be listed. An error message is + // shown due to DolphinViewContainer::restoreView(). + return; + } + DolphinViewContainer* view = activeViewContainer(); if (view != 0) { view->setUrl(url); @@ -308,6 +318,29 @@ void DolphinMainWindow::openNewTab(const KUrl& url) actionCollection()->action("close_tab")->setEnabled(true); } +void DolphinMainWindow::activateNextTab() +{ + if (m_viewTab.count() == 1 || m_tabBar->count() < 2) { + return; + } + + const int tabIndex = (m_tabBar->currentIndex() + 1) % m_tabBar->count(); + m_tabBar->setCurrentIndex(tabIndex); +} + +void DolphinMainWindow::activatePrevTab() +{ + if (m_viewTab.count() == 1 || m_tabBar->count() < 2) { + return; + } + + int tabIndex = m_tabBar->currentIndex() - 1; + if (tabIndex == -1) { + tabIndex = m_tabBar->count() - 1; + } + m_tabBar->setCurrentIndex(tabIndex); +} + void DolphinMainWindow::toggleActiveView() { if (m_viewTab[m_tabIndex].secondaryView == 0) { @@ -826,6 +859,7 @@ void DolphinMainWindow::init() setCentralWidget(centralWidget); setupDockWidgets(); + emit urlChanged(homeUrl); setupGUI(Keys | Save | Create | ToolBar); @@ -851,7 +885,6 @@ void DolphinMainWindow::init() } m_showMenuBar->setChecked(!menuBar()->isHidden()); // workaround for bug #171080 - emit urlChanged(homeUrl); } void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContainer) @@ -1005,6 +1038,19 @@ void DolphinMainWindow::setupActions() // setup 'Settings' menu m_showMenuBar = KStandardAction::showMenubar(this, SLOT(toggleShowMenuBar()), actionCollection()); KStandardAction::preferences(this, SLOT(editSettings()), actionCollection()); + + // not in menu actions + KAction* activateNextTab = actionCollection()->addAction("activatenexttab"); + activateNextTab->setText(i18nc("@action:inmenu", "Activate Next Tab")); + connect(activateNextTab, SIGNAL(triggered()), SLOT(activateNextTab())); + activateNextTab->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : + KStandardShortcut::tabNext()); + + KAction* activatePrevTab = actionCollection()->addAction("activateprevtab"); + activatePrevTab->setText(i18nc("@action:inmenu", "Activate Previous Tab")); + connect(activatePrevTab, SIGNAL(triggered()), SLOT(activatePrevTab())); + activatePrevTab->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : + KStandardShortcut::tabPrev()); } void DolphinMainWindow::setupDockWidgets()