- DolphinApplication::app()->createMainWindow()->show();
-}
-
-void DolphinMainWindow::openNewTab()
-{
- openNewTab(m_activeViewContainer->url());
- m_tabBar->setCurrentIndex(m_viewTab.count() - 1);
-
- KUrlNavigator* navigator = m_activeViewContainer->urlNavigator();
- if (navigator->isUrlEditable()) {
- // if a new tab is opened and the URL is editable, assure that
- // the user can edit the URL without manually setting the focus
- navigator->setFocus();
- }
-}
-
-void DolphinMainWindow::openNewTab(const KUrl& url)
-{
- 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();
- }