Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwldataoffer.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:critical reason:network-protocol
4
6
9
10#include <unistd.h>
11
12QT_BEGIN_NAMESPACE
13
14namespace QtWayland
15{
16
17DataOffer::DataOffer(DataSource *dataSource, QtWaylandServer::wl_data_device::Resource *target)
20{
21 // FIXME: connect to dataSource and reset m_dataSource on destroy
22 target->data_device_object->send_data_offer(target->handle, resource()->handle);
23 const auto mimeTypes = dataSource->mimeTypes();
24 for (const QString &mimeType : mimeTypes) {
25 send_offer(mimeType);
26 }
27}
28
30{
31}
32
33void DataOffer::data_offer_accept(Resource *resource, uint32_t serial, const QString &mimeType)
34{
35 Q_UNUSED(resource);
36 Q_UNUSED(serial);
37 if (m_dataSource)
38 m_dataSource->accept(mimeType);
39}
40
41void DataOffer::data_offer_receive(Resource *resource, const QString &mimeType, int32_t fd)
42{
43 Q_UNUSED(resource);
44 if (m_dataSource)
45 m_dataSource->send(mimeType, fd);
46 else
47 close(fd);
48}
49
50void DataOffer::data_offer_destroy(Resource *resource)
51{
52 wl_resource_destroy(resource->handle);
53}
54
56{
57 delete this;
58}
59
60}
61
62QT_END_NAMESPACE
void data_offer_receive(Resource *resource, const QString &mime_type, int32_t fd) override
DataOffer(DataSource *data_source, QtWaylandServer::wl_data_device::Resource *target)
void data_offer_destroy_resource(Resource *resource) override
void data_offer_accept(Resource *resource, uint32_t serial, const QString &mime_type) override
void data_offer_destroy(Resource *resource) override