From 76923a8f97d0b932346acf0bb9857e0865271d0774bf1baf3a9311a4611bae38 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Fri, 12 Jan 2018 07:51:24 +0000 Subject: [PATCH] - 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 --- ...-KFilePreviewGenerator-LayoutBlocker.patch | 64 +++++++++++++++++++ kio.changes | 6 ++ kio.spec | 37 ++++++----- 3 files changed, 88 insertions(+), 19 deletions(-) create mode 100644 0001-Fix-KFilePreviewGenerator-LayoutBlocker.patch diff --git a/0001-Fix-KFilePreviewGenerator-LayoutBlocker.patch b/0001-Fix-KFilePreviewGenerator-LayoutBlocker.patch new file mode 100644 index 0000000..9ece773 --- /dev/null +++ b/0001-Fix-KFilePreviewGenerator-LayoutBlocker.patch @@ -0,0 +1,64 @@ +From fe2ce8fd25ceeb65e5889084e068de93c783ef62 Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +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 + diff --git a/kio.changes b/kio.changes index bec1db8..fa3f7f3 100644 --- a/kio.changes +++ b/kio.changes @@ -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 diff --git a/kio.spec b/kio.spec index 8fd7ed5..742716b 100644 --- a/kio.spec +++ b/kio.spec @@ -1,7 +1,7 @@ # # 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 # remain the property of their copyright owners, unless otherwise agreed @@ -18,14 +18,26 @@ %bcond_without lang %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 Version: 5.41.0 Release: 0 %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: extra-cmake-modules >= %{_kf5_bugfix_version} BuildRequires: fdupes @@ -71,17 +83,6 @@ Recommends: %{name}-lang = %{version} Recommends: kio-extras5 # KIO/FileDialog uses klauncher directly, but we can't add Requires, as that would introduce dep cycle 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 This framework implements almost all the file management functions you @@ -128,6 +129,7 @@ Development files. %setup -q %patch0 -p1 %patch1 -p1 +%patch2 -p1 %build %cmake_kf5 -d build @@ -155,7 +157,6 @@ Development files. %endif %files core -%doc COPYING* README* %{_kf5_libdir}/libKF5KIOCore.so.* %{_kf5_configdir}/accept-languages.codes %{_kf5_libdir}/libKF5KIONTLM.so.* @@ -190,7 +191,6 @@ Development files. %{_kf5_sharedir}/dbus-1/services/org.kde.kioexecd.service %files -%defattr(-,root,root) %doc COPYING* README* %{_kf5_libdir}/libKF5KIOGui.so.* %{_kf5_libdir}/libKF5KIOWidgets.so.* @@ -230,7 +230,6 @@ Development files. %doc %lang(en) %{_kf5_htmldir}/en/*/ %files devel -%defattr(-,root,root) %{_kf5_bindir}/protocoltojson %{_kf5_libdir}/libKF5KIOCore.so %{_kf5_libdir}/libKF5KIOGui.so