summaryrefslogtreecommitdiff
path: root/vcl/qt5/Qt5Clipboard.cxx
AgeCommit message (Collapse)Author
2019-06-15Fix typoAndrea Gelmini
Change-Id: I16f502fd3365f8db330c4228e44924c03ef227c1 Reviewed-on: https://gerrit.libreoffice.org/74077 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-06-13Qt5 move boilerplate clipboard code to the end...Jan-Marek Glogowski
... in the implementation file. Change-Id: I1f6fae0eb7c5d6973ce44320ff6d977e40d54a72 Reviewed-on: https://gerrit.libreoffice.org/73734 Tested-by: Jenkins Reviewed-by: Aleksei Nikiforov <darktemplar@basealt.ru> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2019-06-13tdf#122239 Qt5 implement lazy clipboard handlingJan-Marek Glogowski
This changes the Qt5Clipboard to a lazy loading one, which will just deliver data on read requests. This fixes not only the PRIMARY selection problems with Writer, but will generally speed up C'n'P, inside LO, because the data has not to be copied or transferred via QMimeData. This is mainly done by implementing the "mirror" interface of the Qt5Transferable, the Qt5MimeData using the retrieveData override. To prevent clipboard loss on shutdown, this sets a deep copied QMimeData of the current XTransferable, to make it persistent. This code explicitly doesn't use any of the QMimeData convenience functions and relies completely on LO's string handling, so we won't mix in eventual Qt bugs; all bugs are ours... Change-Id: I43d92a95df8fcac88dc41b00021cea0b5f040413 Reviewed-on: https://gerrit.libreoffice.org/73288 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2019-06-03Qt5 refactor and move XTransferable implementationsJan-Marek Glogowski
There is already duplicate code getTransferDataFlavorsAsVector. Maybe getTransferData can be also merged later. Change-Id: Iaa1c16990c1f19757f04944bcd21f395f6b8f69b Reviewed-on: https://gerrit.libreoffice.org/73301 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-06-03Qt5 remove header using namespaces and Vcl prefixJan-Marek Glogowski
This is mainly about the using namespace in the Qt5Clipboard header. While at it get rid of the Vcl prefix. Change-Id: I62a804a83afe2feb4bf130eb5475790bc52365c4 Reviewed-on: https://gerrit.libreoffice.org/73287 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
2019-05-16Revert "tdf#120836 KDE5: Clipboard: don't put images to clipboard"Luboš Luňák
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>
2019-05-15do not add non-text to PRIMARY selection in VclQt5ClipboardLuboš Luňák
E.g. tdf#80853 repeatedly sets the selection, which results in the entire document getting converted to html. Other VCL backends seem to be even faster, it looks like they convert the data only on-demand, but this at least makes things bearable. Change-Id: Ib08423bd89d7c7065ad0522338979f1ce66701c7 Reviewed-on: https://gerrit.libreoffice.org/72369 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-02-27tdf#122689 qt5: Consider external clipboard updatesMichael Weghorn
Previously, once 'm_aContents' had been assigned in 'VclQt5Clipboard::setContents()', its value (or the one set in a subsequent call to the same method) was always returned in 'VclQt5Clipboard::getContents()', thus ignoring all system clipboard updates done by any other third-party applications, preventing copy-paste from other applications. In order to take external clipboard updates into account, add a slot for the 'QClipboard::changed' signal and drop the current own clipboard content if the clipboard has been updated by another application. In order to detect whether the clipboard update was made by this 'VclQt5Clipboard' itself or elsewhere, a custom MIME type "application/x-libreoffice-clipboard-uuid" is added, whose value is set to the clipboard's (randomly generated) UUID. If the entry is present and has the correct value, the clipboard content was added by this clipboard and can be kept. Otherwise, clear 'm_aContents', so that it's newly assigned in 'VclQt5Clipboard::getContents()', taking into account the external clipboard update. [Side note: Testing showed that, on Wayland, more 'QClipboard::changed' events were emitted without the clipboard content actually having changed (e.g. when switching focus between windows), which is why an approach of simply setting a flag and checking for that one is not enough, like "wrapping" the 'QClipboard::setMimeData()' call in 'VclQt5Clipboard::setContents()' as follows m_bIsFillingClipboard = true; clipboard->setMimeData(pMimeData.release(), m_aClipboardMode); m_bIsFillingClipboard = false; and then evaluating the 'm_bIsfillingClipboard' flag in 'VclQt5Clipboard::handleClipboardChange' instead of using the UUID-based approach. These additional 'QClipboard::changed' events did not show up the same way while testing on X11.] Change-Id: Ib3a6a4f9b7f5ca3573666fb9c072ae97cf2e0049 Reviewed-on: https://gerrit.libreoffice.org/68214 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2019-01-26tdf#120836 KDE5: Clipboard: don't put images to clipboardAleksei Nikiforov
Image generation is very slow. Change-Id: I34d45ed1f4d665613700f01cceec59069b091a79 Reviewed-on: https://gerrit.libreoffice.org/66680 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2019-01-21tdf#122689 KDE5: Fix selection clipboardAleksei Nikiforov
Selection clipboard now should properly get and set data from/to selection buffer and not from/to copy buffer. Related: tdf#122239 Change-Id: Ia5298932ee277385c6f8a587d4fcb8204647c491 Reviewed-on: https://gerrit.libreoffice.org/66577 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-01-21Related tdf#120625: improve querying supported data flavoursKatarina Behrens
Change-Id: Ia46b136f64c2750ed466d86967de9dfe90b4ce65 Reviewed-on: https://gerrit.libreoffice.org/65003 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2019-01-18tdf#120836 KDE5: allow adding multiple mime types to clipboardAleksei Nikiforov
Also correct processing "text/html" and "image/png" mime types to fix slow select in Calc: if both "text/html" and "image/png" mime types were present, "image/png" data was requested, but it was processed as if it was "text/html" data. Change-Id: Ie192fff06cd9de28f466547dac32343620fe2730 Reviewed-on: https://gerrit.libreoffice.org/66576 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2018-10-12HTML and image copy into qt5 clipboardKatarina Behrens
Change-Id: I1c26db35b801694fcc3935baab842027eac1e561 Reviewed-on: https://gerrit.libreoffice.org/61611 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2018-10-12Support image paste from qt5 clipboardKatarina Behrens
Change-Id: Ie1894d9549227c73c6da6688b0540c85d4593a2b Reviewed-on: https://gerrit.libreoffice.org/61589 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2018-10-12Support HTML paste from qt5 clipboardKatarina Behrens
Change-Id: I23b615bf0720fdcdb1849e7890956c1d9f1a79c1 Reviewed-on: https://gerrit.libreoffice.org/61516 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2018-10-04loplugin:subtlezeroinit (--enable-qt5)Stephan Bergmann
Change-Id: I1a6f0a2b0de82fd0e8c30818c2ddf6e0a2d3f1b0
2018-10-04Implement qt5 plain text copy to clipboardKatarina Behrens
Change-Id: I5804467c97758641718a6d6314cae015a0442d1b Reviewed-on: https://gerrit.libreoffice.org/61233 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2018-10-04Implement qt5 plain text paste from system clipboardKatarina Behrens
Change-Id: I44053d445098efc619ad9255d8f21962531a0654 Reviewed-on: https://gerrit.libreoffice.org/60674 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
2018-10-04Clipboard support for qt5, first cutKatarina Behrens
this adds just enough of basic UNO ifaces to have SID_PASTE enabled. It can't actually paste anything yet. Change-Id: I82e8ef37e11e9df21d27f08d4d199f3e5924ed84 Reviewed-on: https://gerrit.libreoffice.org/60494 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>