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 c8b0c382c6
.
Change-Id: I0206211e3ff0adcb89f8ca5410831a428e71fb51
Reviewed-on: https://gerrit.libreoffice.org/72370
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
This commit is contained in:
@@ -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
|
// Add text data
|
||||||
// TODO: consider checking if text of suitable type is present
|
// TODO: consider checking if text of suitable type is present
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user