[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - vcl/qt5
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Feb 4 16:23:16 UTC 2019
vcl/qt5/Qt5Clipboard.cxx | 42 +++++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 19 deletions(-)
New commits:
commit 2b77e50cfe6fa06b7f7193d0a170553bdab63718
Author: Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Wed Dec 12 10:03:49 2018 +0100
Commit: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Mon Feb 4 17:22:56 2019 +0100
Related tdf#120625: improve querying supported data flavours
Change-Id: Ia46b136f64c2750ed466d86967de9dfe90b4ce65
Reviewed-on: https://gerrit.libreoffice.org/65003
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
(cherry picked from commit 3fa4674615b747e219afe5bf0a9b689df3840439)
Reviewed-on: https://gerrit.libreoffice.org/67363
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/vcl/qt5/Qt5Clipboard.cxx b/vcl/qt5/Qt5Clipboard.cxx
index 7a794cfd46e5..7407e2b062b0 100644
--- a/vcl/qt5/Qt5Clipboard.cxx
+++ b/vcl/qt5/Qt5Clipboard.cxx
@@ -76,25 +76,27 @@ std::vector<css::datatransfer::DataFlavor> Qt5Transferable::getTransferDataFlavo
const QMimeData* mimeData = clipboard->mimeData(m_aClipboardMode);
css::datatransfer::DataFlavor aFlavor;
- if (mimeData->hasHtml())
- {
- aFlavor.MimeType = "text/html";
- aFlavor.DataType = cppu::UnoType<Sequence<sal_Int8>>::get();
- aVector.push_back(aFlavor);
- }
-
- if (mimeData->hasText())
+ if (mimeData)
{
- aFlavor.MimeType = "text/plain;charset=utf-16";
- aFlavor.DataType = cppu::UnoType<OUString>::get();
- aVector.push_back(aFlavor);
- }
+ for (QString& rMimeType : mimeData->formats())
+ {
+ // filter out non-MIME types such as TARGETS, MULTIPLE, TIMESTAMP
+ if (rMimeType.indexOf('/') == -1)
+ continue;
- if (mimeData->hasImage())
- {
- aFlavor.MimeType = "image/png";
- aFlavor.DataType = cppu::UnoType<Sequence<sal_Int8>>::get();
- aVector.push_back(aFlavor);
+ if (rMimeType.startsWith("text/plain"))
+ {
+ aFlavor.MimeType = "text/plain;charset=utf-16";
+ aFlavor.DataType = cppu::UnoType<OUString>::get();
+ aVector.push_back(aFlavor);
+ }
+ else
+ {
+ aFlavor.MimeType = toOUString(rMimeType);
+ aFlavor.DataType = cppu::UnoType<Sequence<sal_Int8>>::get();
+ aVector.push_back(aFlavor);
+ }
+ }
}
return aVector;
@@ -106,11 +108,13 @@ css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL Qt5Transferable::getT
}
sal_Bool SAL_CALL
-Qt5Transferable::isDataFlavorSupported(const css::datatransfer::DataFlavor& /*rFlavor*/)
+Qt5Transferable::isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor)
{
const std::vector<css::datatransfer::DataFlavor> aAll = getTransferDataFlavorsAsVector();
- return !aAll.empty(); //FIXME
+ return std::any_of(aAll.begin(), aAll.end(), [&](const css::datatransfer::DataFlavor& aFlavor) {
+ return rFlavor.MimeType == aFlavor.MimeType;
+ }); //FIXME
}
/*
More information about the Libreoffice-commits
mailing list