[Libreoffice-commits] core.git: vcl/qt5
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Oct 4 08:20:15 UTC 2018
vcl/qt5/Qt5Clipboard.cxx | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
New commits:
commit 309bd0e920aae38c94f2c83dd5ff7d8b9feb9847
Author: Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Tue Sep 18 12:23:34 2018 +0200
Commit: Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Thu Oct 4 10:19:48 2018 +0200
Implement qt5 plain text paste from system clipboard
Change-Id: I44053d445098efc619ad9255d8f21962531a0654
Reviewed-on: https://gerrit.libreoffice.org/60674
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
diff --git a/vcl/qt5/Qt5Clipboard.cxx b/vcl/qt5/Qt5Clipboard.cxx
index ac2daae520c8..68fabdf8583f 100644
--- a/vcl/qt5/Qt5Clipboard.cxx
+++ b/vcl/qt5/Qt5Clipboard.cxx
@@ -13,7 +13,11 @@
#include <cppuhelper/supportsservice.hxx>
#include <vcl/svapp.hxx>
+#include <QtWidgets/QApplication>
+#include <QtGui/QClipboard>
+
#include <Qt5Clipboard.hxx>
+#include <Qt5Tools.hxx>
std::vector<css::datatransfer::DataFlavor> Qt5Transferable::getTransferDataFlavorsAsVector()
{
@@ -46,11 +50,19 @@ Qt5Transferable::isDataFlavorSupported(const css::datatransfer::DataFlavor& /*rF
*/
css::uno::Any SAL_CALL
-Qt5Transferable::getTransferData(const css::datatransfer::DataFlavor& /*rFlavor*/)
+Qt5Transferable::getTransferData(const css::datatransfer::DataFlavor& rFlavor)
{
css::uno::Any aRet;
- Sequence<sal_Int8> aSeq(0, 4); //FIXME
- aRet <<= aSeq;
+
+ if (rFlavor.MimeType == "text/plain;charset=utf-16")
+ {
+ const QClipboard* clipboard = QApplication::clipboard();
+ QString clipboardContent = clipboard->text();
+ OUString sContent = toOUString(clipboardContent);
+
+ aRet <<= sContent.replaceAll("\r\n", "\n");
+ }
+
return aRet;
}
More information about the Libreoffice-commits
mailing list