commit:     e23d801233baaf9d83c3004a1171690c0c712c0a
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  8 11:21:41 2017 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Jan  8 11:49:22 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e23d8012

kde-plasma/plasma-integration: Fix save filedialog

A regression in 5.8.5 made the save dialog appear as open.

Package-Manager: portage-2.3.0

 .../plasma-integration-5.8.5-filedialog.patch      | 71 ++++++++++++++++++++++
 .../plasma-integration-5.8.5-r1.ebuild             | 44 ++++++++++++++
 2 files changed, 115 insertions(+)

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 00000000..148825d
--- /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 <aa...@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)

diff --git a/kde-plasma/plasma-integration/plasma-integration-5.8.5-r1.ebuild 
b/kde-plasma/plasma-integration/plasma-integration-5.8.5-r1.ebuild
new file mode 100644
index 00000000..80ee6ac
--- /dev/null
+++ b/kde-plasma/plasma-integration/plasma-integration-5.8.5-r1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+VIRTUALX_REQUIRED="test"
+inherit kde5
+
+DESCRIPTION="Qt Platform Theme integration plugins for the Plasma workspaces"
+LICENSE="LGPL-2+"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE=""
+
+DEPEND="
+       $(add_frameworks_dep kcompletion)
+       $(add_frameworks_dep kconfig)
+       $(add_frameworks_dep kconfigwidgets)
+       $(add_frameworks_dep kcoreaddons)
+       $(add_frameworks_dep ki18n)
+       $(add_frameworks_dep kiconthemes)
+       $(add_frameworks_dep kio)
+       $(add_frameworks_dep kjobwidgets)
+       $(add_frameworks_dep knotifications)
+       $(add_frameworks_dep kwayland)
+       $(add_frameworks_dep kwidgetsaddons)
+       $(add_frameworks_dep kwindowsystem)
+       $(add_frameworks_dep kxmlgui)
+       $(add_plasma_dep breeze)
+       $(add_qt_dep qtdbus)
+       $(add_qt_dep qtgui '' '' '5=')
+       $(add_qt_dep qtwidgets)
+       $(add_qt_dep qtx11extras)
+       x11-libs/libXcursor
+"
+RDEPEND="${DEPEND}
+       media-fonts/hack
+       media-fonts/noto
+"
+
+# requires running kde environment
+RESTRICT+=" test"
+
+PATCHES=( "${FILESDIR}/${P}-filedialog.patch" )

Reply via email to