diff --git a/src/lib/webtab/webtab.cpp b/src/lib/webtab/webtab.cpp index 921ba2c37..6c44cb1e4 100644 --- a/src/lib/webtab/webtab.cpp +++ b/src/lib/webtab/webtab.cpp @@ -36,7 +36,7 @@ #include #include -static const int savedTabVersion = 5; +static const int savedTabVersion = 6; WebTab::SavedTab::SavedTab() : isPinned(false) @@ -60,6 +60,8 @@ WebTab::SavedTab::SavedTab(WebTab* webTab) for (WebTab *child : children) { childTabs.append(child->tabIndex()); } + + sessionData = webTab->sessionData(); } bool WebTab::SavedTab::isValid() const @@ -77,6 +79,7 @@ void WebTab::SavedTab::clear() zoomLevel = qzSettings->defaultZoomLevel; parentTab = -1; childTabs.clear(); + sessionData.clear(); } QDataStream &operator <<(QDataStream &stream, const WebTab::SavedTab &tab) @@ -90,6 +93,7 @@ QDataStream &operator <<(QDataStream &stream, const WebTab::SavedTab &tab) stream << tab.zoomLevel; stream << tab.parentTab; stream << tab.childTabs; + stream << tab.sessionData; return stream; } @@ -120,6 +124,9 @@ QDataStream &operator >>(QDataStream &stream, WebTab::SavedTab &tab) if (version >= 5) stream >> tab.childTabs; + if (version >= 6) + stream >> tab.sessionData; + tab.icon = QIcon(pixmap); return stream; @@ -498,6 +505,16 @@ QVector WebTab::childTabs() const return m_childTabs; } +QHash WebTab::sessionData() const +{ + return m_sessionData; +} + +void WebTab::setSessionData(const QString &key, const QVariant &value) +{ + m_sessionData[key] = value; +} + bool WebTab::isRestored() const { return !m_savedTab.isValid(); @@ -508,6 +525,7 @@ void WebTab::restoreTab(const WebTab::SavedTab &tab) Q_ASSERT(m_tabBar); setPinned(tab.isPinned); + m_sessionData = tab.sessionData; if (!isPinned() && qzSettings->loadTabsOnActivation) { m_savedTab = tab; diff --git a/src/lib/webtab/webtab.h b/src/lib/webtab/webtab.h index 7bf657e98..90d04c9df 100644 --- a/src/lib/webtab/webtab.h +++ b/src/lib/webtab/webtab.h @@ -48,6 +48,7 @@ public: int zoomLevel; int parentTab; QVector childTabs; + QHash sessionData; SavedTab(); SavedTab(WebTab* webTab); @@ -73,9 +74,11 @@ public: WebTab *parentTab() const; void setParentTab(WebTab *tab); void addChildTab(WebTab *tab, int index = -1); - QVector childTabs() const; + QHash sessionData() const; + void setSessionData(const QString &key, const QVariant &value); + QUrl url() const; QString title(bool allowEmpty = false) const; QIcon icon(bool allowNull = false) const; @@ -160,6 +163,7 @@ private: WebTab *m_parentTab = nullptr; QVector m_childTabs; + QHash m_sessionData; SavedTab m_savedTab; bool m_isPinned = false;