Bug 422300

Summary: New feature to restore folders, tabs and window state on startup is not working
Product: [Applications] dolphin Reporter: Patrick Silva <bugseforuns>
Component: generalAssignee: Nate Graham <nate>
Status: RESOLVED FIXED    
Severity: normal CC: arojas, kfm-devel, nate
Priority: HI    
Version: 20.07.80   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 20.08.0
Sentry Crash Report:

Description Patrick Silva 2020-05-31 18:15:35 UTC
SUMMARY
Recently was impelemented a feature that saves folders, tabs and window state
when Dolphin is closed (see bug 413564) in master branch.
However, this new feature is not working on neon unstable despite "Show on startup" is set to "Folders, tabs, and window state from last time" in Dolphin settings.

STEPS TO REPRODUCE
1. make sure "Show on startup" is set to "Folders, tabs, and window state from last time" in Dolphin settings
2. open a few tabs
3. restart Dolphin

OBSERVED RESULT
Dolphin only shows Home. The tabs opened in the step 2 weren't restored.

EXPECTED RESULT
Dolphin should restore the tabs opened in the step 2 on startup

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.19.80
KDE Frameworks Version: 5.71.0
Qt Version: 5.14.2
Comment 1 Nate Graham 2020-06-01 01:51:30 UTC
I wondered when you were going to file a bug report on this. :)

It's not consistently working for me either. Sometimes it does, but it mostly does not. I haven't been able to figure out why yet.
Comment 2 Elvis Angelaccio 2020-07-18 17:36:03 UTC
*** Bug 424359 has been marked as a duplicate of this bug. ***
Comment 3 Antonio Rojas 2020-07-19 13:09:00 UTC
After frustratingly trying to figure out how to create pull requests for an hour, I'll just leave my fix here. The problem is caused by trying to call the dbus interface before initializing it.

diff --git a/src/main.cpp b/src/main.cpp
index 802e64d25..f0336f628 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -178,6 +178,9 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
 
     mainWindow->show();
 
+    KDBusService dolphinDBusService;
+    DBusInterface interface;
+
     if (!app.isSessionRestored()) {
         KConfigGui::setSessionConfig(QStringLiteral("dolphin"), QStringLiteral("dolphin"));
     }
@@ -200,8 +203,5 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
         }
     }
 
-    KDBusService dolphinDBusService;
-    DBusInterface interface;
-
     return app.exec(); // krazy:exclude=crash;
 }
Comment 4 Bug Janitor Service 2020-07-19 14:04:56 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/39
Comment 5 Nate Graham 2020-07-19 14:05:46 UTC
Thanks, I have submitted this for you: https://invent.kde.org/system/dolphin/-/merge_requests/39

Is there anything about the instructions located at https://community.kde.org/Infrastructure/GitLab that was unclear or could be improved?
Comment 6 Antonio Rojas 2020-07-19 16:07:00 UTC
(In reply to Nate Graham from comment #5)
> Is there anything about the instructions located at
> https://community.kde.org/Infrastructure/GitLab that was unclear or could be
> improved?

No, probably some dumb mistake on my side. Getting auth errors when pushing.
Comment 7 Nate Graham 2020-07-19 18:22:03 UTC
Git commit ce981c3e4af725646afe6e1916c508233188091e by Nate Graham, on behalf of Antonio Rojas.
Committed on 19/07/2020 at 14:03.
Pushed by ngraham into branch 'release/20.08'.

Fix "Show folders, tabs, and window state from last time" feature

We were using the DBus interface before declaring it, oops.
FIXED-IN: 20.08.0

M  +3    -3    src/main.cpp

https://invent.kde.org/system/dolphin/commit/ce981c3e4af725646afe6e1916c508233188091e