]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Revert "Don't session-restore invalid paths"
authorNate Graham <nate@kde.org>
Wed, 28 Jul 2021 18:54:10 +0000 (12:54 -0600)
committerNate Graham <nate@kde.org>
Wed, 28 Jul 2021 18:59:29 +0000 (12:59 -0600)
This reverts commit c733b3aa9787a618a0ce5bb03b3fc731f5663b21.

There are people who prefer the old behavior of session-restoring all
paths including the ones which are currently inaccessible. The idea is
that Dolphin is like a web browser; if a website is not currently
available, the browser tells you that instead of silently discarding the
URL and showing you the homepage. Doing this can be considered a form
of data loss.

In addition, the reason for the change was to prevent Dolphin from
showing invalid paths on launch for unmounted removable disks, but that
specific case was fixed separately by switching to ~ for any tabs/views
that were showing locations on a just-unmounted removable disk. So you
will never run into the problem if yo unmount a disk in Dolphin and then
close it.

Accordingly, let's revert the change because it causes more problems than
it resolves.

BUG: 439864
CCBUG: 427619
FIXED-IN: 21.08

src/dolphinmainwindow.cpp
src/dolphinmainwindow.h
src/main.cpp

index fe39d4d2fbabf7e298cf0aef52d79e377ccce393..52b3e8d6abe86b2ca9550b6f20c44a81caddfdc4 100644 (file)
@@ -239,20 +239,6 @@ QVector<DolphinViewContainer*> DolphinMainWindow::viewContainers() const
     return viewContainers;
 }
 
-void DolphinMainWindow::setViewsWithInvalidPathsToHome()
-{
-    const QVector<DolphinViewContainer*> theViewContainers = viewContainers();
-    for (DolphinViewContainer *viewContainer : theViewContainers) {
-
-        // Only consider local dirs, not remote locations and abstract protocols
-        if (viewContainer->url().isLocalFile()) {
-            if (!QFileInfo::exists(viewContainer->url().toLocalFile())) {
-                viewContainer->setUrl(QUrl::fromLocalFile(QDir::homePath()));
-            }
-        }
-    }
-}
-
 void DolphinMainWindow::openDirectories(const QList<QUrl>& dirs, bool splitView)
 {
     m_tabWidget->openDirectories(dirs, splitView);
index 594c75691f72970aaa71971332fd4637b81203a1..3a29d1c0a483bef09e16e21e89c72032e43b00fc 100644 (file)
@@ -105,12 +105,6 @@ public:
      */
     void setViewsToHomeIfMountPathOpen(const QString& mountPath);
 
-    /**
-     * Sets any of the window's view containers which are currently displaying
-     * invalid locations to the home path
-     */
-    void setViewsWithInvalidPathsToHome();
-
     bool isFoldersPanelEnabled() const;
     bool isInformationPanelEnabled() const;
 
index fba45f43c431b9698e272c5d3676e1e8a3490a9f..76b482688a411b63b7008d12e4847194b03bc039 100644 (file)
@@ -204,10 +204,6 @@ int main(int argc, char **argv)
                 if (startedWithURLs) {
                     mainWindow->openDirectories(urls, splitView);
                 }
-
-                // Now handle invalid locations in the set of active views to
-                // avoid issues like https://bugs.kde.org/show_bug.cgi?id=427619
-                mainWindow->setViewsWithInvalidPathsToHome();
             } else {
                 qCWarning(DolphinDebug) << "Unknown class " << className << " in session saved data!";
             }