diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2019-05-15 16:29:31 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2019-05-16 12:33:16 +0200 |
commit | 0d58f51d7672c569c93c6e814dbfffa586eebfb7 (patch) | |
tree | a89673c095295f483a8f356c62dbb5e33ac401ff /vcl | |
parent | d5c6efa206efe0ac99b136321b9ecf77c7c2392c (diff) |
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.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qt5/Qt5Clipboard.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
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 { |