summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'kde-plasma/plasma-integration/files')
-rw-r--r--kde-plasma/plasma-integration/files/plasma-integration-5.8.5-filedialog.patch71
1 files changed, 71 insertions, 0 deletions
diff --git a/kde-plasma/plasma-integration/files/plasma-integration-5.8.5-filedialog.patch b/kde-plasma/plasma-integration/files/plasma-integration-5.8.5-filedialog.patch
new file mode 100644
index 000000000000..148825d496d0
--- /dev/null
+++ b/kde-plasma/plasma-integration/files/plasma-integration-5.8.5-filedialog.patch
@@ -0,0 +1,71 @@
+commit 87b27476cc8a3865994da066ce06a3e836462719
+Author: Albert Astals Cid <aacid@kde.org>
+Date: Sat Dec 31 11:55:43 2016 +0100
+
+ 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
+
+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)