diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index a3fe5c92c..8baba219f 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -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(); } diff --git a/src/lib/tabwidget/tabwidget.cpp b/src/lib/tabwidget/tabwidget.cpp index 1cfb23915..afcfe0cb8 100644 --- a/src/lib/tabwidget/tabwidget.cpp +++ b/src/lib/tabwidget/tabwidget.cpp @@ -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 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 &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 &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; } diff --git a/src/lib/tabwidget/tabwidget.h b/src/lib/tabwidget/tabwidget.h index c63c57356..ff5bfa676 100644 --- a/src/lib/tabwidget/tabwidget.h +++ b/src/lib/tabwidget/tabwidget.h @@ -156,7 +156,6 @@ private: int m_lastTabIndex; int m_lastBackgroundTabIndex; bool m_isClosingToLastTabIndex; - bool m_isRestoringState; bool m_dontCloseWithOneTab; bool m_showClosedTabsButton;