From 04b288b3951e996e2d3fe6ab3a0e0ca525e6cd23 Mon Sep 17 00:00:00 2001 From: Razi Alavizadeh Date: Tue, 3 Oct 2017 11:44:11 +0330 Subject: [PATCH] Fix restoring non-loaded tabs when moving them. --- src/lib/tabwidget/tabwidget.cpp | 2 ++ src/lib/webtab/webtab.cpp | 10 ++-------- src/lib/webtab/webtab.h | 4 ++-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/lib/tabwidget/tabwidget.cpp b/src/lib/tabwidget/tabwidget.cpp index b423c63f4..eed511344 100644 --- a/src/lib/tabwidget/tabwidget.cpp +++ b/src/lib/tabwidget/tabwidget.cpp @@ -507,6 +507,8 @@ void TabWidget::currentTabChanged(int index) m_currentTabFresh = false; WebTab* webTab = weTab(index); + webTab->tabActivated(); + LocationBar* locBar = webTab->locationBar(); if (locBar && m_locationBars->indexOf(locBar) != -1) { diff --git a/src/lib/webtab/webtab.cpp b/src/lib/webtab/webtab.cpp index 8cdaefd35..4a36e5603 100644 --- a/src/lib/webtab/webtab.cpp +++ b/src/lib/webtab/webtab.cpp @@ -36,7 +36,6 @@ #include #include -bool WebTab::s_pinningTab = false; static const int savedTabVersion = 3; WebTab::SavedTab::SavedTab() @@ -474,11 +473,10 @@ void WebTab::slotRestore() m_tabBar->restoreTabTextColor(tabIndex()); } -void WebTab::showEvent(QShowEvent* event) +void WebTab::tabActivated() { - QWidget::showEvent(event); - if (!isRestored() && !s_pinningTab) { + if (!isRestored()) { // When session is being restored, restore the tab immediately if (mApp->isRestoring()) { slotRestore(); @@ -515,9 +513,5 @@ void WebTab::togglePinned() m_isPinned = !m_isPinned; - // Workaround bug in TabStackedWidget when pinning tab, other tabs may be accidentaly - // shown and restored state even when they won't be switched to by user. - s_pinningTab = true; m_window->tabWidget()->pinUnPinTab(tabIndex(), title()); - s_pinningTab = false; } diff --git a/src/lib/webtab/webtab.h b/src/lib/webtab/webtab.h index fee25eff2..06d26139a 100644 --- a/src/lib/webtab/webtab.h +++ b/src/lib/webtab/webtab.h @@ -102,6 +102,8 @@ public: void p_restoreTab(const SavedTab &tab); void p_restoreTab(const QUrl &url, const QByteArray &history, int zoomLevel); + void tabActivated(); + private slots: void showNotification(QWidget* notif); void loadStarted(); @@ -111,7 +113,6 @@ private slots: void slotRestore(); private: - void showEvent(QShowEvent* event); void resizeEvent(QResizeEvent *event) override; BrowserWindow* m_window; @@ -128,7 +129,6 @@ private: SavedTab m_savedTab; bool m_isPinned; - static bool s_pinningTab; }; #endif // WEBTAB_H