diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-04-06 12:27:17 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-05-05 10:04:10 +0200 |
commit | a90f994c5d1e3edeafa8dc8048fe7c6a74aead1a (patch) | |
tree | 574ba8a1dbd01701f52a457cab175608a6110823 /src | |
parent | 06fc47309609b9be735817da4f3bdf2e30e0b99c (diff) |
Fix navigation to non-local URLs
They are passed in another part of the DropItem object.
Task-number: QTBUG-102192
Change-Id: If52a88ce2688c25ea0edcc0d1e8f962f2cdd29dd
Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
(cherry picked from commit 742e6786aeb500ef9bc850bf84803d5f388e3927)
Diffstat (limited to 'src')
-rw-r--r-- | src/core/web_contents_adapter.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 5b81bd3fc..cca31e144 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1496,8 +1496,10 @@ static QMimeData *mimeDataFromDropData(const content::DropData &dropData) mimeData->setText(toQt(*dropData.text)); if (dropData.html.has_value()) mimeData->setHtml(toQt(*dropData.html)); - if (dropData.url.is_valid()) + if (dropData.url.is_valid()) { mimeData->setUrls(QList<QUrl>() << toQt(dropData.url)); + mimeData->setText(toQt(dropData.url_title)); + } if (!dropData.custom_data.empty()) { base::Pickle pickle; ui::WriteCustomDataToPickle(dropData.custom_data, &pickle); @@ -1621,6 +1623,11 @@ static void fillDropDataFromMimeData(content::DropData *dropData, const QMimeDat } if (!dropData->filenames.empty()) return; + if (mimeData->hasUrls()) { + dropData->url = toGurl(urls.first()); + if (mimeData->hasText()) + dropData->url_title = toString16(mimeData->text()); + } if (mimeData->hasHtml()) dropData->html = toOptionalString16(mimeData->html()); if (mimeData->hasText()) |