summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'x11-themes/QGnomePlatform/files/QGnomePlatform-0.7.0-qxdgdesktopfiledialog-fixes.patch')
-rw-r--r--x11-themes/QGnomePlatform/files/QGnomePlatform-0.7.0-qxdgdesktopfiledialog-fixes.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/x11-themes/QGnomePlatform/files/QGnomePlatform-0.7.0-qxdgdesktopfiledialog-fixes.patch b/x11-themes/QGnomePlatform/files/QGnomePlatform-0.7.0-qxdgdesktopfiledialog-fixes.patch
new file mode 100644
index 000000000000..db43a69d0b17
--- /dev/null
+++ b/x11-themes/QGnomePlatform/files/QGnomePlatform-0.7.0-qxdgdesktopfiledialog-fixes.patch
@@ -0,0 +1,63 @@
+From e244e003b68f660dbb0795d18ad70e8a11689712 Mon Sep 17 00:00:00 2001
+From: Jan Grulich <jgrulich@redhat.com>
+Date: Mon, 4 Jan 2021 11:43:36 +0100
+Subject: QXdgDesktopPortalFileDialog: backport upstream fixes
+
+
+diff --git a/common/qxdgdesktopportalfiledialog.cpp b/common/qxdgdesktopportalfiledialog.cpp
+index 7502a6e..c4dc2da 100644
+--- a/common/qxdgdesktopportalfiledialog.cpp
++++ b/common/qxdgdesktopportalfiledialog.cpp
+@@ -210,7 +210,7 @@ void QXdgDesktopPortalFileDialog::openPortal()
+ qDBusRegisterMetaType<FilterList>();
+
+ FilterList filterList;
+- Filter* selectedFilter = nullptr;
++ auto selectedFilterIndex = filterList.size() - 1;
+
+ d->userVisibleToNameFilter.clear();
+
+@@ -236,7 +236,7 @@ void QXdgDesktopPortalFileDialog::openPortal()
+ filterList << filter;
+
+ if (!d->selectedMimeTypeFilter.isEmpty() && d->selectedMimeTypeFilter == mimeTypefilter)
+- selectedFilter = &filterList.last();
++ selectedFilterIndex = filterList.size() - 1;
+ }
+ } else if (!d->nameFilters.isEmpty()) {
+ for (const QString &nameFilter : d->nameFilters) {
+@@ -246,7 +246,12 @@ void QXdgDesktopPortalFileDialog::openPortal()
+ QRegularExpressionMatch match = regexp.match(nameFilter);
+ if (match.hasMatch()) {
+ QString userVisibleName = match.captured(1);
+- QStringList filterStrings = match.captured(2).split(QLatin1Char(' '), QString::SkipEmptyParts);
++ QStringList filterStrings = match.captured(2).split(QLatin1Char(' '), Qt::SkipEmptyParts);
++
++ if (filterStrings.isEmpty()) {
++ qWarning() << "Filter " << userVisibleName << " is empty and will be ignored.";
++ continue;
++ }
+
+ FilterConditionList filterConditions;
+ for (const QString &filterString : filterStrings) {
+@@ -265,7 +270,7 @@ void QXdgDesktopPortalFileDialog::openPortal()
+ d->userVisibleToNameFilter.insert(userVisibleName, nameFilter);
+
+ if (!d->selectedNameFilter.isEmpty() && d->selectedNameFilter == nameFilter)
+- selectedFilter = &filterList.last();
++ selectedFilterIndex = filterList.size() - 1;
+ }
+ }
+ }
+@@ -273,9 +278,8 @@ void QXdgDesktopPortalFileDialog::openPortal()
+ if (!filterList.isEmpty())
+ options.insert(QLatin1String("filters"), QVariant::fromValue(filterList));
+
+- if (selectedFilter) {
+- options.insert(QLatin1String("current_filter"), QVariant::fromValue(*selectedFilter));
+- }
++ if (selectedFilterIndex != -1)
++ options.insert(QLatin1String("current_filter"), QVariant::fromValue(filterList[selectedFilterIndex]));
+
+ options.insert(QLatin1String("handle_token"), QStringLiteral("qt%1").arg(QRandomGenerator::global()->generate()));
+