2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
2020-06-25 15:27:52 +00:00
|
|
|
SPDX-FileCopyrightText: 2020 David Edmundson <davidedmundson@kde.org>
|
2020-03-15 15:19:28 +00:00
|
|
|
|
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
|
|
*/
|
2021-03-10 16:08:30 +00:00
|
|
|
#pragma once
|
2014-11-04 14:10:22 +00:00
|
|
|
|
2020-05-12 11:26:48 +00:00
|
|
|
#include "abstract_data_source.h"
|
2014-11-04 14:10:22 +00:00
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
#include <KWaylandServer/kwaylandserver_export.h>
|
2014-11-04 14:10:22 +00:00
|
|
|
|
2017-11-26 15:31:57 +00:00
|
|
|
#include "datadevicemanager_interface.h"
|
2014-11-04 14:10:22 +00:00
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
namespace KWaylandServer
|
2014-11-04 14:10:22 +00:00
|
|
|
{
|
|
|
|
|
2020-06-25 15:27:52 +00:00
|
|
|
class DataSourceInterfacePrivate;
|
|
|
|
|
2015-09-10 11:36:42 +00:00
|
|
|
/**
|
|
|
|
* @brief Represents the Resource for the wl_data_source interface.
|
|
|
|
**/
|
2020-05-12 11:26:48 +00:00
|
|
|
class KWAYLANDSERVER_EXPORT DataSourceInterface : public AbstractDataSource
|
2014-11-04 14:10:22 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
virtual ~DataSourceInterface();
|
|
|
|
|
2020-05-12 11:26:48 +00:00
|
|
|
void accept(const QString &mimeType) override;
|
|
|
|
void requestData(const QString &mimeType, qint32 fd) override;
|
|
|
|
void cancel() override;
|
2014-11-04 14:10:22 +00:00
|
|
|
|
2020-05-12 11:26:48 +00:00
|
|
|
QStringList mimeTypes() const override;
|
2014-11-04 14:10:22 +00:00
|
|
|
|
2014-11-05 14:22:15 +00:00
|
|
|
static DataSourceInterface *get(wl_resource *native);
|
|
|
|
|
2017-11-26 15:31:57 +00:00
|
|
|
/**
|
|
|
|
* @returns The Drag and Drop actions supported by this DataSourceInterface.
|
|
|
|
**/
|
2020-05-12 11:26:48 +00:00
|
|
|
DataDeviceManagerInterface::DnDActions supportedDragAndDropActions() const override;
|
2017-11-26 15:31:57 +00:00
|
|
|
|
2020-05-12 11:26:48 +00:00
|
|
|
void dropPerformed() override;
|
|
|
|
void dndFinished() override;
|
|
|
|
void dndAction(DataDeviceManagerInterface::DnDAction action) override;
|
2014-11-04 14:10:22 +00:00
|
|
|
|
2020-06-25 15:27:52 +00:00
|
|
|
wl_resource *resource() const;
|
|
|
|
|
|
|
|
wl_client *client() const override;
|
|
|
|
|
2020-10-28 11:58:25 +00:00
|
|
|
bool isAccepted() const;
|
|
|
|
void setAccepted(bool accepted);
|
|
|
|
|
2014-11-04 14:10:22 +00:00
|
|
|
private:
|
2020-06-25 15:27:52 +00:00
|
|
|
friend class DataDeviceManagerInterfacePrivate;
|
2014-11-20 15:40:14 +00:00
|
|
|
explicit DataSourceInterface(DataDeviceManagerInterface *parent, wl_resource *parentResource);
|
2014-11-04 14:10:22 +00:00
|
|
|
|
2020-06-25 15:27:52 +00:00
|
|
|
QScopedPointer<DataSourceInterfacePrivate> d;
|
2014-11-04 14:10:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
Q_DECLARE_METATYPE(KWaylandServer::DataSourceInterface*)
|