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

Qt5: Added info about Qt version into session files.

It will break restoring sessions from Qt4 into Qt5.
QupZilla can now run with Qt5.
(there are still some issues to be resolved)
This commit is contained in:
nowrep 2012-12-20 15:22:14 +01:00
parent 89e091f09c
commit 365c0d5efd
5 changed files with 18 additions and 9 deletions

View File

@ -891,9 +891,6 @@ void MainApplication::aboutToCloseWindow(QupZilla* window)
m_mainWindows.removeOne(window);
}
// Version of session.dat file
static const int sessionVersion = 0x0003;
bool MainApplication::saveStateSlot()
{
if (m_isPrivateSession || m_isRestoring || m_mainWindows.count() == 0 || m_restoreManager) {
@ -904,7 +901,7 @@ bool MainApplication::saveStateSlot()
file.open(QIODevice::WriteOnly);
QDataStream stream(&file);
stream << sessionVersion;
stream << Qz::sessionVersion;
stream << m_mainWindows.count();
for (int i = 0; i < m_mainWindows.count(); i++) {

View File

@ -28,6 +28,12 @@
namespace Qz
{
// Version of session.dat file
#if QT_VERSION >= 0x050000
static const int sessionVersion = 0x0003 & 0x050000;
#else
static const int sessionVersion = 0x0003 & 0x040000;
#endif
enum AppMessageType {
AM_SetAdBlockIconEnabled,

View File

@ -30,9 +30,6 @@ RestoreData RestoreManager::restoreData() const
return m_data;
}
// Version of session.dat file
static const int sessionVersion = 0x0003;
void RestoreManager::createFromFile(const QString &file)
{
if (!QFile::exists(file)) {
@ -45,7 +42,7 @@ void RestoreManager::createFromFile(const QString &file)
int version;
stream >> version;
if (version != sessionVersion) {
if (version != Qz::sessionVersion) {
return;
}

View File

@ -20,8 +20,9 @@
#define RESTOREMANAGER_H
#include "webtab.h"
#include "qz_namespace.h"
class RestoreManager
class QT_QUPZILLA_EXPORT RestoreManager
{
public:
struct WindowData {

View File

@ -723,6 +723,8 @@ void TabWidget::savePinnedTabs()
QByteArray data;
QDataStream stream(&data, QIODevice::WriteOnly);
stream << Qz::sessionVersion;
QStringList tabs;
QList<QByteArray> tabsHistory;
for (int i = 0; i < count(); ++i) {
@ -760,6 +762,12 @@ void TabWidget::restorePinnedTabs()
return;
}
int version;
stream >> version;
if (version != Qz::sessionVersion) {
return;
}
QStringList pinnedTabs;
stream >> pinnedTabs;
QList<QByteArray> tabHistory;