Don't copy binary data to text type clipboard

Don't copy images or other binary data to the text MIME type of the
system clipboard. They are still copied into the internal buffer and
into the HTML MIME type though. We don't copy them into the text-only
clipboard because that doesn't really work well. Neither the original
binary data nor a "BLOB" string nor the BASE64 encoded data seem to be a
safe bet, so we just omit these cells.
This commit is contained in:
Martin Kleusberg
2017-12-22 19:15:41 +01:00
parent c753e56d62
commit e7a810913f

View File

@@ -187,8 +187,7 @@ void ExtendedTableWidget::copy(const bool withHeaders)
while (i.hasNext()) {
if (isColumnHidden(i.next().column()))
i.remove();
}
}
// Abort if there's nothing to copy
if (indices.isEmpty())
@@ -312,13 +311,11 @@ void ExtendedTableWidget::copy(const bool withHeaders)
QString imageBase64 = ba.toBase64();
htmlResult.append("<img src=\"data:image/png;base64,");
htmlResult.append(imageBase64);
result.append(imageBase64); // TODO: Or should be just "Image"?
result.append(QString());
htmlResult.append("\" alt=\"Image\">");
} else {
QByteArray text;
if (m->isBinary(index))
text = data.toByteArray().toBase64(); // TODO: Or should be just "BLOB"?
else
if (!m->isBinary(index))
text = data.toByteArray();
// Table cell data: text