summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-05-15 16:29:31 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2019-06-13 16:45:23 +0200
commitd0b03870b7eb67a5a4f4981c1e104ca03bd6e993 (patch)
tree022b52cca6f2e6bddf39f3e8ec1025121ee3bd3c
parentefef02cc463f73bd575237ce702f735b9b494733 (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> (cherry picked from commit 0d58f51d7672c569c93c6e814dbfffa586eebfb7) Reviewed-on: https://gerrit.libreoffice.org/73929 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--vcl/qt5/Qt5Clipboard.cxx30
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
{