summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2016-05-25 10:18:35 +0200
committerJani Heikkinen <jani.heikkinen@qt.io>2016-05-25 15:41:28 +0000
commit3407b0a8545d84df4b941a5a3f5a5859dc51cd53 (patch)
treeee6f25d61552a4b97fa1c91503a8b0a4754621b9 /src
parentd2a791d81827e69c084a413094613f569f22a0b7 (diff)
Make dropping files onto QWebEngineView more consistent
When dropping files we created a DropData object with file URLs and the text set to a newline-separated list of file URLs. This is inconsistent with what Chromium does and web developers expect. Fill DropData only with one kind of data at a time. Task-number: QTBUG-53573 Change-Id: Ia808ad62389e0dc01b02c6b06182ee697f11ad40 Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/web_contents_adapter.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 5fe7c8dc9..260efc081 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -1120,10 +1120,7 @@ static blink::WebDragOperationsMask toWeb(const Qt::DropActions action)
static void fillDropDataFromMimeData(content::DropData *dropData, const QMimeData *mimeData)
{
- if (mimeData->hasText())
- dropData->text = toNullableString16(mimeData->text());
- if (mimeData->hasHtml())
- dropData->html = toNullableString16(mimeData->html());
+ Q_ASSERT(dropData->filenames.empty());
Q_FOREACH (const QUrl &url, mimeData->urls()) {
if (url.isLocalFile()) {
ui::FileInfo uifi;
@@ -1131,6 +1128,12 @@ static void fillDropDataFromMimeData(content::DropData *dropData, const QMimeDat
dropData->filenames.push_back(uifi);
}
}
+ if (!dropData->filenames.empty())
+ return;
+ if (mimeData->hasHtml())
+ dropData->html = toNullableString16(mimeData->html());
+ else if (mimeData->hasText())
+ dropData->text = toNullableString16(mimeData->text());
}
void WebContentsAdapter::enterDrag(QDragEnterEvent *e, const QPoint &screenPos)