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-02 15:49:26 +0200 |
commit | 2c0a66dd1c308923639ad964f067c6e49b626e26 (patch) | |
tree | 3a55500e975e999c0bed7f91e197d34c8019057e /src/core | |
parent | d17818da1244f862959bb0bd6f60be0d866609f3 (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/core')
-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 d298c0837..41ec997a3 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1487,8 +1487,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); @@ -1612,6 +1614,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()) |