vcl/qt5/Qt5Clipboard.cxx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
New commits: commit 0d58f51d7672c569c93c6e814dbfffa586eebfb7 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Wed May 15 16:29:31 2019 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Thu May 16 12:33:16 2019 +0200 Revert "tdf#120836 KDE5: Clipboard: don't put images to clipboard" My previous commit has disabled setting non-text for selection, so this workaround is no longer needed (and it very much looks like a workaround, I see no good reason for never putting images in the clipboard). This reverts commit c8b0c382c6330865df50ae7cf7360c8a2c08ebe6. Change-Id: I0206211e3ff0adcb89f8ca5410831a428e71fb51 Reviewed-on: https://gerrit.libreoffice.org/72370 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/vcl/qt5/Qt5Clipboard.cxx b/vcl/qt5/Qt5Clipboard.cxx index d4df05504b8e..6d333d498ff2 100644 --- a/vcl/qt5/Qt5Clipboard.cxx +++ b/vcl/qt5/Qt5Clipboard.cxx @@ -287,6 +287,36 @@ void VclQt5Clipboard::setContents( } } + // Add image data if present + if (bHasImage) + { + css::datatransfer::DataFlavor aFlavor; + //FIXME: other image formats? + aFlavor.MimeType = "image/png"; + aFlavor.DataType = cppu::UnoType<Sequence<sal_Int8>>::get(); + + Any aValue; + try + { + aValue = xTrans->getTransferData(aFlavor); + } + catch (...) + { + } + + if (aValue.getValueType() == cppu::UnoType<Sequence<sal_Int8>>::get()) + { + Sequence<sal_Int8> aData; + aValue >>= aData; + + QImage image; + image.loadFromData(reinterpret_cast<const uchar*>(aData.getConstArray()), + aData.getLength()); + + pMimeData->setImageData(image); + } + } + // Add text data // TODO: consider checking if text of suitable type is present { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits