1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Fix restoring zoom level of tabs

This commit is contained in:
David Rosca 2016-12-27 18:31:20 +01:00
parent e9d1771114
commit e15bcc9215
3 changed files with 8 additions and 9 deletions

View File

@ -679,7 +679,7 @@ int TabWidget::duplicateTab(int index)
WebTab* webTab = weTab(index); WebTab* webTab = weTab(index);
int id = addView(QUrl(), webTab->title(), Qz::NT_CleanNotSelectedTab); 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; return id;
} }
@ -710,8 +710,7 @@ void TabWidget::restoreClosedTab(QObject* obj)
int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab, false, tab.position); int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab, false, tab.position);
WebTab* webTab = weTab(index); WebTab* webTab = weTab(index);
webTab->setZoomLevel(tab.zoomLevel); webTab->p_restoreTab(tab.url, tab.history, tab.zoomLevel);
webTab->p_restoreTab(tab.url, tab.history);
updateClosedTabsButton(); updateClosedTabsButton();
} }
@ -727,7 +726,7 @@ void TabWidget::restoreAllClosedTabs()
foreach (const ClosedTabsManager::Tab &tab, closedTabs) { foreach (const ClosedTabsManager::Tab &tab, closedTabs) {
int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab); int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab);
WebTab* webTab = weTab(index); WebTab* webTab = weTab(index);
webTab->p_restoreTab(tab.url, tab.history); webTab->p_restoreTab(tab.url, tab.history, tab.zoomLevel);
} }
clearClosedTabsList(); clearClosedTabsList();
@ -843,8 +842,7 @@ void TabWidget::restorePinnedTabs()
if (!historyState.isEmpty()) { if (!historyState.isEmpty()) {
addedIndex = addView(QUrl(), Qz::NT_CleanSelectedTab, false, true); addedIndex = addView(QUrl(), Qz::NT_CleanSelectedTab, false, true);
weTab(addedIndex)->p_restoreTab(url, historyState, 6);
weTab(addedIndex)->p_restoreTab(url, historyState);
} }
else { else {
addedIndex = addView(url, tr("New tab"), Qz::NT_SelectedTab, false, -1, true); addedIndex = addView(url, tr("New tab"), Qz::NT_SelectedTab, false, -1, true);

View File

@ -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->load(url);
m_webView->restoreHistory(history); m_webView->restoreHistory(history);
m_webView->setZoomLevel(zoomLevel);
m_webView->setFocus(); m_webView->setFocus();
} }
void WebTab::p_restoreTab(const WebTab::SavedTab &tab) 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) void WebTab::showNotification(QWidget* notif)

View File

@ -99,7 +99,7 @@ public:
bool isRestored() const; bool isRestored() const;
void restoreTab(const SavedTab &tab); void restoreTab(const SavedTab &tab);
void p_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: private slots:
void showNotification(QWidget* notif); void showNotification(QWidget* notif);