mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
[TabWidget] Make sure current tab is loaded on session restore
Fixes issue with current tab not being loaded on session restore with "don't load tabs until selected" option. It was needed to switch to other tab and then switch back to first tab to actually load it. Also pause updates of the whole browser window when restoring session.
This commit is contained in:
parent
bfcae43c21
commit
a560b7f498
|
@ -361,6 +361,7 @@ bool MainApplication::restoreSession(BrowserWindow* window, RestoreData restoreD
|
|||
m_isRestoring = true;
|
||||
setOverrideCursor(Qt::BusyCursor);
|
||||
|
||||
window->setUpdatesEnabled(false);
|
||||
window->tabWidget()->closeRecoveryTab();
|
||||
|
||||
if (window->tabWidget()->normalTabsCount() > 1) {
|
||||
|
@ -369,9 +370,10 @@ bool MainApplication::restoreSession(BrowserWindow* window, RestoreData restoreD
|
|||
// Don't restore tabs in current window as user already opened
|
||||
// some new tabs.
|
||||
// Instead create new one and restore pinned tabs there
|
||||
|
||||
BrowserWindow* newWin = createWindow(Qz::BW_OtherRestoredWindow);
|
||||
newWin->setUpdatesEnabled(false);
|
||||
newWin->restoreWindowState(restoreData.first());
|
||||
newWin->setUpdatesEnabled(true);
|
||||
restoreData.remove(0);
|
||||
}
|
||||
else {
|
||||
|
@ -383,15 +385,18 @@ bool MainApplication::restoreSession(BrowserWindow* window, RestoreData restoreD
|
|||
RestoreManager::WindowData data = restoreData.first();
|
||||
data.currentTab += tabCount;
|
||||
restoreData.remove(0);
|
||||
|
||||
window->restoreWindowState(data);
|
||||
}
|
||||
|
||||
window->setUpdatesEnabled(true);
|
||||
|
||||
processEvents();
|
||||
|
||||
foreach (const RestoreManager::WindowData &data, restoreData) {
|
||||
BrowserWindow* window = createWindow(Qz::BW_OtherRestoredWindow);
|
||||
window->setUpdatesEnabled(false);
|
||||
window->restoreWindowState(data);
|
||||
window->setUpdatesEnabled(true);
|
||||
|
||||
processEvents();
|
||||
}
|
||||
|
|
|
@ -117,7 +117,6 @@ TabWidget::TabWidget(BrowserWindow* window, QWidget* parent)
|
|||
, m_lastTabIndex(-1)
|
||||
, m_lastBackgroundTabIndex(-1)
|
||||
, m_isClosingToLastTabIndex(false)
|
||||
, m_isRestoringState(false)
|
||||
{
|
||||
setObjectName(QSL("tabwidget"));
|
||||
|
||||
|
@ -331,8 +330,6 @@ int TabWidget::addView(const LoadRequest &req, const QString &title, const Qz::N
|
|||
QtWin::extendFrameIntoClientArea(m_window);
|
||||
}
|
||||
#endif
|
||||
setUpdatesEnabled(false);
|
||||
|
||||
QUrl url = req.url();
|
||||
m_lastTabIndex = currentIndex();
|
||||
|
||||
|
@ -412,8 +409,6 @@ int TabWidget::addView(const LoadRequest &req, const QString &title, const Qz::N
|
|||
m_tabBar->ensureVisible(index);
|
||||
}
|
||||
|
||||
setUpdatesEnabled(true);
|
||||
|
||||
emit changed();
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -513,9 +508,8 @@ void TabWidget::closeTab(int index, bool force)
|
|||
|
||||
void TabWidget::currentTabChanged(int index)
|
||||
{
|
||||
if (!validIndex(index) || m_isRestoringState) {
|
||||
if (!validIndex(index))
|
||||
return;
|
||||
}
|
||||
|
||||
m_isClosingToLastTabIndex = m_lastBackgroundTabIndex == index;
|
||||
m_lastBackgroundTabIndex = -1;
|
||||
|
@ -827,8 +821,6 @@ void TabWidget::restorePinnedTabs()
|
|||
QList<QByteArray> tabHistory;
|
||||
stream >> tabHistory;
|
||||
|
||||
m_isRestoringState = true;
|
||||
|
||||
for (int i = 0; i < pinnedTabs.count(); ++i) {
|
||||
QUrl url = QUrl::fromEncoded(pinnedTabs.at(i).toUtf8());
|
||||
|
||||
|
@ -852,8 +844,6 @@ void TabWidget::restorePinnedTabs()
|
|||
|
||||
m_tabBar->updatePinnedTabCloseButton(addedIndex);
|
||||
}
|
||||
|
||||
m_isRestoringState = false;
|
||||
}
|
||||
|
||||
QByteArray TabWidget::saveState()
|
||||
|
@ -886,8 +876,6 @@ QByteArray TabWidget::saveState()
|
|||
|
||||
bool TabWidget::restoreState(const QVector<WebTab::SavedTab> &tabs, int currentTab)
|
||||
{
|
||||
m_isRestoringState = true;
|
||||
|
||||
Qz::BrowserWindowType type = m_window->windowType();
|
||||
|
||||
if (type == Qz::BW_FirstAppWindow || type == Qz::BW_MacFirstWindow) {
|
||||
|
@ -901,10 +889,11 @@ bool TabWidget::restoreState(const QVector<WebTab::SavedTab> &tabs, int currentT
|
|||
weTab(index)->restoreTab(tab);
|
||||
}
|
||||
|
||||
m_isRestoringState = false;
|
||||
|
||||
setCurrentIndex(currentTab);
|
||||
currentTabChanged(currentTab);
|
||||
|
||||
// WebTab is restoring state on showEvent
|
||||
weTab()->hide();
|
||||
weTab()->show();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -156,7 +156,6 @@ private:
|
|||
int m_lastTabIndex;
|
||||
int m_lastBackgroundTabIndex;
|
||||
bool m_isClosingToLastTabIndex;
|
||||
bool m_isRestoringState;
|
||||
|
||||
bool m_dontCloseWithOneTab;
|
||||
bool m_showClosedTabsButton;
|
||||
|
|
Loading…
Reference in New Issue
Block a user