FileChooser portal: skip empty filters to avoid rejection from portals
Xdg-desktop-portal will reject any OpenFile request if there is an empty filter. We will just simply skip it to avoid the rejection so users get a file dialog. Pick-to: 5.15 Change-Id: I85c056f46b22cdbc9e14010bc3c49206b6f8f002 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
2189e0f2fc
commit
316bf12443
@ -248,6 +248,11 @@ void QXdgDesktopPortalFileDialog::openPortal()
|
||||
QString userVisibleName = match.captured(1);
|
||||
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) {
|
||||
FilterCondition filterCondition;
|
||||
|
Loading…
Reference in New Issue
Block a user