[Libreoffice-commits] core.git: vcl/qt5

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 4 08:25:43 UTC 2018


 vcl/qt5/Qt5Clipboard.cxx |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

New commits:
commit 6b4abed111c67152a2c0c3a498071f37bce93b67
Author:     Katarina Behrens <Katarina.Behrens at cib.de>
AuthorDate: Tue Oct 2 11:36:39 2018 +0200
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Thu Oct 4 10:25:18 2018 +0200

    Implement qt5 plain text copy to clipboard
    
    Change-Id: I5804467c97758641718a6d6314cae015a0442d1b
    Reviewed-on: https://gerrit.libreoffice.org/61233
    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 68fabdf8583f..048acd4e70c8 100644
--- a/vcl/qt5/Qt5Clipboard.cxx
+++ b/vcl/qt5/Qt5Clipboard.cxx
@@ -118,6 +118,28 @@ void VclQt5Clipboard::setContents(
     std::vector<Reference<datatransfer::clipboard::XClipboardListener>> aListeners(m_aListeners);
     datatransfer::clipboard::ClipboardEvent aEv;
 
+    if (m_aContents.is())
+    {
+        css::datatransfer::DataFlavor aFlavor;
+        aFlavor.MimeType = "text/plain;charset=utf-16";
+        aFlavor.DataType = cppu::UnoType<OUString>::get();
+
+        Any aValue;
+        try
+        {
+            aValue = xTrans->getTransferData(aFlavor);
+        }
+        catch (...)
+        {
+        }
+
+        OUString aString;
+        aValue >>= aString;
+
+        QClipboard* clipboard = QApplication::clipboard();
+        clipboard->setText(toQString(aString));
+    }
+
     aEv.Contents = getContents();
 
     aGuard.clear();


More information about the Libreoffice-commits mailing list