- QWidget* focusWidget = QApplication::focusWidget();
-
- if (m_viewTab.count() == 1) {
- // Only one view is open currently and hence no tab is shown at
- // all. Before creating a tab for 'url', provide a tab for the current URL.
- const KUrl currentUrl = m_activeViewContainer->url();
- m_tabBar->addTab(KIcon(KMimeType::iconNameForUrl(currentUrl)),
- squeezedText(tabName(currentUrl)));
- m_tabBar->blockSignals(false);
- }
-
- m_tabBar->addTab(KIcon(KMimeType::iconNameForUrl(url)),
- squeezedText(tabName(url)));
-
- ViewTab viewTab;
- viewTab.splitter = new QSplitter(this);
- viewTab.splitter->setChildrenCollapsible(false);
- viewTab.primaryView = new DolphinViewContainer(url, viewTab.splitter);
- viewTab.primaryView->setActive(false);
- connectViewSignals(viewTab.primaryView);
- viewTab.primaryView->view()->reload();
-
- m_viewTab.append(viewTab);
-
- actionCollection()->action("close_tab")->setEnabled(true);
-
- // provide a split view, if the startup settings are set this way
- const GeneralSettings* generalSettings = DolphinSettings::instance().generalSettings();
- if (generalSettings->splitView()) {
- const int tabIndex = m_viewTab.count() - 1;
- createSecondaryView(tabIndex);
- m_viewTab[tabIndex].secondaryView->setActive(true);
- m_viewTab[tabIndex].isPrimaryViewActive = false;
- }
-
- if (focusWidget != 0) {
- // The DolphinViewContainer grabbed the keyboard focus. As the tab is opened
- // in background, assure that the previous focused widget gets the focus back.
- focusWidget->setFocus();
- }
-}
-
-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);