From efab78ae5e2524c426054919c86e1bb4c9e61783 Mon Sep 17 00:00:00 2001 From: nowrep Date: Sun, 11 Mar 2012 15:17:12 +0100 Subject: [PATCH] Added option "Don't load tabs until selected" when restoring session. --- src/lib/bookmarks/bookmarksmanager.cpp | 5 +- src/lib/preferences/preferences.cpp | 2 + src/lib/preferences/preferences.ui | 381 +++++++++++++------------ src/lib/webview/tabbar.cpp | 9 +- src/lib/webview/tabwidget.cpp | 195 ++++++------- src/lib/webview/tabwidget.h | 7 +- src/lib/webview/webtab.cpp | 157 +++++++++- src/lib/webview/webtab.h | 56 +++- src/lib/webview/webviewsettings.cpp | 4 + src/lib/webview/webviewsettings.h | 1 + 10 files changed, 500 insertions(+), 317 deletions(-) diff --git a/src/lib/bookmarks/bookmarksmanager.cpp b/src/lib/bookmarks/bookmarksmanager.cpp index ea568cf3c..e9cc6f43b 100644 --- a/src/lib/bookmarks/bookmarksmanager.cpp +++ b/src/lib/bookmarks/bookmarksmanager.cpp @@ -627,12 +627,11 @@ void BookmarksManager::insertAllTabs() } foreach(WebTab * tab, getQupZilla()->tabWidget()->allTabs(false)) { - TabbedWebView* view = tab->view(); - if (view->url().isEmpty()) { + if (tab->url().isEmpty()) { continue; } - m_bookmarksModel->saveBookmark(view->url(), view->title(), view->icon(), BookmarksModel::fromTranslatedFolder(combo->currentText())); + m_bookmarksModel->saveBookmark(tab->url(), tab->title(), tab->icon(), BookmarksModel::fromTranslatedFolder(combo->currentText())); } delete dialog; diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index a344b2ec1..a44eaa2cb 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -101,6 +101,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) settings.endGroup(); ui->afterLaunch->setCurrentIndex(afterLaunch); ui->checkUpdates->setChecked(settings.value("Web-Browser-Settings/CheckUpdates", DEFAULT_CHECK_UPDATES).toBool()); + ui->dontLoadTabsUntilSelected->setChecked(settings.value("Web-Browser-Settings/LoadTabsOnActivation", false).toBool()); ui->newTabFrame->setVisible(false); if (m_newTabUrl.isEmpty()) { @@ -788,6 +789,7 @@ void Preferences::saveSettings() settings.setValue("wheelScrollLines", ui->wheelScroll->value()); settings.setValue("DoNotTrack", ui->doNotTrack->isChecked()); settings.setValue("CheckUpdates", ui->checkUpdates->isChecked()); + settings.setValue("LoadTabsOnActivation", ui->dontLoadTabsUntilSelected->isChecked()); settings.setValue("DefaultZoom", ui->defaultZoom->value()); settings.setValue("XSSAuditing", ui->xssAuditing->isChecked()); settings.setValue("UserAgent", ui->changeUserAgent->isChecked() ? ui->userAgentCombo->currentText() : ""); diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui index 94366f697..2ec66d3a4 100644 --- a/src/lib/preferences/preferences.ui +++ b/src/lib/preferences/preferences.ui @@ -7,7 +7,7 @@ 0 0 829 - 484 + 496 @@ -292,24 +292,24 @@ - + <b>Profiles</b> - + Startup profile: - + - + QFrame::NoFrame @@ -391,42 +391,42 @@ - + Check for updates on start - + Active profile: - + - + In order to change language, you must restart browser. - + <b>Language</b> - + @@ -449,10 +449,10 @@ - + - + Qt::Vertical @@ -465,6 +465,13 @@ + + + + Don't load tabs until selected + + + @@ -1690,7 +1697,112 @@ - + + QLayout::SetFixedSize + + + + + JavaScript can access clipboard + + + + + + + Block popup windows + + + + + + + Send Referer header to servers + + + + + + + Filter tracking cookies + + + + + + + <b>Cookies</b> + + + + + + + Allow storing of cookies + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Match domain exactly + + + + + + + Send Do Not Track header to servers + + + + + + + <b>Other</b> + + + + + + + Edit CA certificates in SSL Manager + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + Qt::Vertical @@ -1703,177 +1815,71 @@ - - - - - - <b>Cookies</b> - - - - - - - Filter tracking cookies - - - - - - - Allow storing of cookies - - - - - - - Delete cookies on close - - - - - - - Match domain exactly - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - <b>Warning:</b> Match domain exactly and filter tracking cookies options can lead to deny some cookies from sites. If you have problems with cookies, try to disable this options first! - - - true - - - - - - - - 0 - 0 - - - - Cookies Manager - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - <b>SSL Certificates</b> - - - - - - - - 0 - 0 - - - - SSL Manager - - - - - - - Edit CA certificates in SSL Manager - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - JavaScript can access clipboard - - - - - - - <b>Other</b> - - - - - - - Send Do Not Track header to servers - - - - - - - Send Referer header to servers - - - - - - - Block popup windows - - - - + + + + + 0 + 0 + + + + Cookies Manager + + + + + + + + 0 + 0 + + + + SSL Manager + + + + + + + Delete cookies on close + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + <b>SSL Certificates</b> + + + + + + + <b>Warning:</b> Match domain exactly and filter tracking cookies options can lead to deny some cookies from sites. If you have problems with cookies, try to disable this options first! + + + true + + @@ -2184,11 +2190,6 @@ closeDownManOnFinish downlaodNativeSystemDialog allowPassManager - saveCookies - deleteCookiesOnClose - matchExactly - filterTracking - cookieManagerBut useOSDNotifications useNativeSystemNotifications doNotUseNotifications diff --git a/src/lib/webview/tabbar.cpp b/src/lib/webview/tabbar.cpp index 704062e3e..200a305c0 100644 --- a/src/lib/webview/tabbar.cpp +++ b/src/lib/webview/tabbar.cpp @@ -289,7 +289,9 @@ void TabBar::bookmarkTab() return; } - p_QupZilla->addBookmark(view->url(), view->title(), view->icon()); + WebTab* tab = view->webTab(); + + p_QupZilla->addBookmark(tab->url(), tab->title(), tab->icon()); } void TabBar::pinTab() @@ -434,7 +436,10 @@ void TabBar::dropEvent(QDropEvent* event) } } else { - p_QupZilla->weView(index)->load(mime->urls().first()); + WebTab* tab = p_QupZilla->weView(index)->webTab(); + if (tab->isRestored()) { + tab->view()->load(mime->urls().first()); + } } } diff --git a/src/lib/webview/tabwidget.cpp b/src/lib/webview/tabwidget.cpp index 49f8fb61f..4d53f89b2 100644 --- a/src/lib/webview/tabwidget.cpp +++ b/src/lib/webview/tabwidget.cpp @@ -150,20 +150,14 @@ void TabWidget::resizeEvent(QResizeEvent* e) QTabWidget::resizeEvent(e); } -TabbedWebView* TabWidget::weView() +WebTab* TabWidget::weTab() { - return weView(currentIndex()); + return weTab(currentIndex()); } -TabbedWebView* TabWidget::weView(int index) +WebTab* TabWidget::weTab(int index) { - WebTab* webTab = qobject_cast(widget(index)); - - if (!webTab) { - return 0; - } - - return webTab->view(); + return qobject_cast(widget(index)); } void TabWidget::createKeyPressEvent(QKeyEvent* event) @@ -192,24 +186,24 @@ void TabWidget::moveAddTabButton(int posX) void TabWidget::aboutToShowTabsMenu() { m_menuTabs->clear(); - TabbedWebView* actView = weView(); - if (!actView) { + WebTab* actTab = weTab(); + if (!actTab) { return; } for (int i = 0; i < count(); i++) { - TabbedWebView* view = weView(i); - if (!view) { + WebTab* tab = weTab(i); + if (!tab) { continue; } QAction* action = new QAction(this); - if (view == actView) { + if (tab == actTab) { action->setIcon(QIcon(":/icons/menu/dot.png")); } else { - action->setIcon(view->icon()); + action->setIcon(tab->icon()); } - if (view->title().isEmpty()) { - if (view->isLoading()) { + if (tab->title().isEmpty()) { + if (tab->isLoading()) { action->setText(tr("Loading...")); action->setIcon(QIcon(":/icons/other/progress.gif")); } @@ -218,7 +212,7 @@ void TabWidget::aboutToShowTabsMenu() } } else { - QString title = view->title(); + QString title = tab->title(); title.replace("&", "&&"); if (title.length() > 40) { title.truncate(40); @@ -288,7 +282,7 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT index = insertTab(position, new WebTab(p_QupZilla, locBar), ""); } - TabbedWebView* webView = weView(index); + TabbedWebView* webView = weTab(index)->view(); locBar->setWebView(webView); setTabText(index, title); @@ -335,14 +329,15 @@ void TabWidget::closeTab(int index) index = currentIndex(); } - TabbedWebView* webView = weView(index); - WebPage* webPage = webView->webPage(); - WebTab* webTab = webView->webTab(); - if (!webView || !webPage || !webTab) { + WebTab* webTab = weTab(index); + if (!webTab) { return; } + TabbedWebView* webView = webTab->view(); + WebPage* webPage = webView->webPage(); + if (count() == 1) { if (m_dontQuitWithOneTab) { webView->load(m_urlOnNewTab); @@ -391,13 +386,14 @@ void TabWidget::currentTabChanged(int index) m_isClosingToLastTabIndex = false; m_lastBackgroundTabIndex = -1; - TabbedWebView* webView = weView(); - LocationBar* locBar = webView->webTab()->locationBar(); + WebTab* webTab = weTab(index); + LocationBar* locBar = webTab->locationBar(); if (m_locationBars->indexOf(locBar) != -1) { m_locationBars->setCurrentWidget(locBar); } + webTab->setCurrentTab(); p_QupZilla->currentTabChanged(); m_tabBar->updateCloseButton(index); } @@ -416,7 +412,7 @@ void TabWidget::setTabText(int index, const QString &text) QString newtext = text; newtext.replace("&", "&&"); // Avoid Alt+letter shortcuts - if (WebTab* webTab = qobject_cast(p_QupZilla->tabWidget()->widget(index))) { + if (WebTab* webTab = weTab(index)) { if (webTab->isPinned()) { newtext = ""; } @@ -427,7 +423,7 @@ void TabWidget::setTabText(int index, const QString &text) void TabWidget::reloadTab(int index) { - weView(index)->reload(); + weTab(index)->reload(); } void TabWidget::showTabBar() @@ -449,44 +445,37 @@ void TabWidget::reloadAllTabs() void TabWidget::stopTab(int index) { - weView(index)->stop(); -} - -void TabWidget::backTab(int index) -{ - weView(index)->back(); -} - -void TabWidget::forwardTab(int index) -{ - weView(index)->forward(); + weTab(index)->stop(); } void TabWidget::closeAllButCurrent(int index) { - WebTab* akt = qobject_cast(widget(index)); + WebTab* akt = weTab(index); foreach(WebTab * tab, allTabs(false)) { - if (akt == widget(tab->view()->tabIndex())) { + int tabIndex = tab->tabIndex(); + if (akt == widget(tabIndex)) { continue; } - closeTab(tab->view()->tabIndex()); + closeTab(tabIndex); } } int TabWidget::duplicateTab(int index) { - const QUrl &url = weView(index)->url(); + WebView* view = weTab(index)->view(); + const QUrl &url = view->url(); + QByteArray history; QDataStream tabHistoryStream(&history, QIODevice::WriteOnly); - tabHistoryStream << *weView(index)->history(); + tabHistoryStream << *view->history(); QNetworkRequest req(url); req.setRawHeader("Referer", url.toEncoded()); int id = addView(req, tabText(index), Qz::NT_CleanNotSelectedTab); QDataStream historyStream(history); - historyStream >> *weView(id)->history(); + historyStream >> *view->history(); return id; } @@ -508,10 +497,8 @@ void TabWidget::restoreClosedTab() } int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab, false, tab.position); - QDataStream historyStream(tab.history); - historyStream >> *weView(index)->history(); - - weView(index)->load(tab.url); + WebTab* webTab = weTab(index); + webTab->p_restoreTab(tab.url, tab.history); } void TabWidget::restoreAllClosedTabs() @@ -524,10 +511,8 @@ void TabWidget::restoreAllClosedTabs() foreach(const ClosedTabsManager::Tab & tab, closedTabs) { int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab); - QDataStream historyStream(tab.history); - historyStream >> *weView(index)->history(); - - weView(index)->load(tab.url); + WebTab* webTab = weTab(index); + webTab->p_restoreTab(tab.url, tab.history); } m_closedTabsManager->clearList(); @@ -576,15 +561,18 @@ QList TabWidget::allTabs(bool withPinned) QList allTabs; for (int i = 0; i < count(); i++) { - WebTab* tab = qobject_cast(widget(i)); + WebTab* tab = weTab(i); if (!tab || (!withPinned && tab->isPinned())) { continue; } allTabs.append(tab); } + return allTabs; } +static const qint32 TabWidgetFileVersion = 0xaaf; + void TabWidget::savePinnedTabs() { QByteArray data; @@ -593,9 +581,8 @@ void TabWidget::savePinnedTabs() QStringList tabs; QList tabsHistory; for (int i = 0; i < count(); ++i) { - if (TabbedWebView* tab = weView(i)) { - WebTab* webTab = qobject_cast(widget(i)); - if (!webTab || !webTab->isPinned()) { + if (WebTab* tab = weTab(i)) { + if (!tab->isPinned()) { continue; } @@ -645,16 +632,18 @@ void TabWidget::restorePinnedTabs() QByteArray historyState = tabHistory.value(i); int addedIndex; + if (!historyState.isEmpty()) { addedIndex = addView(QUrl(), Qz::NT_CleanSelectedTab); - QDataStream historyStream(historyState); - historyStream >> *weView(addedIndex)->history(); - weView(addedIndex)->load(url); + + weTab(i)->p_restoreTab(url, historyState); } else { addedIndex = addView(url); } - WebTab* webTab = qobject_cast(widget(addedIndex)); + + WebTab* webTab = weTab(addedIndex); + if (webTab) { webTab->setPinned(true); emit pinnedTabAdded(); @@ -667,72 +656,64 @@ void TabWidget::restorePinnedTabs() QByteArray TabWidget::saveState() { + QList tabList; + + for (int i = 0; i < count(); ++i) { + WebTab* webTab = weTab(i); + if (!webTab || webTab->isPinned()) { + continue; + } + + WebTab::SavedTab tab(webTab); + tabList.append(tab); + } + QByteArray data; QDataStream stream(&data, QIODevice::WriteOnly); - QStringList tabs; - QList tabsHistory; - for (int i = 0; i < count(); ++i) { - if (TabbedWebView* tab = weView(i)) { - WebTab* webTab = qobject_cast(widget(i)); - if (webTab && webTab->isPinned()) { - continue; - } + stream << TabWidgetFileVersion; + stream << tabList.count(); - tabs.append(tab->url().toEncoded()); - if (tab->history()->count() != 0) { - QByteArray tabHistory; - QDataStream tabHistoryStream(&tabHistory, QIODevice::WriteOnly); - tabHistoryStream << *tab->history(); - tabsHistory.append(tabHistory); - } - else { - tabsHistory << QByteArray(); - } - } - else { - tabs.append(QString::null); - tabsHistory.append(QByteArray()); - } + foreach(const WebTab::SavedTab & tab, tabList) { + stream << tab; } - stream << tabs; + stream << currentIndex(); - stream << tabsHistory; return data; } -bool TabWidget::restoreState(const QByteArray &state) +bool TabWidget::restoreState(QByteArray &state) { - QByteArray sd = state; - QDataStream stream(&sd, QIODevice::ReadOnly); + QDataStream stream(&state, QIODevice::ReadOnly); if (stream.atEnd()) { return false; } - QStringList openTabs; - int currentTab; - QList tabHistory; - stream >> openTabs; - stream >> currentTab; - stream >> tabHistory; + qint32 fileVersion = 0; + int tabListCount = 0; + int currentTab = 0; - for (int i = 0; i < openTabs.count(); ++i) { - QUrl url = QUrl::fromEncoded(openTabs.at(i).toUtf8()); + stream >> fileVersion; + stream >> tabListCount; - QByteArray historyState = tabHistory.value(i); - if (!historyState.isEmpty()) { - int index = addView(QUrl(), Qz::NT_CleanSelectedTab); - QDataStream historyStream(historyState); - historyStream >> *weView(index)->history(); - weView(index)->load(url); - } - else { - addView(url); - } + if (fileVersion != TabWidgetFileVersion) { + return false; } + for (int i = 0; i < tabListCount; ++i) { + WebTab::SavedTab tab; + stream >> tab; + + int index = addView(QUrl(), Qz::NT_CleanSelectedTab); + weTab(index)->restoreTab(tab); + } + + stream >> currentTab; + setCurrentIndex(currentTab); + currentTabChanged(currentTab); + return true; } diff --git a/src/lib/webview/tabwidget.h b/src/lib/webview/tabwidget.h index 75c21d755..65f4ce022 100644 --- a/src/lib/webview/tabwidget.h +++ b/src/lib/webview/tabwidget.h @@ -56,7 +56,7 @@ public: ~TabWidget(); QByteArray saveState(); - bool restoreState(const QByteArray &state); + bool restoreState(QByteArray &state); void savePinnedTabs(); void restorePinnedTabs(); @@ -113,8 +113,9 @@ private slots: private: void resizeEvent(QResizeEvent* e); - inline TabbedWebView* weView(); - inline TabbedWebView* weView(int index); + + WebTab* weTab(); + WebTab* weTab(int index); bool m_hideTabBarWithOneTab; bool m_dontQuitWithOneTab; diff --git a/src/lib/webview/webtab.cpp b/src/lib/webview/webtab.cpp index e04e4dc19..d6c60605c 100644 --- a/src/lib/webview/webtab.cpp +++ b/src/lib/webview/webtab.cpp @@ -22,8 +22,57 @@ #include "tabbar.h" #include "tabwidget.h" #include "locationbar.h" +#include "globalfunctions.h" +#include "webviewsettings.h" #include +#include +#include + +WebTab::SavedTab::SavedTab(WebTab* webTab) +{ + if (webTab->isRestored()) { + WebView* view = webTab->view(); + + title = view->title(); + url = view->url(); + icon = view->icon(); + + QDataStream historyStream(&history, QIODevice::WriteOnly); + historyStream << *view->history(); + } + else { + *this = webTab->savedTab(); + } +} + +void WebTab::SavedTab::clear() +{ + title.clear(); + url.clear(); + icon = QIcon(); + history.clear(); +} + +QDataStream &operator <<(QDataStream &stream, const WebTab::SavedTab &tab) +{ + stream << tab.title; + stream << tab.url; + stream << tab.icon; + stream << tab.history; + + return stream; +} + +QDataStream &operator >>(QDataStream &stream, WebTab::SavedTab &tab) +{ + stream >> tab.title; + stream >> tab.url; + stream >> tab.icon; + stream >> tab.history; + + return stream; +} WebTab::WebTab(QupZilla* mainClass, LocationBar* locationBar) : QWidget() @@ -54,12 +103,71 @@ WebTab::WebTab(QupZilla* mainClass, LocationBar* locationBar) connect(m_locationBar.data(), SIGNAL(loadUrl(QUrl)), m_view, SLOT(load(QUrl))); } -TabbedWebView* WebTab::view() +TabbedWebView* WebTab::view() const { return m_view; } -bool WebTab::isPinned() +void WebTab::setCurrentTab() +{ + if (!isRestored()) { + p_restoreTab(m_savedTab); + + m_savedTab.clear(); + } +} + +QUrl WebTab::url() const +{ + if (isRestored()) { + return m_view->url(); + } + else { + return m_savedTab.url; + } +} + +QString WebTab::title() const +{ + if (isRestored()) { + return m_view->title(); + } + else { + return m_savedTab.title; + } +} + +QIcon WebTab::icon() const +{ + if (isRestored()) { + return m_view->icon(); + } + else { + return m_savedTab.icon; + } +} + +QWebHistory* WebTab::history() const +{ + return m_view->history(); +} + +void WebTab::reload() +{ + m_view->reload(); +} + +void WebTab::stop() +{ + m_view->stop(); +} + +bool WebTab::isLoading() const +{ + return m_view->isLoading(); +} + +bool WebTab::isPinned() const { return m_pinned; } @@ -74,12 +182,12 @@ void WebTab::setLocationBar(LocationBar* bar) m_locationBar = bar; } -LocationBar* WebTab::locationBar() +LocationBar* WebTab::locationBar() const { return m_locationBar.data(); } -bool WebTab::inspectorVisible() +bool WebTab::inspectorVisible() const { return m_inspectorVisible; } @@ -89,6 +197,45 @@ void WebTab::setInspectorVisible(bool v) m_inspectorVisible = v; } +WebTab::SavedTab WebTab::savedTab() const +{ + return m_savedTab; +} + +bool WebTab::isRestored() const +{ + return m_savedTab.isEmpty(); +} + +void WebTab::restoreTab(const WebTab::SavedTab &tab) +{ + if (WebViewSettings::loadTabsOnActivation) { + m_savedTab = tab; + int index = tabIndex(); + + m_view->animationLoading(index, false)->setPixmap(tab.icon.pixmap(16, 16)); + m_view->tabWidget()->setTabText(index, tab.title); + m_locationBar.data()->showUrl(tab.url); + } + else { + p_restoreTab(tab); + } +} + +void WebTab::p_restoreTab(const QUrl &url, const QByteArray &history) +{ + QDataStream historyStream(history); + historyStream >> *m_view->history(); + + m_view->load(url); +} + +void WebTab::p_restoreTab(const WebTab::SavedTab &tab) +{ + p_restoreTab(tab.url, tab.history); +} + + void WebTab::showNotification(QWidget* notif) { if (m_layout->count() > 1) { @@ -99,7 +246,7 @@ void WebTab::showNotification(QWidget* notif) notif->show(); } -int WebTab::tabIndex() +int WebTab::tabIndex() const { return m_view->tabIndex(); } diff --git a/src/lib/webview/webtab.h b/src/lib/webview/webtab.h index 5b91f145a..a2a11dea5 100644 --- a/src/lib/webview/webtab.h +++ b/src/lib/webview/webtab.h @@ -20,45 +20,87 @@ #include #include +#include +#include #include "qz_namespace.h" class QVBoxLayout; +class QWebHistory; class QupZilla; class LocationBar; +class WebView; class TabbedWebView; class QT_QUPZILLA_EXPORT WebTab : public QWidget { Q_OBJECT public: + struct SavedTab { + QString title; + QUrl url; + QIcon icon; + QByteArray history; + + SavedTab() { } + SavedTab(WebTab* webTab); + + bool isEmpty() const { return url.isEmpty(); } + void clear(); + + friend QT_QUPZILLA_EXPORT QDataStream &operator<<(QDataStream &stream, const SavedTab &tab); + friend QT_QUPZILLA_EXPORT QDataStream &operator>>(QDataStream &stream, SavedTab &tab); + }; + explicit WebTab(QupZilla* mainClass, LocationBar* locationBar); ~WebTab(); - TabbedWebView* view(); - bool isPinned(); + + TabbedWebView* view() const; + void setCurrentTab(); + + QUrl url() const; + QString title() const; + QIcon icon() const; + QWebHistory* history() const; + + void reload(); + void stop(); + bool isLoading() const; + + bool isPinned() const; void pinTab(int index); void setPinned(bool state); - void setLocationBar(LocationBar* bar); - LocationBar* locationBar(); + int tabIndex() const; - bool inspectorVisible(); + void setLocationBar(LocationBar* bar); + LocationBar* locationBar() const; + + bool inspectorVisible() const; void setInspectorVisible(bool v); + SavedTab savedTab() const; + bool isRestored() const; + + void restoreTab(const SavedTab &tab); + + void p_restoreTab(const SavedTab &tab); + void p_restoreTab(const QUrl &url, const QByteArray &history); + void disconnectObjects(); private slots: void showNotification(QWidget* notif); private: - int tabIndex(); - QupZilla* p_QupZilla; TabbedWebView* m_view; QVBoxLayout* m_layout; QWeakPointer m_locationBar; + SavedTab m_savedTab; + bool m_pinned; bool m_inspectorVisible; }; diff --git a/src/lib/webview/webviewsettings.cpp b/src/lib/webview/webviewsettings.cpp index dc60256b5..1e95046d8 100644 --- a/src/lib/webview/webviewsettings.cpp +++ b/src/lib/webview/webviewsettings.cpp @@ -2,6 +2,7 @@ #include "settings.h" int WebViewSettings::defaultZoom = 100; +bool WebViewSettings::loadTabsOnActivation = false; WebViewSettings::WebViewSettings() { @@ -11,7 +12,10 @@ void WebViewSettings::loadSettings() { Settings settings; settings.beginGroup("Web-Browser-Settings"); + defaultZoom = settings.value("DefaultZoom", 100).toInt(); + loadTabsOnActivation = settings.value("LoadTabsOnActivation", false).toBool(); + settings.endGroup(); } diff --git a/src/lib/webview/webviewsettings.h b/src/lib/webview/webviewsettings.h index ba0c71f1b..b0d721a3b 100644 --- a/src/lib/webview/webviewsettings.h +++ b/src/lib/webview/webviewsettings.h @@ -11,6 +11,7 @@ public: static void loadSettings(); static int defaultZoom; + static bool loadTabsOnActivation; }; #endif // WEBVIEWSETTINGS_H