]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fix session restore
authorFelix Ernst <felixernst@zohomail.eu>
Tue, 15 Apr 2025 21:06:26 +0000 (23:06 +0200)
committerFelix Ernst <felixernst@kde.org>
Wed, 16 Apr 2025 13:27:41 +0000 (13:27 +0000)
Since https://commits.kde.org/kxmlgui/8c9fb02a1d37672b26a03a9dd9e8675743deb269
KXmlGui only triggers a session restore for a window when the
session config contains a "NumberOfWindows" key with a value >= 1.
This commit adds such a key to the Dolphin session config, which
fixes the Dolphin main window restore for KXmlGui versions
containing that commit.

BUG: 502770

src/dolphinmainwindow.cpp

index 106f0e44be3fbfdefd52d550cb11047d59fdf801..67db2c5e9d597dd0c6180eed75eed79f6525d9f2 100644 (file)
@@ -760,6 +760,8 @@ void DolphinMainWindow::slotSaveSession()
         KConfig *config = KConfigGui::sessionConfig();
         saveGlobalProperties(config);
         savePropertiesInternal(config, 1);
+        KConfigGroup group = config->group(QStringLiteral("Number"));
+        group.writeEntry("NumberOfWindows", 1); // Makes session restore aware that there is a window to restore.
 
         auto future = QtConcurrent::run([config]() {
             config->sync();