Verified Commit 9a1addb6 authored by Jonah Brüchert's avatar Jonah Brüchert 🌳
Browse files

Make it impossible to save tabs until old ones are loaded

parent 67c001cc
......@@ -36,7 +36,6 @@ TabsModel::TabsModel(QObject *parent) : QAbstractListModel(parent) {
m_tabsReadOnly = true;
// Make sure model always contains at least one tab
createEmptyTab();
m_tabsReadOnly = false;
}
QHash<int, QByteArray> TabsModel::roleNames() const
......@@ -105,16 +104,27 @@ TabState TabsModel::tab(int index) {
* @brief TabsModel::loadInitialTabs sets up the tabs that should already be open when starting the browser
* This includes the configured homepage, an url passed on the command line (usually by another app) and tabs
* which were still open when the browser was last closed.
*
* @warning It is impossible to save any new tabs until this function was called.
*/
void TabsModel::loadInitialTabs()
{
if (m_privateMode) return;
if (!m_privateMode) {
loadTabs();
}
m_tabsReadOnly = false;
if (!m_privateMode) {
if (AngelFish::BrowserManager::instance()->initialUrl().isEmpty()) {
if (!loadTabs() && m_tabs.first().url() == QStringLiteral("about:blank")) {
if (m_tabs.first().url() == QStringLiteral("about:blank"))
load(AngelFish::BrowserManager::instance()->homepage());
}
} else {
if (m_tabs.first().url() == QStringLiteral("about:blank"))
load(AngelFish::BrowserManager::instance()->initialUrl());
else
newTab(AngelFish::BrowserManager::instance()->initialUrl());
}
}
}
......@@ -199,7 +209,7 @@ bool TabsModel::loadTabs()
bool TabsModel::saveTabs() const
{
// only save if not in private mode
if (!m_privateMode && !m_tabsReadOnly) {
if (!m_privateMode) {
QString outputDir = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)
+ QStringLiteral("/angelfish/");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment