From e15bcc9215d48cc4b2d5d6ead4d5f5aa68329ae6 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Tue, 27 Dec 2016 18:31:20 +0100 Subject: [PATCH] Fix restoring zoom level of tabs --- src/lib/tabwidget/tabwidget.cpp | 10 ++++------ src/lib/webtab/webtab.cpp | 5 +++-- src/lib/webtab/webtab.h | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/lib/tabwidget/tabwidget.cpp b/src/lib/tabwidget/tabwidget.cpp index 76ed0593a..46c2a5912 100644 --- a/src/lib/tabwidget/tabwidget.cpp +++ b/src/lib/tabwidget/tabwidget.cpp @@ -679,7 +679,7 @@ int TabWidget::duplicateTab(int index) WebTab* webTab = weTab(index); int id = addView(QUrl(), webTab->title(), Qz::NT_CleanNotSelectedTab); - weTab(id)->p_restoreTab(webTab->url(), webTab->historyData()); + weTab(id)->p_restoreTab(webTab->url(), webTab->historyData(), webTab->zoomLevel()); return id; } @@ -710,8 +710,7 @@ void TabWidget::restoreClosedTab(QObject* obj) int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab, false, tab.position); WebTab* webTab = weTab(index); - webTab->setZoomLevel(tab.zoomLevel); - webTab->p_restoreTab(tab.url, tab.history); + webTab->p_restoreTab(tab.url, tab.history, tab.zoomLevel); updateClosedTabsButton(); } @@ -727,7 +726,7 @@ void TabWidget::restoreAllClosedTabs() foreach (const ClosedTabsManager::Tab &tab, closedTabs) { int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab); WebTab* webTab = weTab(index); - webTab->p_restoreTab(tab.url, tab.history); + webTab->p_restoreTab(tab.url, tab.history, tab.zoomLevel); } clearClosedTabsList(); @@ -843,8 +842,7 @@ void TabWidget::restorePinnedTabs() if (!historyState.isEmpty()) { addedIndex = addView(QUrl(), Qz::NT_CleanSelectedTab, false, true); - - weTab(addedIndex)->p_restoreTab(url, historyState); + weTab(addedIndex)->p_restoreTab(url, historyState, 6); } else { addedIndex = addView(url, tr("New tab"), Qz::NT_SelectedTab, false, -1, true); diff --git a/src/lib/webtab/webtab.cpp b/src/lib/webtab/webtab.cpp index 4e9a904ba..b6679f98e 100644 --- a/src/lib/webtab/webtab.cpp +++ b/src/lib/webtab/webtab.cpp @@ -357,16 +357,17 @@ void WebTab::restoreTab(const WebTab::SavedTab &tab) } } -void WebTab::p_restoreTab(const QUrl &url, const QByteArray &history) +void WebTab::p_restoreTab(const QUrl &url, const QByteArray &history, int zoomLevel) { m_webView->load(url); m_webView->restoreHistory(history); + m_webView->setZoomLevel(zoomLevel); m_webView->setFocus(); } void WebTab::p_restoreTab(const WebTab::SavedTab &tab) { - p_restoreTab(tab.url, tab.history); + p_restoreTab(tab.url, tab.history, tab.zoomLevel); } void WebTab::showNotification(QWidget* notif) diff --git a/src/lib/webtab/webtab.h b/src/lib/webtab/webtab.h index 3571294db..7e5fe5a7a 100644 --- a/src/lib/webtab/webtab.h +++ b/src/lib/webtab/webtab.h @@ -99,7 +99,7 @@ public: bool isRestored() const; void restoreTab(const SavedTab &tab); void p_restoreTab(const SavedTab &tab); - void p_restoreTab(const QUrl &url, const QByteArray &history); + void p_restoreTab(const QUrl &url, const QByteArray &history, int zoomLevel); private slots: void showNotification(QWidget* notif);