summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@digia.com>2013-05-08 13:34:30 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-10 23:48:44 +0200
commit96d00ed19bcdb9224c0fe5bc7bc246fcfece0f0e (patch)
treef64b2f6f2bb74c5e8ef8c4d1ae15cec4f29ae6a3 /src/plugins/platforms/windows
parentd1bf366e42f2af69249001cfe6857e4db91739b3 (diff)
Fix HTML data transferring through the Clipboard on Windows
When transferring html formated data through the clipboard some of the html markup was lost when converting from Windows clipboard native mimedata to Qt mimedata type. On X11 we are sending everything - inluding <!DOCTYPE ...><html> .. </html>. This patch enables the same behavior on Windows. Task-number: QTBUG-30984 Change-Id: Ic0e339ad53955f1d31e8dff92ccf38b6eeec369a Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp
index a8bacd631d..629da4fd0d 100644
--- a/src/plugins/platforms/windows/qwindowsmime.cpp
+++ b/src/plugins/platforms/windows/qwindowsmime.cpp
@@ -917,11 +917,11 @@ QVariant QWindowsMimeHtml::convertToMime(const QString &mime, IDataObject *pData
qDebug("raw :");
qDebug(html);
#endif
- int start = html.indexOf("StartFragment:");
- int end = html.indexOf("EndFragment:");
+ int start = html.indexOf("StartHTML:");
+ int end = html.indexOf("EndHTML:");
if (start != -1) {
- int startOffset = start + 14;
+ int startOffset = start + 10;
int i = startOffset;
while (html.at(i) != '\r' && html.at(i) != '\n')
++i;
@@ -930,7 +930,7 @@ QVariant QWindowsMimeHtml::convertToMime(const QString &mime, IDataObject *pData
}
if (end != -1) {
- int endOffset = end + 12;
+ int endOffset = end + 8;
int i = endOffset ;
while (html.at(i) != '\r' && html.at(i) != '\n')
++i;
@@ -939,8 +939,7 @@ QVariant QWindowsMimeHtml::convertToMime(const QString &mime, IDataObject *pData
}
if (end > start && start > 0) {
- html = "<!--StartFragment-->" + html.mid(start, end - start);
- html += "<!--EndFragment-->";
+ html = html.mid(start, end - start);
html.replace('\r', "");
result = QString::fromUtf8(html);
}
@@ -954,10 +953,10 @@ bool QWindowsMimeHtml::convertFromMime(const FORMATETC &formatetc, const QMimeDa
QByteArray data = mimeData->html().toUtf8();
QByteArray result =
"Version:1.0\r\n" // 0-12
- "StartHTML:0000000105\r\n" // 13-35
- "EndHTML:0000000000\r\n" // 36-55
- "StartFragment:0000000000\r\n" // 58-86
- "EndFragment:0000000000\r\n\r\n"; // 87-105
+ "StartHTML:0000000107\r\n" // 13-35
+ "EndHTML:0000000000\r\n" // 36-55
+ "StartFragment:0000000000\r\n" // 56-81
+ "EndFragment:0000000000\r\n\r\n"; // 82-107
if (data.indexOf("<!--StartFragment-->") == -1)
result += "<!--StartFragment-->";