vcl/qt5/QtTransferable.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+)
New commits: commit 2e0ac1533e38ceff339760efa18df1778f9e4cd6 Author: Stephan Bergmann <stephan.bergm...@allotropia.de> AuthorDate: Fri Jan 3 10:03:01 2025 +0100 Commit: Stephan Bergmann <stephan.bergm...@allotropia.de> CommitDate: Wed Jan 8 14:07:54 2025 +0100 Filter out text/uri-list with empty list ...as seen at least with the Qt6 Wasm implementation (see the code comment for details), and where, at least when trying to paste some plain text into Writer, the LO code would then favor that faux text/uri-list over text/plain, and would get into the > else if( bMsg ) branch in SwTransferable::PasteFileList (sw/source/uibase/dochdl/swdtflvr.cxx) and try to synchronously show a message box, which for now causes an abort in the Emscripten build Change-Id: I64e7cf66717f29b3609c04aea3c6124279ab55de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179699 Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de> Tested-by: Jenkins (cherry picked from commit 9c855f5e596bf97cb1db6de3cc3d8f3785ec096b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179900 Tested-by: allotropia jenkins <jenk...@allotropia.de> diff --git a/vcl/qt5/QtTransferable.cxx b/vcl/qt5/QtTransferable.cxx index 1aec5da27843..440731b8dcde 100644 --- a/vcl/qt5/QtTransferable.cxx +++ b/vcl/qt5/QtTransferable.cxx @@ -73,6 +73,19 @@ css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL QtTransferable::getTr if (rMimeType == QStringLiteral("text/plain;charset=unicode")) continue; + // At least the Qt6 Wasm implementation may announce text/uri-list even though the actual + // list of URLs is empty (presumably since + // <https://github.com/qt/qtbase/commit/0ffe8050bd5b55d64da37f5177a7e20dd9d14232> "wasm: + // implement async drag-and-drop" unconditionally calls setUrls in + // DataTransfer::toMimeDataWithFile's MimeContext::deref): + if (rMimeType == QStringLiteral("text/uri-list")) + { + if (m_pMimeData->urls().empty()) + { + continue; + } + } + // LO doesn't like 'text/plain', so we have to provide UTF-16 bool bIsNoCharset = false, bIsUTF16 = false, bIsUTF8 = false; if (lcl_textMimeInfo(toOUString(rMimeType), bIsNoCharset, bIsUTF16, bIsUTF8))