mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
[Session] Save session to QByteArray and then write it to file
Instead of appending data to file, write all session data at once. This should help preventing corrupting session.dat file. Closes #1247
This commit is contained in:
parent
f33552320f
commit
d0d1fa1844
|
@ -1188,9 +1188,8 @@ bool MainApplication::saveStateSlot()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFile file(m_activeProfil + "session.dat");
|
QByteArray data;
|
||||||
file.open(QIODevice::WriteOnly);
|
QDataStream stream(&data, QIODevice::WriteOnly);
|
||||||
QDataStream stream(&file);
|
|
||||||
|
|
||||||
stream << Qz::sessionVersion;
|
stream << Qz::sessionVersion;
|
||||||
stream << m_mainWindows.count();
|
stream << m_mainWindows.count();
|
||||||
|
@ -1208,13 +1207,17 @@ bool MainApplication::saveStateSlot()
|
||||||
stream << qz->saveState();
|
stream << qz->saveState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file.close();
|
|
||||||
|
|
||||||
BrowserWindow* qupzilla_ = getWindow();
|
BrowserWindow* qupzilla_ = getWindow();
|
||||||
if (qupzilla_ && m_mainWindows.count() == 1) {
|
if (qupzilla_ && m_mainWindows.count() == 1) {
|
||||||
qupzilla_->tabWidget()->savePinnedTabs();
|
qupzilla_->tabWidget()->savePinnedTabs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QFile file(m_activeProfil + QLatin1String("session.dat"));
|
||||||
|
file.open(QIODevice::WriteOnly);
|
||||||
|
file.write(data);
|
||||||
|
file.close();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user