- Add patch to fix layout of icons in the file dialog (kde#352776):

* 0001-Fix-KFilePreviewGenerator-LayoutBlocker.patch

OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/kio?expand=0&rev=211
This commit is contained in:
Fabian Vogt 2018-01-12 07:51:24 +00:00 committed by Git OBS Bridge
parent d231d45713
commit 76923a8f97
3 changed files with 88 additions and 19 deletions

View File

@ -0,0 +1,64 @@
From fe2ce8fd25ceeb65e5889084e068de93c783ef62 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Thu, 11 Jan 2018 22:07:45 +0100
Subject: [PATCH] Fix KFilePreviewGenerator::LayoutBlocker
Summary:
QAbstractItemViews does layout in a timer event handler, to avoid unnecessary
layout calculations. Changes which cause a relayout only start the timer.
LayoutBlocker has the restriction that it only works if the event loop is not
entered during its lifetime. Without an event loop there's no expensive
relayout anyway, making the LayoutBlocker pointless in such cases.
LayoutBlocker works by changing the uniformItemSizes property of the QListView
to true and in the destructor back to the original value again. Those changes
do not trigger a relayout in QListView, so if the QListView did a layout with
uniformItemSizes set to true, it stays that way.
Fix it by triggering a relayout in ~LayoutBlocker.
This got exposed by a change in Qt, which results in QListView doing a relayout
while the LayoutBlocker is active.
BUG: 352776
Test Plan: kfilewidgettest_gui has proper item sizes now.
Reviewers: #frameworks, dfaure
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D9830
---
src/filewidgets/kfilepreviewgenerator.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/filewidgets/kfilepreviewgenerator.cpp b/src/filewidgets/kfilepreviewgenerator.cpp
index 7965ab84..15b8ab84 100644
--- a/src/filewidgets/kfilepreviewgenerator.cpp
+++ b/src/filewidgets/kfilepreviewgenerator.cpp
@@ -70,10 +70,7 @@
*
* QListView does not invoke QItemDelegate::sizeHint() when the
* uniformItemSize property has been set to true, so this property is
- * set before exchanging a block of icons. It is important to reset
- * it again before the event loop is entered, otherwise QListView
- * would not get the correct size hints after dispatching the layoutChanged()
- * signal.
+ * set before exchanging a block of icons.
*/
class KFilePreviewGenerator::LayoutBlocker
{
@@ -92,6 +89,11 @@ public:
{
if (m_view != nullptr) {
m_view->setUniformItemSizes(m_uniformSizes);
+ /* The QListView did the layout with uniform item
+ * sizes, so trigger a relayout with the expected sizes. */
+ if (!m_uniformSizes) {
+ m_view->setGridSize(m_view->gridSize());
+ }
}
}
--
2.15.1

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jan 12 07:48:05 UTC 2018 - fabian@ritter-vogt.de
- Add patch to fix layout of icons in the file dialog (kde#352776):
* 0001-Fix-KFilePreviewGenerator-LayoutBlocker.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Sun Dec 17 09:43:48 CET 2017 - lbeltrame@kde.org Sun Dec 17 09:43:48 CET 2017 - lbeltrame@kde.org

View File

@ -1,7 +1,7 @@
# #
# spec file for package kio # spec file for package kio
# #
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -18,14 +18,26 @@
%bcond_without lang %bcond_without lang
%define _tar_path 5.41 %define _tar_path 5.41
# Full KF5 version (e.g. 5.33.0)
%{!?_kf5_version: %global _kf5_version %{version}}
# Last major and minor KF5 version (e.g. 5.33)
%{!?_kf5_bugfix_version: %global _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')}
Name: kio Name: kio
Version: 5.41.0 Version: 5.41.0
Release: 0 Release: 0
%define kf5_version %{version} %define kf5_version %{version}
# Full KF5 version (e.g. 5.33.0)
%{!?_kf5_version: %global _kf5_version %{version}}
# Last major and minor KF5 version (e.g. 5.33)
%{!?_kf5_bugfix_version: %global _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')}
Summary: Network transparent access to files and data
License: LGPL-2.1+
Group: System/GUI/KDE
Url: http://www.kde.org
Source: http://download.kde.org/stable/frameworks/%{_tar_path}/%{name}-%{version}.tar.xz
Source1: baselibs.conf
# PATCH-FIX-OPENSUSE kio_help-fallback-to-kde4-docs.patch -- allow kio_help to see into kde4 documentation, needed especially for khelpcenter5
Patch0: kio_help-fallback-to-kde4-docs.patch
# PATCH-FIX-UPSTREAM
Patch1: fix-handling-of-KCookieAdvice_AcceptForSession.patch
# PATCH-FIX-UPSTREAM
Patch2: 0001-Fix-KFilePreviewGenerator-LayoutBlocker.patch
BuildRequires: cmake >= 3.0 BuildRequires: cmake >= 3.0
BuildRequires: extra-cmake-modules >= %{_kf5_bugfix_version} BuildRequires: extra-cmake-modules >= %{_kf5_bugfix_version}
BuildRequires: fdupes BuildRequires: fdupes
@ -71,17 +83,6 @@ Recommends: %{name}-lang = %{version}
Recommends: kio-extras5 Recommends: kio-extras5
# KIO/FileDialog uses klauncher directly, but we can't add Requires, as that would introduce dep cycle # KIO/FileDialog uses klauncher directly, but we can't add Requires, as that would introduce dep cycle
Recommends: kinit Recommends: kinit
Summary: Network transparent access to files and data
License: LGPL-2.1+
Group: System/GUI/KDE
Url: http://www.kde.org
Source: http://download.kde.org/stable/frameworks/%{_tar_path}/%{name}-%{version}.tar.xz
Source1: baselibs.conf
# PATCH-FIX-OPENSUSE kio_help-fallback-to-kde4-docs.patch -- allow kio_help to see into kde4 documentation, needed especially for khelpcenter5
Patch0: kio_help-fallback-to-kde4-docs.patch
# PATCH-FIX-UPSTREAM
Patch1: fix-handling-of-KCookieAdvice_AcceptForSession.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description %description
This framework implements almost all the file management functions you This framework implements almost all the file management functions you
@ -128,6 +129,7 @@ Development files.
%setup -q %setup -q
%patch0 -p1 %patch0 -p1
%patch1 -p1 %patch1 -p1
%patch2 -p1
%build %build
%cmake_kf5 -d build %cmake_kf5 -d build
@ -155,7 +157,6 @@ Development files.
%endif %endif
%files core %files core
%doc COPYING* README*
%{_kf5_libdir}/libKF5KIOCore.so.* %{_kf5_libdir}/libKF5KIOCore.so.*
%{_kf5_configdir}/accept-languages.codes %{_kf5_configdir}/accept-languages.codes
%{_kf5_libdir}/libKF5KIONTLM.so.* %{_kf5_libdir}/libKF5KIONTLM.so.*
@ -190,7 +191,6 @@ Development files.
%{_kf5_sharedir}/dbus-1/services/org.kde.kioexecd.service %{_kf5_sharedir}/dbus-1/services/org.kde.kioexecd.service
%files %files
%defattr(-,root,root)
%doc COPYING* README* %doc COPYING* README*
%{_kf5_libdir}/libKF5KIOGui.so.* %{_kf5_libdir}/libKF5KIOGui.so.*
%{_kf5_libdir}/libKF5KIOWidgets.so.* %{_kf5_libdir}/libKF5KIOWidgets.so.*
@ -230,7 +230,6 @@ Development files.
%doc %lang(en) %{_kf5_htmldir}/en/*/ %doc %lang(en) %{_kf5_htmldir}/en/*/
%files devel %files devel
%defattr(-,root,root)
%{_kf5_bindir}/protocoltojson %{_kf5_bindir}/protocoltojson
%{_kf5_libdir}/libKF5KIOCore.so %{_kf5_libdir}/libKF5KIOCore.so
%{_kf5_libdir}/libKF5KIOGui.so %{_kf5_libdir}/libKF5KIOGui.so