dvratil pushed to kf5-frameworkintegration (f20). "Pull upstream fix for native QDialogs"
notifications at fedoraproject.org
notifications at fedoraproject.org
Mon Apr 20 17:45:13 UTC 2015
>From 05e7d35f8ca7107ac66b2fe58a59980d44600a8a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Vr=C3=A1til?= <dvratil at redhat.com>
Date: Mon, 20 Apr 2015 19:42:26 +0200
Subject: Pull upstream fix for native QDialogs
diff --git a/frameworkintegration-5.9-fix-native-dialogs.patch b/frameworkintegration-5.9-fix-native-dialogs.patch
new file mode 100644
index 0000000..ce52311
--- /dev/null
+++ b/frameworkintegration-5.9-fix-native-dialogs.patch
@@ -0,0 +1,320 @@
+commit 26406a9aa01d6f4f01a3f084b51451de8385c8fc
+Author: David Rosca <nowrep at gmail.com>
+Date: Fri Apr 17 09:35:24 2015 +0200
+
+ Fix native file dialogs from widgets QFileDialog
+
+ There were two issues:
+ * File dialogs opened with exec() and without parent were
+ opened, but any user-interaction was blocked in a way that
+ no file could be selected nor the dialog closed.
+
+ * File dialogs opened with open() or show() with parent were
+ not opened at all.
+
+ The first issue was caused by first calling show() and then exec()
+ on the native dialog.
+ The second one simply because in the case of dialogs with parent
+ show() wasn't called.
+
+ This fixes it that the show() is always called and hide() is called
+ before exec().
+
+ This also adds unittests for file dialogs.
+
+ REVIEW: 123335
+
+diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
+index 00e4a41..d110adb 100644
+--- a/autotests/CMakeLists.txt
++++ b/autotests/CMakeLists.txt
+@@ -1,12 +1,17 @@
+ include(ECMMarkAsTest)
+
+ find_package(Qt5Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
++find_package(Qt5Qml ${REQUIRED_QT_VERSION} CONFIG QUIET)
+
+ if(NOT Qt5Test_FOUND)
+ message(STATUS "Qt5Test not found, autotests will not be built.")
+ return()
+ endif()
+
++if(NOT Qt5Qml_FOUND)
++ message(STATUS "Qt5Qml not found, QML autotests will not be built.")
++endif()
++
+ include_directories( ${Qt5Gui_PRIVATE_INCLUDE_DIRS} )
+
+ set(CONFIGFILE "${CMAKE_CURRENT_SOURCE_DIR}/kdeplatformtheme_kdeglobals")
+@@ -51,3 +56,8 @@ frameworkintegration_tests(
+ frameworkintegration_tests(
+ ksni_unittest
+ )
++
++if(Qt5Qml_FOUND)
++ frameworkintegration_tests(kfiledialogqml_unittest)
++ target_link_libraries(kfiledialogqml_unittest Qt5::Qml)
++endif()
+diff --git a/autotests/kfiledialog_unittest.cpp b/autotests/kfiledialog_unittest.cpp
+index 45a139a..30392bf 100644
+--- a/autotests/kfiledialog_unittest.cpp
++++ b/autotests/kfiledialog_unittest.cpp
+@@ -111,6 +111,60 @@ private Q_SLOTS:
+ }
+ }
+
++ void testOpenDialog()
++ {
++ // Open parentless
++ {
++ QFileDialog dialog;
++ dialog.open();
++
++ KFileWidget *fw = findFileWidget();
++ QVERIFY(fw);
++ QCOMPARE(fw->isVisible(), true);
++ fw->slotCancel();
++ }
++ // Open with parent
++ {
++ QWidget w;
++ w.show();
++
++ QFileDialog dialog(&w);
++ dialog.open();
++
++ KFileWidget *fw = findFileWidget();
++ QVERIFY(fw);
++ QCOMPARE(fw->isVisible(), true);
++ fw->slotCancel();
++ }
++ }
++
++ void testShowDialog()
++ {
++ // Show parentless
++ {
++ QFileDialog dialog;
++ dialog.show();
++
++ KFileWidget *fw = findFileWidget();
++ QVERIFY(fw);
++ QCOMPARE(fw->isVisible(), true);
++ fw->slotCancel();
++ }
++ // Show with parent
++ {
++ QWidget w;
++ w.show();
++
++ QFileDialog dialog(&w);
++ dialog.show();
++
++ KFileWidget *fw = findFileWidget();
++ QVERIFY(fw);
++ QCOMPARE(fw->isVisible(), true);
++ fw->slotCancel();
++ }
++ }
++
+ void testSetFileMode_data()
+ {
+ QTest::addColumn<QFileDialog::FileMode>("qtFileMode");
+diff --git a/autotests/kfiledialogqml_unittest.cpp b/autotests/kfiledialogqml_unittest.cpp
+new file mode 100644
+index 0000000..f805ef2
+--- /dev/null
++++ b/autotests/kfiledialogqml_unittest.cpp
+@@ -0,0 +1,92 @@
++/* This file is part of the KDE libraries
++ * Copyright 2014 Dominik Haumann <dhaumann at kde.org>
++ * Copyright 2015 David Rosca <nowrep at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License as published by
++ * the Free Software Foundation; either version 2 of the License or ( at
++ * your option ) version 3 or, at the discretion of KDE e.V. ( which shall
++ * act as a proxy as in section 14 of the GPLv3 ), any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
++
++#include <QTest>
++#include <QQmlEngine>
++#include <QQmlComponent>
++#include <KFileWidget>
++
++class KFileDialogQml_UnitTest : public QObject
++{
++ Q_OBJECT
++
++private Q_SLOTS:
++ void initTestCase()
++ {
++ }
++
++ void cleanupTestCase()
++ {
++ }
++
++ void testShowDialogParentless()
++ {
++ KFileWidget *fw;
++ {
++ QQmlEngine engine;
++ QQmlComponent component(&engine);
++ component.loadUrl(QUrl::fromLocalFile(QFINDTESTDATA("qml/filedialog_parentless.qml")));
++ component.create();
++
++ fw = findFileWidget();
++ QVERIFY(fw);
++ QCOMPARE(fw->isVisible(), true);
++ fw->slotCancel();
++ }
++ delete fw;
++ }
++
++ void testShowDialogWithParent()
++ {
++ KFileWidget *fw;
++ {
++ QQmlEngine engine;
++ QQmlComponent component(&engine);
++ component.loadUrl(QUrl::fromLocalFile(QFINDTESTDATA("qml/filedialog_withparent.qml")));
++ component.create();
++
++ fw = findFileWidget();
++ QVERIFY(fw);
++ QCOMPARE(fw->isVisible(), true);
++ fw->slotCancel();
++ }
++ delete fw;
++ }
++
++private:
++ static KFileWidget *findFileWidget()
++ {
++ QList<KFileWidget *> widgets;
++ foreach (QWidget *widget, QApplication::topLevelWidgets()) {
++ KFileWidget *fw = widget->findChild<KFileWidget *>();
++ if (fw) {
++ widgets.append(fw);
++ }
++ }
++ Q_ASSERT(widgets.count() == 1);
++ return (widgets.count() == 1) ? widgets.first() : Q_NULLPTR;
++ }
++};
++
++QTEST_MAIN(KFileDialogQml_UnitTest)
++
++#include "kfiledialogqml_unittest.moc"
++
+diff --git a/autotests/qml/filedialog_parentless.qml b/autotests/qml/filedialog_parentless.qml
+new file mode 100644
+index 0000000..c1c96fb
+--- /dev/null
++++ b/autotests/qml/filedialog_parentless.qml
+@@ -0,0 +1,27 @@
++/* This file is part of the KDE libraries
++ * Copyright 2015 David Rosca <nowrep at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License as published by
++ * the Free Software Foundation; either version 2 of the License or ( at
++ * your option ) version 3 or, at the discretion of KDE e.V. ( which shall
++ * act as a proxy as in section 14 of the GPLv3 ), any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
++
++import QtQuick 2.2
++import QtQuick.Dialogs 1.0
++
++FileDialog {
++ id: fileDialog
++ Component.onCompleted: visible = true
++}
+diff --git a/autotests/qml/filedialog_withparent.qml b/autotests/qml/filedialog_withparent.qml
+new file mode 100644
+index 0000000..5915ccf
+--- /dev/null
++++ b/autotests/qml/filedialog_withparent.qml
+@@ -0,0 +1,35 @@
++/* This file is part of the KDE libraries
++ * Copyright 2015 David Rosca <nowrep at gmail.com>
++ *
++ * This library is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License as published by
++ * the Free Software Foundation; either version 2 of the License or ( at
++ * your option ) version 3 or, at the discretion of KDE e.V. ( which shall
++ * act as a proxy as in section 14 of the GPLv3 ), any later version.
++ *
++ * This library is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Library General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * along with this library; see the file COPYING.LIB. If not, write to
++ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ * Boston, MA 02110-1301, USA.
++ */
++
++import QtQuick 2.2
++import QtQuick.Window 2.2
++import QtQuick.Dialogs 1.0
++
++Window {
++ x: 100
++ y: 100
++ width: 100
++ height: 100
++
++ FileDialog {
++ id: fileDialog
++ Component.onCompleted: visible = true
++ }
++}
+diff --git a/src/platformtheme/kdeplatformfiledialoghelper.cpp b/src/platformtheme/kdeplatformfiledialoghelper.cpp
+index 92ab107..6178af4 100644
+--- a/src/platformtheme/kdeplatformfiledialoghelper.cpp
++++ b/src/platformtheme/kdeplatformfiledialoghelper.cpp
+@@ -272,6 +272,7 @@ void KDEPlatformFileDialogHelper::initializeDialog()
+
+ void KDEPlatformFileDialogHelper::exec()
+ {
++ m_dialog->hide(); // ensure dialog is not shown (exec would block input)
+ m_dialog->winId(); // ensure there's a window created
+ KSharedConfig::Ptr conf = KSharedConfig::openConfig();
+ KWindowConfig::restoreWindowSize(m_dialog->windowHandle(), conf->group("FileDialogSize"));
+@@ -296,11 +297,11 @@ void KDEPlatformFileDialogHelper::saveSize()
+
+ bool KDEPlatformFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent)
+ {
++ Q_UNUSED(parent)
+ initializeDialog();
+ m_dialog->setWindowFlags(windowFlags);
+ m_dialog->setWindowModality(windowModality);
+- if (!parent || (parent && !parent->inherits("QWidgetWindow"))) // see #334963 and #344586 for details
+- m_dialog->show();
++ m_dialog->show();
+ KSharedConfig::Ptr conf = KSharedConfig::openConfig();
+ KWindowConfig::restoreWindowSize(m_dialog->windowHandle(), conf->group("FileDialogSize"));
+ return true;
diff --git a/kf5-frameworkintegration.spec b/kf5-frameworkintegration.spec
index 5e8f913..3fae5de 100644
--- a/kf5-frameworkintegration.spec
+++ b/kf5-frameworkintegration.spec
@@ -2,7 +2,7 @@
Name: kf5-%{framework}
Version: 5.9.0
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: KDE Frameworks 5 Tier 4 workspace and cross-framework integration plugins
License: LGPLv2+
URL: http://www.kde.org
@@ -16,6 +16,9 @@ URL: http://www.kde.org
%endif
Source0: http://download.kde.org/%{stable}/frameworks/%{versiondir}/%{framework}-%{version}.tar.xz
+# upstream patches
+Patch0: frameworkintegration-5.9-fix-native-dialogs.patch
+
BuildRequires: kf5-rpm-macros
BuildRequires: extra-cmake-modules
BuildRequires: qt5-qtbase-devel
@@ -63,7 +66,7 @@ developing applications that use %{name}.
%prep
-%setup -q -n %{framework}-%{version}
+%autosetup -p1 -n %{framework}-%{version}
%build
mkdir -p %{_target_platform}
@@ -99,6 +102,9 @@ make install/fast DESTDIR=%{buildroot} -C %{_target_platform}
%changelog
+* Mon Apr 20 2015 Daniel Vrátil <dvratil at redhat.com> - 5.9.0-2
+- pull upstream patch for native QDialogs
+
* Tue Apr 07 2015 Daniel Vrátil <dvratil at redhat.com> - 5.9.0-1
- KDE Frameworks 5.9.0
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/kf5-frameworkintegration.git/commit/?h=f20&id=05e7d35f8ca7107ac66b2fe58a59980d44600a8a
More information about the scm-commits
mailing list