Opened 15 years ago

Closed 14 years ago

#28 closed task (fixed)

Port QClipboard

Reported by: Dmitry A. Kuminov Owned by: Dmitry A. Kuminov
Priority: blocker Milestone: Qt Beta 5
Component: QtGui Version: 4.5.1 Beta 1
Severity: Keywords:
Cc:

Description

Provide the OS/2 version of the QClipboard class.

Change History (10)

comment:1 Changed 15 years ago by Dmitry A. Kuminov

Type: enhancementtask

comment:2 Changed 15 years ago by Dmitry A. Kuminov

Milestone: QtGui BetaQt GA

No time; moved to GA.

comment:3 Changed 15 years ago by Dmitry A. Kuminov

Priority: majorblocker

The limited functionality (text only clipboard) ia a must for GA. The rest depends on how many time we will have.

comment:4 Changed 14 years ago by Silvan Scherrer

Milestone: Qt GAQt Beta5

comment:5 Changed 14 years ago by Dmitry A. Kuminov

Owner: set to Dmitry A. Kuminov
Status: newaccepted

comment:6 Changed 14 years ago by Dmitry A. Kuminov

I created all the basic interfaces (QPMMime) needed to perform the conversion between mime data objects and native OS/2 PM clipboard.

The next thing is to provide a number of implementations of the abstract QPMMime class that deal with individual clipboard formats (text, bitmap, html).

comment:7 Changed 14 years ago by Dmitry A. Kuminov

Support for "text/plain" <=> CF_TEXT/CF_TextUnicode is in there. That is, plain text exchange between Qt and the system (both 8-bit and Unicode) works now.

What remains is the "image/*" <=> CF_BITMAP converter and the fallback converter used for mime types that don't have a specific converter defined.

comment:8 Changed 14 years ago by Dmitry A. Kuminov

Implemented the fallback converter. It picks up all mime types left after specialized converters and does the following:

  1. Registers a PM clipboard format in the system atom table using the atom name "x-mime:<mime>" where <mime> is the original MIME type name to convert.
  2. Places the byte stream returned by QMimeData->data(mime) to the clipboard under the registered format ID using the CFI_POINTER flag and a shared memory block which has the following layout:
    [ 4 bytes    ] byte stream size (ULONG)
    [ size bytes ] byte stream
    

The fetching party queries the name of the format ID in the system atom table and looks if it starts with "x-mime:". If so, it interprets the CFI_POINTER data as described above.

The fallback converter allows to pass such complex things as file lists, images or rich text between Qt4 applications regardless of whether there is a native clipboard format for them or not.

Note that in Qt3 I used a different prefix for the fallback converter ("mime:" instead of "x-mime:"). The reason I changed this is because I changed the layout of the memory block: in Qt3, the size of the byte stream was stored in the *last* 4 bytes of the allocated memory block. I find it too complex to calculate compared to the current layout so I decided to break compatibility. If we ever need full support of MIME data exchange between Qt3 and Qt4 applications, we will be able to easily support for the "mime:" form as well (though I don't think we'll ever need it).

comment:9 Changed 14 years ago by Dmitry A. Kuminov

I added support for the "text/html" clipboard format (16-bit Unicode zero-terminated string) used by Mozilla to the QPMMimeText converter so that HTML is now interchangeable between Mozilla-based and Qt4 applications.

comment:10 Changed 14 years ago by Dmitry A. Kuminov

Resolution: fixed
Status: acceptedclosed

Support for "iamge/*" which is mapped to OS/2 bitmaps is also there -- I could successfully copy a part of the image from PMView ti the test application. This task may be considered as done now.

BTW, if you ever enable the debug output in qclipboard_pm.cpp, keep in mind that you should NOT mark-n-paste from the text window where the debugged Qt application writes to: it will cause a deadlock when sending the WM_DRAWCLIPBOARD message to the application (which won't be able to process it as it will get stuck in qDebug() because text output to the window will be blocked for the time of the mark-n-paste operation).

Note: See TracTickets for help on using tickets.