X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/96ba990d865b2dfb966961061ba5154dcd3187b4..c5ba8a56e7f0144d2a74665b4fa459fd45ceedd6:/src/dolphinmainwindow.cpp diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index ccef356ea..b477600f0 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -31,7 +31,6 @@ #include "panels/information/informationpanel.h" #include "settings/dolphinsettingsdialog.h" #include "statusbar/dolphinstatusbar.h" -#include "views/dolphinview.h" #include "views/dolphinviewactionhandler.h" #include "views/dolphinremoteencoding.h" #include "views/draganddrophelper.h" @@ -244,20 +243,8 @@ void DolphinMainWindow::openDirectories(const QList& dirs) return; } - // dirs could contain URLs that actually point to archives or other files. - // Replace them by URLs we can open where possible and filter the rest out. - QList urlsToOpen; - foreach (const KUrl& rawUrl, dirs) { - const KFileItem& item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, rawUrl); - item.determineMimeType(); - const KUrl& url = DolphinView::openItemAsFolderUrl(item); - if (!url.isEmpty()) { - urlsToOpen.append(url); - } - } - - if (urlsToOpen.count() == 1) { - m_activeViewContainer->setUrl(urlsToOpen.first()); + if (dirs.count() == 1) { + m_activeViewContainer->setUrl(dirs.first()); return; } @@ -267,12 +254,12 @@ void DolphinMainWindow::openDirectories(const QList& dirs) // Open each directory inside a new tab. If the "split view" option has been enabled, // always show two directories within one tab. - QList::const_iterator it = urlsToOpen.begin(); - while (it != urlsToOpen.end()) { + QList::const_iterator it = dirs.begin(); + while (it != dirs.end()) { openNewTab(*it); ++it; - if (hasSplitView && (it != urlsToOpen.end())) { + if (hasSplitView && (it != dirs.end())) { const int tabIndex = m_viewTab.count() - 1; m_viewTab[tabIndex].secondaryView->setUrl(*it); ++it; @@ -1417,6 +1404,19 @@ void DolphinMainWindow::slotPanelErrorMessage(const QString& error) activeViewContainer()->showMessage(error, DolphinViewContainer::Error); } +void DolphinMainWindow::slotPlaceActivated(const KUrl& url) +{ + DolphinViewContainer* view = activeViewContainer(); + + if (view->url() == url) { + // We can end up here if the user clicked a device in the Places Panel + // which had been unmounted earlier, see https://bugs.kde.org/show_bug.cgi?id=161385. + reloadView(); + } else { + changeUrl(url); + } +} + void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContainer) { Q_ASSERT(viewContainer); @@ -1749,7 +1749,7 @@ void DolphinMainWindow::setupDockWidgets() addDockWidget(Qt::LeftDockWidgetArea, placesDock); connect(placesPanel, SIGNAL(placeActivated(KUrl)), - this, SLOT(changeUrl(KUrl))); + this, SLOT(slotPlaceActivated(KUrl))); connect(placesPanel, SIGNAL(placeMiddleClicked(KUrl)), this, SLOT(openNewTab(KUrl))); connect(placesPanel, SIGNAL(errorMessage(QString)),