┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNate Graham <[email protected]>2021-08-02 10:32:31 -0600
committerNate Graham <[email protected]>2021-08-02 10:32:31 -0600
commitd472cb2a25cef38dbebbd0ec9073e4ec05d65272 (patch)
tree86d221422773d75835d65ba14d71cdcf15fe81c1 /src
parent393c659c9a0ffc5f6ddb4ee161b9b3937ead0145 (diff)
parentf190ae1cf8fc1c1bf0d87899a84f796a3e473032 (diff)
Merge branch 'release/21.08'
Diffstat (limited to 'src')
-rw-r--r--src/dolphinmainwindow.cpp14
-rw-r--r--src/dolphinmainwindow.h6
-rw-r--r--src/dolphinnavigatorswidgetaction.cpp13
-rw-r--r--src/dolphinnavigatorswidgetaction.h6
-rw-r--r--src/main.cpp10
5 files changed, 23 insertions, 26 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 9712b99bc..0b1ebe765 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -237,20 +237,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);
diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h
index 594c75691..3a29d1c0a 100644
--- a/src/dolphinmainwindow.h
+++ b/src/dolphinmainwindow.h
@@ -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;
diff --git a/src/dolphinnavigatorswidgetaction.cpp b/src/dolphinnavigatorswidgetaction.cpp
index d66125af6..4da5229ff 100644
--- a/src/dolphinnavigatorswidgetaction.cpp
+++ b/src/dolphinnavigatorswidgetaction.cpp
@@ -47,6 +47,7 @@ DolphinNavigatorsWidgetAction::DolphinNavigatorsWidgetAction(QWidget *parent) :
void DolphinNavigatorsWidgetAction::adjustSpacing()
{
+ m_previousWindowWidth = parentWidget()->window()->width();
auto viewGeometries = m_viewGeometriesHelper.viewGeometries();
const int widthOfSplitterPrimary = viewGeometries.globalXOfPrimary + viewGeometries.widthOfPrimary - viewGeometries.globalXOfNavigatorsWidget;
const QList<int> splitterSizes = {widthOfSplitterPrimary,
@@ -310,7 +311,17 @@ DolphinNavigatorsWidgetAction::ViewGeometriesHelper::ViewGeometriesHelper
bool DolphinNavigatorsWidgetAction::ViewGeometriesHelper::eventFilter(QObject *watched, QEvent *event)
{
if (event->type() == QEvent::Resize) {
- m_navigatorsWidgetAction->adjustSpacing();
+ if (m_navigatorsWidgetAction->parentWidget()->window()->width() != m_navigatorsWidgetAction->m_previousWindowWidth) {
+ // The window is being resized which means not all widgets have gotten their new sizes yet.
+ // Let's wait a bit so the sizes of the navigatorsWidget and the viewContainers have all
+ // had a chance to be updated.
+ m_navigatorsWidgetAction->m_adjustSpacingTimer->start();
+ } else {
+ m_navigatorsWidgetAction->adjustSpacing();
+ // We could always use the m_adjustSpacingTimer instead of calling adjustSpacing() directly
+ // here but then the navigatorsWidget doesn't fluently align with the viewContainers when
+ // the DolphinTabPage::m_expandViewAnimation is animating.
+ }
return false;
}
return QObject::eventFilter(watched, event);
diff --git a/src/dolphinnavigatorswidgetaction.h b/src/dolphinnavigatorswidgetaction.h
index 6f5f8e7af..3f50728e9 100644
--- a/src/dolphinnavigatorswidgetaction.h
+++ b/src/dolphinnavigatorswidgetaction.h
@@ -216,6 +216,12 @@ private:
};
ViewGeometriesHelper m_viewGeometriesHelper;
+
+ /**
+ * Used to check if the window has been resized.
+ * @see ViewGeometriesHelper::eventFilter() for why this is needed.
+ */
+ int m_previousWindowWidth = -1;
};
#endif // DOLPHINNAVIGATORSWIDGETACTION_H
diff --git a/src/main.cpp b/src/main.cpp
index ba894ec38..779690c1c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -210,12 +210,12 @@ int main(int argc, char **argv)
// If the user passed any URLs to Dolphin, open those in the
// window after session-restoring it
if (startedWithURLs) {
- mainWindow->openDirectories(urls, splitView);
+ if (openFiles) {
+ mainWindow->openFiles(urls, splitView);
+ } else {
+ 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!";
}