diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -186,6 +186,15 @@
toolBar()->installEventFilter(middleClickEventFilter);
setupWhatsThis();
+
+ // Restore window state
+ if (GeneralSettings::rememberOpenedTabs()) {
+ // Wait for the initialization ending
+ QTimer::singleShot(0, [this]() {
+ KConfigGroup windowState{KSharedConfig::openConfig(QStringLiteral("dolphinrc")), "WindowState"};
+ readProperties(windowState);
+ });
+ }
}
DolphinMainWindow::~DolphinMainWindow()
@@ -534,6 +543,11 @@
}
}
+ if (GeneralSettings::rememberOpenedTabs()) {
+ KConfigGroup windowState{KSharedConfig::openConfig(QStringLiteral("dolphinrc")), "WindowState"};
+ saveProperties(windowState);
+ }
+
GeneralSettings::setVersion(CurrentDolphinVersion);
GeneralSettings::self()->save();
diff --git a/src/settings/dolphin_generalsettings.kcfg b/src/settings/dolphin_generalsettings.kcfg
--- a/src/settings/dolphin_generalsettings.kcfg
+++ b/src/settings/dolphin_generalsettings.kcfg
@@ -42,6 +42,10 @@
QUrl::fromLocalFile(QDir::homePath()).toDisplayString(QUrl::PreferLocalFile)
+
+
+ false
+
false
diff --git a/src/settings/startup/startupsettingspage.h b/src/settings/startup/startupsettingspage.h
--- a/src/settings/startup/startupsettingspage.h
+++ b/src/settings/startup/startupsettingspage.h
@@ -59,6 +59,7 @@
QUrl m_url;
QLineEdit* m_homeUrl;
+ QCheckBox* m_rememberOpenedTabs;
QCheckBox* m_splitView;
QCheckBox* m_editableUrl;
QCheckBox* m_showFullPath;
diff --git a/src/settings/startup/startupsettingspage.cpp b/src/settings/startup/startupsettingspage.cpp
--- a/src/settings/startup/startupsettingspage.cpp
+++ b/src/settings/startup/startupsettingspage.cpp
@@ -90,9 +90,11 @@
topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
+ m_rememberOpenedTabs = new QCheckBox(i18nc("@option:check Startup Settings", "Remember open folders and tabs"));
+ topLayout->addRow(i18nc("@label:checkbox", "Window options:"), m_rememberOpenedTabs);
// create 'Split view', 'Show full path', 'Editable location' and 'Filter bar' checkboxes
m_splitView = new QCheckBox(i18nc("@option:check Startup Settings", "Split view mode"));
- topLayout->addRow(i18nc("@label:checkbox", "Window options:"), m_splitView);
+ topLayout->addRow(QString(), m_splitView);
m_editableUrl = new QCheckBox(i18nc("@option:check Startup Settings", "Editable location bar"));
topLayout->addRow(QString(), m_editableUrl);
m_showFullPath = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path inside location bar"));
@@ -108,6 +110,7 @@
loadSettings();
connect(m_homeUrl, &QLineEdit::textChanged, this, &StartupSettingsPage::slotSettingsChanged);
+ connect(m_rememberOpenedTabs, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged);
connect(m_splitView, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged);
connect(m_editableUrl, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged);
connect(m_showFullPath, &QCheckBox::toggled, this, &StartupSettingsPage::slotSettingsChanged);
@@ -132,6 +135,7 @@
KMessageBox::error(this, i18nc("@info", "The location for the home folder is invalid or does not exist, it will not be applied."));
}
+ settings->setRememberOpenedTabs(m_rememberOpenedTabs->isChecked());
settings->setSplitView(m_splitView->isChecked());
settings->setEditableUrl(m_editableUrl->isChecked());
settings->setShowFullPath(m_showFullPath->isChecked());
@@ -182,6 +186,7 @@
{
const QUrl url(Dolphin::homeUrl());
m_homeUrl->setText(url.toDisplayString(QUrl::PreferLocalFile));
+ m_rememberOpenedTabs->setChecked(GeneralSettings::rememberOpenedTabs());
m_splitView->setChecked(GeneralSettings::splitView());
m_editableUrl->setChecked(GeneralSettings::editableUrl());
m_showFullPath->setChecked(GeneralSettings::showFullPath());