From e8fc18a46f6fe46d790375e04490072feb0186b299dc7c0a2a71613ca4912dc4 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Thu, 5 Jan 2017 12:51:42 +0000 Subject: [PATCH] - 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 --- ...n-which-the-Save-dialog-appears-as-a.patch | 78 +++++++++++++++++++ plasma5-integration.changes | 6 ++ plasma5-integration.spec | 3 + 3 files changed, 87 insertions(+) create mode 100644 0001-Fix-regression-in-which-the-Save-dialog-appears-as-a.patch diff --git a/0001-Fix-regression-in-which-the-Save-dialog-appears-as-a.patch b/0001-Fix-regression-in-which-the-Save-dialog-appears-as-a.patch new file mode 100644 index 0000000..1252d2a --- /dev/null +++ b/0001-Fix-regression-in-which-the-Save-dialog-appears-as-a.patch @@ -0,0 +1,78 @@ +From 87b27476cc8a3865994da066ce06a3e836462719 Mon Sep 17 00:00:00 2001 +From: Albert Astals Cid +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 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 + diff --git a/plasma5-integration.changes b/plasma5-integration.changes index 38ebbcd..6740d99 100644 --- a/plasma5-integration.changes +++ b/plasma5-integration.changes @@ -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 diff --git a/plasma5-integration.spec b/plasma5-integration.spec index 2d9ca2f..2781c69 100644 --- a/plasma5-integration.spec +++ b/plasma5-integration.spec @@ -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