1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Fix WebTab::SavedTab incompatibility with older versions

@innermous
This commit is contained in:
David Rosca 2015-12-17 22:26:32 +01:00
parent 5801ff0725
commit e4b5a416b3

View File

@ -35,10 +35,11 @@
#include <QSplitter> #include <QSplitter>
bool WebTab::s_pinningTab = false; bool WebTab::s_pinningTab = false;
static const int savedTabVersion = 2; static const int savedTabVersion = 3;
WebTab::SavedTab::SavedTab() WebTab::SavedTab::SavedTab()
: isPinned(false) : isPinned(false)
, zoomLevel(qzSettings->defaultZoomLevel)
{ {
} }
@ -47,9 +48,9 @@ WebTab::SavedTab::SavedTab(WebTab* webTab)
title = webTab->title(); title = webTab->title();
url = webTab->url(); url = webTab->url();
icon = webTab->icon(); icon = webTab->icon();
zoomLevel = webTab->zoomLevel();
history = webTab->historyData(); history = webTab->historyData();
isPinned = webTab->isPinned(); isPinned = webTab->isPinned();
zoomLevel = webTab->zoomLevel();
} }
bool WebTab::SavedTab::isValid() const bool WebTab::SavedTab::isValid() const
@ -64,6 +65,7 @@ void WebTab::SavedTab::clear()
icon = QIcon(); icon = QIcon();
history.clear(); history.clear();
isPinned = false; isPinned = false;
zoomLevel = qzSettings->defaultZoomLevel;
} }
QDataStream &operator <<(QDataStream &stream, const WebTab::SavedTab &tab) QDataStream &operator <<(QDataStream &stream, const WebTab::SavedTab &tab)
@ -73,8 +75,8 @@ QDataStream &operator <<(QDataStream &stream, const WebTab::SavedTab &tab)
stream << tab.url; stream << tab.url;
stream << tab.icon.pixmap(16); stream << tab.icon.pixmap(16);
stream << tab.history; stream << tab.history;
stream << tab.zoomLevel;
stream << tab.isPinned; stream << tab.isPinned;
stream << tab.zoomLevel;
return stream; return stream;
} }
@ -92,11 +94,13 @@ QDataStream &operator >>(QDataStream &stream, WebTab::SavedTab &tab)
stream >> tab.url; stream >> tab.url;
stream >> pixmap; stream >> pixmap;
stream >> tab.history; stream >> tab.history;
stream >> tab.zoomLevel;
if (version >= 2) if (version >= 2)
stream >> tab.isPinned; stream >> tab.isPinned;
if (version >= 3)
stream >> tab.zoomLevel;
tab.icon = QIcon(pixmap); tab.icon = QIcon(pixmap);
return stream; return stream;