diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2017-08-17 14:59:51 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-08-18 20:59:02 +0000 |
commit | 99f84ffd2c0c78014a24534a863aa1c755abd51c (patch) | |
tree | 9858801c9ed2c7743e7190b339fc40692baf8fe5 /src/core/web_contents_adapter.h | |
parent | 8df8a253b13e866dc23fa6f874d23b7150dc1b05 (diff) |
Handle content::DropData::file_contents
DropData::file_contents and DropData::file_description_filename are
filled by Chromium if the user drags an image from a web page. Write the
file's content into a file with the suggested file name in a temporary
directory, and set the drop action to "move".
This enables users to drag images from the browser to the desktop or a
file browser.
The file is moved by the client to the target location.
The temporary directory is removed when the page is closed.
Note that Chrome doesn't use this temporary directory trick, but employs
techniques like XDS [1] on Linux to transfer the data via the native
clipboard/DnD MIME object. Unfortunately QDrag doesn't support this.
Support could be added, but I consider this solution as good enough.
[1] https://www.freedesktop.org/wiki/Specifications/XDS/
Task-number: QTBUG-60790
Change-Id: I44f2b3170a124e861ed4131c421903d895b70715
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/core/web_contents_adapter.h')
-rw-r--r-- | src/core/web_contents_adapter.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h index 10c65a6cb..46c8d2604 100644 --- a/src/core/web_contents_adapter.h +++ b/src/core/web_contents_adapter.h @@ -58,6 +58,7 @@ QT_BEGIN_NAMESPACE class QAccessibleInterface; class QDragEnterEvent; class QDragMoveEvent; +class QMimeData; class QPageLayout; class QString; class QWebChannel; @@ -187,6 +188,7 @@ private: Q_DISABLE_COPY(WebContentsAdapter) Q_DECLARE_PRIVATE(WebContentsAdapter) void waitForUpdateDragActionCalled(); + bool handleDropDataFileContents(const content::DropData &dropData, QMimeData *mimeData); QScopedPointer<WebContentsAdapterPrivate> d_ptr; }; |