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

Qt4: Fixed broken session restoring.

Adding Qt version into sessionVersion number
only when using Qt 5.

Closes #689
This commit is contained in:
nowrep 2012-12-25 16:56:23 +01:00
parent 02ea92ad28
commit 64355e2a3d
4 changed files with 12 additions and 2 deletions

View File

@ -269,6 +269,9 @@ MainApplication::MainApplication(int &argc, char** argv)
} }
if (m_startingAfterCrash || afterLaunch == 3) { if (m_startingAfterCrash || afterLaunch == 3) {
m_restoreManager = new RestoreManager(m_activeProfil + "session.dat"); m_restoreManager = new RestoreManager(m_activeProfil + "session.dat");
if (!m_restoreManager->isValid()) {
destroyRestoreManager();
}
} }
} }

View File

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

View File

@ -30,6 +30,11 @@ RestoreData RestoreManager::restoreData() const
return m_data; return m_data;
} }
bool RestoreManager::isValid() const
{
return !m_data.isEmpty();
}
void RestoreManager::createFromFile(const QString &file) void RestoreManager::createFromFile(const QString &file)
{ {
if (!QFile::exists(file)) { if (!QFile::exists(file)) {
@ -42,6 +47,7 @@ void RestoreManager::createFromFile(const QString &file)
int version; int version;
stream >> version; stream >> version;
if (version != Qz::sessionVersion) { if (version != Qz::sessionVersion) {
return; return;
} }

View File

@ -34,6 +34,7 @@ public:
RestoreManager(const QString &sessionFile); RestoreManager(const QString &sessionFile);
QList<RestoreManager::WindowData> restoreData() const; QList<RestoreManager::WindowData> restoreData() const;
bool isValid() const;
private: private:
void createFromFile(const QString &file); void createFromFile(const QString &file);