1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

Fix restoring non-loaded tabs when moving them.

This commit is contained in:
Razi Alavizadeh 2017-10-03 11:44:11 +03:30
parent f041d87534
commit 04b288b395
3 changed files with 6 additions and 10 deletions

View File

@ -507,6 +507,8 @@ void TabWidget::currentTabChanged(int index)
m_currentTabFresh = false; m_currentTabFresh = false;
WebTab* webTab = weTab(index); WebTab* webTab = weTab(index);
webTab->tabActivated();
LocationBar* locBar = webTab->locationBar(); LocationBar* locBar = webTab->locationBar();
if (locBar && m_locationBars->indexOf(locBar) != -1) { if (locBar && m_locationBars->indexOf(locBar) != -1) {

View File

@ -36,7 +36,6 @@
#include <QTimer> #include <QTimer>
#include <QSplitter> #include <QSplitter>
bool WebTab::s_pinningTab = false;
static const int savedTabVersion = 3; static const int savedTabVersion = 3;
WebTab::SavedTab::SavedTab() WebTab::SavedTab::SavedTab()
@ -474,11 +473,10 @@ void WebTab::slotRestore()
m_tabBar->restoreTabTextColor(tabIndex()); 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 // When session is being restored, restore the tab immediately
if (mApp->isRestoring()) { if (mApp->isRestoring()) {
slotRestore(); slotRestore();
@ -515,9 +513,5 @@ void WebTab::togglePinned()
m_isPinned = !m_isPinned; 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()); m_window->tabWidget()->pinUnPinTab(tabIndex(), title());
s_pinningTab = false;
} }

View File

@ -102,6 +102,8 @@ public:
void p_restoreTab(const SavedTab &tab); void p_restoreTab(const SavedTab &tab);
void p_restoreTab(const QUrl &url, const QByteArray &history, int zoomLevel); void p_restoreTab(const QUrl &url, const QByteArray &history, int zoomLevel);
void tabActivated();
private slots: private slots:
void showNotification(QWidget* notif); void showNotification(QWidget* notif);
void loadStarted(); void loadStarted();
@ -111,7 +113,6 @@ private slots:
void slotRestore(); void slotRestore();
private: private:
void showEvent(QShowEvent* event);
void resizeEvent(QResizeEvent *event) override; void resizeEvent(QResizeEvent *event) override;
BrowserWindow* m_window; BrowserWindow* m_window;
@ -128,7 +129,6 @@ private:
SavedTab m_savedTab; SavedTab m_savedTab;
bool m_isPinned; bool m_isPinned;
static bool s_pinningTab;
}; };
#endif // WEBTAB_H #endif // WEBTAB_H