Accepting request 854652 from home:Vogtinator:branches:KDE:Applications
- Add patch to fix appearance on the first start (kde#429447): * 0001-Update-cached-viewContainer-geometry-every-time-they.patch OBS-URL: https://build.opensuse.org/request/show/854652 OBS-URL: https://build.opensuse.org/package/show/KDE:Applications/dolphin?expand=0&rev=234
This commit is contained in:
parent
4cd4e49ef3
commit
a32f572178
205
0001-Update-cached-viewContainer-geometry-every-time-they.patch
Normal file
205
0001-Update-cached-viewContainer-geometry-every-time-they.patch
Normal file
@ -0,0 +1,205 @@
|
||||
From 5c5198981e64a7ed5c60e24b43a043bac18d8a93 Mon Sep 17 00:00:00 2001
|
||||
From: Felix Ernst <fe.a.ernst@gmail.com>
|
||||
Date: Fri, 27 Nov 2020 18:44:48 +0100
|
||||
Subject: [PATCH] Update cached viewContainer geometry every time they are used
|
||||
|
||||
---
|
||||
src/dolphinnavigatorswidgetaction.cpp | 62 ++++++++++++++++-----------
|
||||
src/dolphinnavigatorswidgetaction.h | 18 +++++---
|
||||
src/dolphintabpage.cpp | 26 ++++-------
|
||||
3 files changed, 57 insertions(+), 49 deletions(-)
|
||||
|
||||
diff --git a/src/dolphinnavigatorswidgetaction.cpp b/src/dolphinnavigatorswidgetaction.cpp
|
||||
index b8c77c69b..e534b9bb4 100644
|
||||
--- a/src/dolphinnavigatorswidgetaction.cpp
|
||||
+++ b/src/dolphinnavigatorswidgetaction.cpp
|
||||
@@ -53,31 +53,12 @@ void DolphinNavigatorsWidgetAction::createSecondaryUrlNavigator()
|
||||
updateText();
|
||||
}
|
||||
|
||||
-void DolphinNavigatorsWidgetAction::followViewContainerGeometry(
|
||||
- int globalXOfPrimary, int widthOfPrimary)
|
||||
+void DolphinNavigatorsWidgetAction::followViewContainersGeometry(QWidget *primaryViewContainer,
|
||||
+ QWidget *secondaryViewContainer)
|
||||
{
|
||||
- followViewContainersGeometry(globalXOfPrimary, widthOfPrimary, INT_MIN, INT_MIN);
|
||||
-}
|
||||
-
|
||||
-void DolphinNavigatorsWidgetAction::followViewContainersGeometry(
|
||||
- int globalXOfPrimary, int widthOfPrimary,
|
||||
- int globalXOfSecondary, int widthOfSecondary)
|
||||
-{
|
||||
- if (QApplication::layoutDirection() == Qt::LeftToRight) {
|
||||
- m_globalXOfSplitter = m_splitter->mapToGlobal(QPoint(0,0)).x();
|
||||
- m_globalXOfPrimary = globalXOfPrimary;
|
||||
- m_globalXOfSecondary = globalXOfSecondary;
|
||||
- } else {
|
||||
- // When the direction is reversed, globalX does not change.
|
||||
- // For the adjustSpacing() code to work we need globalX to measure from right to left
|
||||
- // and to measure up to the rightmost point of a widget instead of the leftmost.
|
||||
- m_globalXOfSplitter = (-1) * (m_splitter->mapToGlobal(QPoint(0,0)).x() + m_splitter->width());
|
||||
- m_globalXOfPrimary = (-1) * (globalXOfPrimary + widthOfPrimary);
|
||||
- m_globalXOfSecondary = (globalXOfSecondary == INT_MIN) ? INT_MIN :
|
||||
- (-1) * (globalXOfSecondary + widthOfSecondary);
|
||||
- }
|
||||
- m_widthOfPrimary = widthOfPrimary;
|
||||
- m_widthOfSecondary = widthOfSecondary;
|
||||
+ Q_CHECK_PTR(primaryViewContainer);
|
||||
+ m_primaryViewContainer = primaryViewContainer;
|
||||
+ m_secondaryViewContainer = secondaryViewContainer;
|
||||
adjustSpacing();
|
||||
}
|
||||
|
||||
@@ -139,6 +120,7 @@ void DolphinNavigatorsWidgetAction::deleteWidget(QWidget *widget)
|
||||
|
||||
void DolphinNavigatorsWidgetAction::adjustSpacing()
|
||||
{
|
||||
+ updateCachedViewGeometry();
|
||||
Q_ASSERT(m_globalXOfSplitter != INT_MIN);
|
||||
Q_ASSERT(m_globalXOfPrimary != INT_MIN);
|
||||
Q_ASSERT(m_widthOfPrimary != INT_MIN);
|
||||
@@ -262,6 +244,38 @@ QWidget *DolphinNavigatorsWidgetAction::spacing(Side side, Position position) co
|
||||
return m_splitter->widget(sideIndex)->layout()->itemAt(2)->widget();
|
||||
}
|
||||
|
||||
+void DolphinNavigatorsWidgetAction::updateCachedViewGeometry()
|
||||
+{
|
||||
+ Q_ASSERT(m_primaryViewContainer);
|
||||
+ m_widthOfPrimary = m_primaryViewContainer->width();
|
||||
+ if (m_secondaryViewContainer) {
|
||||
+ m_widthOfSecondary = m_secondaryViewContainer->width();
|
||||
+ } else {
|
||||
+ m_widthOfSecondary = INT_MIN;
|
||||
+ }
|
||||
+
|
||||
+ const int globalXOfSplitter = m_splitter->mapToGlobal(QPoint(0,0)).x();
|
||||
+ const int globalXOfPrimary = m_primaryViewContainer->mapToGlobal(QPoint(0,0)).x();
|
||||
+ int globalXOfSecondary = INT_MIN;
|
||||
+ if (m_secondaryViewContainer) {
|
||||
+ globalXOfSecondary = m_secondaryViewContainer->mapToGlobal(QPoint(0,0)).x();
|
||||
+ }
|
||||
+
|
||||
+ if (QApplication::layoutDirection() == Qt::LeftToRight) {
|
||||
+ m_globalXOfSplitter = globalXOfSplitter;
|
||||
+ m_globalXOfPrimary = globalXOfPrimary;
|
||||
+ m_globalXOfSecondary = globalXOfSecondary;
|
||||
+ } else {
|
||||
+ // When the direction is reversed, globalX does not change.
|
||||
+ // For the adjustSpacing() code to work we need globalX to measure from right to left
|
||||
+ // and to measure up to the rightmost point of a widget instead of the leftmost.
|
||||
+ m_globalXOfSplitter = (-1) * (globalXOfSplitter + m_splitter->width());
|
||||
+ m_globalXOfPrimary = (-1) * (globalXOfPrimary + m_widthOfPrimary);
|
||||
+ m_globalXOfSecondary = (globalXOfSecondary == INT_MIN) ? INT_MIN :
|
||||
+ (-1) * (globalXOfSecondary + m_widthOfSecondary);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void DolphinNavigatorsWidgetAction::updateText()
|
||||
{
|
||||
const int urlNavigatorsAmount = m_splitter->count() > 1 && m_splitter->widget(1)->isVisible() ?
|
||||
diff --git a/src/dolphinnavigatorswidgetaction.h b/src/dolphinnavigatorswidgetaction.h
|
||||
index bbd8cf127..32d52e5d1 100644
|
||||
--- a/src/dolphinnavigatorswidgetaction.h
|
||||
+++ b/src/dolphinnavigatorswidgetaction.h
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include "dolphinurlnavigator.h"
|
||||
|
||||
+#include <QPointer>
|
||||
#include <QSplitter>
|
||||
#include <QTimer>
|
||||
#include <QWidgetAction>
|
||||
@@ -52,17 +53,12 @@ public:
|
||||
*/
|
||||
void createSecondaryUrlNavigator();
|
||||
|
||||
- /**
|
||||
- * Notify the primary UrlNavigator of changes in geometry of the ViewContainer it tries to be
|
||||
- * aligned with. Only call this method if there is no secondary UrlNavigator.
|
||||
- */
|
||||
- void followViewContainerGeometry(int globalXOfPrimary, int widthOfPrimary);
|
||||
/**
|
||||
* Notify this widget of changes in geometry of the ViewContainers it tries to be
|
||||
* aligned with.
|
||||
*/
|
||||
- void followViewContainersGeometry(int globalXOfPrimary, int widthOfPrimary,
|
||||
- int globalXOfSecondary, int widthOfSecondary);
|
||||
+ void followViewContainersGeometry(QWidget *primaryViewContainer,
|
||||
+ QWidget *secondaryViewContainer = nullptr);
|
||||
|
||||
bool isInToolbar() const;
|
||||
|
||||
@@ -141,11 +137,19 @@ private:
|
||||
*/
|
||||
QWidget *spacing(Side side, Position position) const;
|
||||
|
||||
+ void updateCachedViewGeometry();
|
||||
+
|
||||
/**
|
||||
* Sets this action's text depending on the amount of visible UrlNavigators.
|
||||
*/
|
||||
void updateText();
|
||||
|
||||
+ /**
|
||||
+ * The viewContainers are only remembered for the adjustSpacing calculations.
|
||||
+ */
|
||||
+ QPointer<const QWidget> m_primaryViewContainer;
|
||||
+ QPointer<const QWidget> m_secondaryViewContainer;
|
||||
+
|
||||
/**
|
||||
* The defaultWidget() of this QWidgetAction.
|
||||
*/
|
||||
diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp
|
||||
index 138822cfd..d64c87d75 100644
|
||||
--- a/src/dolphintabpage.cpp
|
||||
+++ b/src/dolphintabpage.cpp
|
||||
@@ -167,7 +167,8 @@ void DolphinTabPage::connectNavigators(DolphinNavigatorsWidgetAction *navigators
|
||||
auto secondaryNavigator = navigatorsWidget->secondaryUrlNavigator();
|
||||
m_secondaryViewContainer->connectUrlNavigator(secondaryNavigator);
|
||||
}
|
||||
- resizeNavigators();
|
||||
+ m_navigatorsWidget->followViewContainersGeometry(m_primaryViewContainer,
|
||||
+ m_secondaryViewContainer);
|
||||
}
|
||||
|
||||
void DolphinTabPage::disconnectNavigators()
|
||||
@@ -182,7 +183,12 @@ void DolphinTabPage::disconnectNavigators()
|
||||
bool DolphinTabPage::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::Resize && m_navigatorsWidget) {
|
||||
- resizeNavigators();
|
||||
+ if (!m_splitViewEnabled) {
|
||||
+ m_navigatorsWidget->followViewContainersGeometry(m_primaryViewContainer);
|
||||
+ } else {
|
||||
+ m_navigatorsWidget->followViewContainersGeometry(m_primaryViewContainer,
|
||||
+ m_secondaryViewContainer);
|
||||
+ }
|
||||
return false;
|
||||
}
|
||||
return QWidget::eventFilter(watched, event);
|
||||
@@ -201,22 +207,6 @@ void DolphinTabPage::insertNavigatorsWidget(DolphinNavigatorsWidgetAction* navig
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
-void DolphinTabPage::resizeNavigators() const
|
||||
-{
|
||||
- if (!m_splitViewEnabled) {
|
||||
- m_navigatorsWidget->followViewContainerGeometry(
|
||||
- m_primaryViewContainer->mapToGlobal(QPoint(0,0)).x(),
|
||||
- m_primaryViewContainer->width());
|
||||
- } else {
|
||||
- m_navigatorsWidget->followViewContainersGeometry(
|
||||
- m_primaryViewContainer->mapToGlobal(QPoint(0,0)).x(),
|
||||
- m_primaryViewContainer->width(),
|
||||
- m_secondaryViewContainer->mapToGlobal(QPoint(0,0)).x(),
|
||||
- m_secondaryViewContainer->width());
|
||||
- }
|
||||
-}
|
||||
-
|
||||
void DolphinTabPage::markUrlsAsSelected(const QList<QUrl>& urls)
|
||||
{
|
||||
m_primaryViewContainer->view()->markUrlsAsSelected(urls);
|
||||
--
|
||||
2.25.1
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 10 19:14:25 UTC 2020 - Fabian Vogt <fabian@ritter-vogt.de>
|
||||
|
||||
- Add patch to fix appearance on the first start (kde#429447):
|
||||
* 0001-Update-cached-viewContainer-geometry-every-time-they.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Dec 5 23:15:24 UTC 2020 - Luca Beltrame <lbeltrame@kde.org>
|
||||
|
||||
|
@ -30,8 +30,10 @@ URL: https://www.kde.org
|
||||
Source: https://download.kde.org/stable/release-service/%{version}/src/%{name}-%{version}.tar.xz
|
||||
Source3: dolphinsu.desktop
|
||||
Patch0: dolphin-go_up.diff
|
||||
# PATCH-FIX-UPSTREAM
|
||||
Patch1: 0001-Update-cached-viewContainer-geometry-every-time-they.patch
|
||||
# PATCH-FIX-OPENSUSE
|
||||
Patch1: 0001-Revert-Disallow-executing-Dolphin-as-root-on-Linux.patch
|
||||
Patch100: 0001-Revert-Disallow-executing-Dolphin-as-root-on-Linux.patch
|
||||
BuildRequires: extra-cmake-modules >= 1.6.0
|
||||
BuildRequires: systemd-rpm-macros
|
||||
BuildRequires: update-desktop-files
|
||||
|
Loading…
x
Reference in New Issue
Block a user