Paste special

David Faure faure at kde.org
Tue Sep 18 00:08:50 BST 2007


On Sunday 16 September 2007, Thomas Zander wrote:
> First I have problems envisioning how that would work; if I have a 
> clipboard part with application/vnd.oasis.opendocument.text data, how do 
> I decide that this is actually paste-able in kwrite ?

The receiver doesn't have to know that a conversion is possible; the right way to do
this is to let the program that copies to clipboard, provide the data in multiple formats,
which can be queried on demand by the receiver. This is how QMimeData works, and
it fits this just fine: kword can "export" data (in copy/paste and DnD) as text/plain,
text/html, and application/vnd.oasis.opendocument.text. Then kwrite can offer "paste" (as plain text)
and "paste as HTML" (mostly useful for the case where KHTML has copied something
as text and as HTML), etc.

The ability for the receiver to run conversion filters is something that is needed in KOffice,
but only KOffice has such filters, so this doesn't apply to other apps, like kwrite.

Jaroslaw wrote:
> For those worried about performance: this is of course designed for small chunks of data, larger 
> portions can be handled by DDE-like "on demand" operations. I wish I could 
> show this in action ad KDE level.
Yes. What you're describing is exactly how QMimeData works, so no problem there :)

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list