void Window::setSession(SessionWindow session) { m_session = session; setSearchEngine(session.searchEngine); setPinned(session.pinned); if (!SettingsManager::getValue(QLatin1String("Browser/DelayRestoringOfBackgroundTabs")).toBool()) { setUrl(session.getUrl(), false); } }
void WindowsManager::closeWindow(Window *window) { const int index = getWindowIndex(window); if (index < 0) { return; } if (window && !window->isPrivate()) { const WindowHistoryInformation history = window->getContentsWidget()->getHistory(); if (!window->isUrlEmpty() || history.entries.count() > 1) { const SessionWindow information = window->getSession(); if (window->getType() != QLatin1String("web")) { removeStoredUrl(information.getUrl()); } m_closedWindows.prepend(information); emit closedWindowsAvailableChanged(true); } } if (m_tabBar->count() == 1) { window = getWindow(0); if (window) { window->clear(); return; } } m_tabBar->removeTab(index); emit windowRemoved(index); if (m_tabBar->count() < 1) { open(); } }
void WindowsManager::closeWindow(Window *window) { const int index = getWindowIndex(window); if (index < 0) { return; } if (window && !window->isPrivate()) { const WindowHistoryInformation history = window->getContentsWidget()->getHistory(); if (!window->isUrlEmpty() || history.entries.count() > 1) { const SessionWindow information = window->getSession(); if (window->getType() != QLatin1String("web")) { removeStoredUrl(information.getUrl()); } m_closedWindows.prepend(information); emit closedWindowsAvailableChanged(true); } } const QString lastTabClosingAction = SettingsManager::getValue(QLatin1String("TabBar/LastTabClosingAction")).toString(); if (m_tabBar->count() == 1) { if (lastTabClosingAction == QLatin1String("closeWindow")) { ActionsManager::triggerAction(QLatin1String("CloseWindow"), m_mdi); return; } if (lastTabClosingAction == QLatin1String("openTab")) { window = getWindow(0); if (window) { window->clear(); return; } } else { ActionsManager::getAction(QLatin1String("CloneTab"), m_mdi)->setEnabled(false); emit windowTitleChanged(QString()); } } m_tabBar->removeTab(index); emit windowRemoved(index); if (m_tabBar->count() < 1 && lastTabClosingAction != QLatin1String("doNothing")) { open(); } }