- Add patch to fix regression in 5.8.5 (Save dialog appears as Open dialog)

* 0001-Fix-regression-in-which-the-Save-dialog-appears-as-a.patch

OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/plasma5-integration?expand=0&rev=39
This commit is contained in:
Fabian Vogt 2017-01-05 12:51:42 +00:00 committed by Git OBS Bridge
parent 49f60259ed
commit e8fc18a46f
3 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,78 @@
From 87b27476cc8a3865994da066ce06a3e836462719 Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Sat, 31 Dec 2016 11:55:43 +0100
Subject: [PATCH] Fix regression in which the Save dialog appears as an Open
dialog
7bbbd93cd3fc0abdffd3fa7f144cb50a33fafad9 makes the save dialog appear as Open dialog.
Simplify the code in that commit so it does not regress anymore.
Comes with a unit test
New test fails without the patch, works with it. Kate Save As dialog no longer shows as Open dialog.
REVIEW: 129732
---
autotests/kfiledialog_unittest.cpp | 23 +++++++++++++++++++++++
src/platformtheme/kdeplatformfiledialoghelper.cpp | 10 +---------
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/autotests/kfiledialog_unittest.cpp b/autotests/kfiledialog_unittest.cpp
index 47a5543..d53c7e3 100644
--- a/autotests/kfiledialog_unittest.cpp
+++ b/autotests/kfiledialog_unittest.cpp
@@ -95,6 +95,29 @@ private Q_SLOTS:
QCOMPARE(dialog.directoryUrl(), directoryUrl);
}
+ void testGetSaveFileUrl()
+ {
+ QObject lambdaGuard;
+ QTemporaryFile tempFile(QDir::tempPath()+"/kfiledialogtest_XXXXXX");
+ tempFile.open();
+ const QString tempName = tempFile.fileName();
+ const QUrl url = QUrl::fromLocalFile(tempName);
+
+ // Need to use a lambda and not just QTest::qWaitForWindowExposed();
+ // because with the static getSaveFileUrl we do not have access
+ // to the QFileDialog object, so instead we hook to a signal
+ KFileWidget::OperationMode saveFileOperationMode = KFileWidget::Other;
+ connect(qApp, &QGuiApplication::focusWindowChanged, &lambdaGuard, [&saveFileOperationMode] {
+ KFileWidget *fileWidget = findFileWidget();
+ saveFileOperationMode = fileWidget->operationMode();
+ qApp->activeWindow()->close();
+ });
+
+ QFileDialog::getSaveFileUrl(0, QString(), url);
+
+ QCOMPARE(saveFileOperationMode, KFileWidget::Saving);
+ }
+
void testViewMode()
{
// Open a file dialog, and change view mode to tree
diff --git a/src/platformtheme/kdeplatformfiledialoghelper.cpp b/src/platformtheme/kdeplatformfiledialoghelper.cpp
index 990b983..05cfe35 100644
--- a/src/platformtheme/kdeplatformfiledialoghelper.cpp
+++ b/src/platformtheme/kdeplatformfiledialoghelper.cpp
@@ -365,15 +365,7 @@ void KDEPlatformFileDialogHelper::selectFile(const QUrl &filename)
// Qt 5 at least <= 5.8.0 does not derive the directory from the passed url
// and set the initialDirectory option accordingly, also not for known schemes
// like file://, so we have to do it ourselves
-
- // Syntax-wise we have to use a copy ctor until Qt 5.7.x and clone() since Qt 5.8.
-#if QT_VERSION < QT_VERSION_CHECK(5, 8, 0)
- QSharedPointer<QFileDialogOptions> opt(new QFileDialogOptions(*options()));
-#else
- auto opt = options()->clone();
-#endif
- opt->setInitialDirectory(m_dialog->directory());
- setOptions(opt);
+ options()->setInitialDirectory(m_dialog->directory());
}
void KDEPlatformFileDialogHelper::setDirectory(const QUrl &directory)
--
2.10.2

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Jan 5 12:48:09 UTC 2017 - fabian@ritter-vogt.de
- Add patch to fix regression in 5.8.5 (Save dialog appears as Open dialog)
* 0001-Fix-regression-in-which-the-Save-dialog-appears-as-a.patch
-------------------------------------------------------------------
Tue Dec 27 18:31:45 UTC 2016 - fabian@ritter-vogt.de

View File

@ -29,6 +29,8 @@ License: GPL-2.0+
Group: System/GUI/KDE
Url: http://www.kde.org
Source: http://download.kde.org/stable/plasma/%{version}/plasma-integration-%{version}.tar.xz
# PATCH-FIX-UPSTREAM 0001-Fix-regression-in-which-the-Save-dialog-appears-as-a.patch aacid@kde.org -- Fix regression in which the Save dialog appears as an Open dialog
Patch1: 0001-Fix-regression-in-which-the-Save-dialog-appears-as-a.patch
BuildRequires: extra-cmake-modules >= 5.17.0
BuildRequires: kf5-filesystem
BuildRequires: libQt5Gui-private-headers-devel >= 5.5.0
@ -76,6 +78,7 @@ Applications do not need to link to this directly.
%lang_package -n plasma5-integration-plugin
%prep
%setup -q -n plasma-integration-%{version}
%patch1 -p1
%build
%cmake_kf5 -d build