File indexing completed on 2024-05-19 16:35:34

0001 /*
0002     SPDX-FileCopyrightText: 2021 David Redondo <kde@david-redondo.de>
0003     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 
0006 #include "datasource.h"
0007 
0008 namespace KWin
0009 {
0010 namespace Xwl
0011 {
0012 XwlDataSource::~XwlDataSource()
0013 {
0014     Q_EMIT aboutToBeDestroyed();
0015 }
0016 
0017 void XwlDataSource::requestData(const QString &mimeType, qint32 fd)
0018 {
0019     Q_EMIT dataRequested(mimeType, fd);
0020 }
0021 
0022 void XwlDataSource::cancel()
0023 {
0024 }
0025 
0026 QStringList XwlDataSource::mimeTypes() const
0027 {
0028     return m_mimeTypes;
0029 }
0030 void XwlDataSource::setMimeTypes(const QStringList &mimeTypes)
0031 {
0032     m_mimeTypes = mimeTypes;
0033 }
0034 
0035 void XwlDataSource::accept(const QString &mimeType)
0036 {
0037     m_accepted = !mimeType.isEmpty();
0038 }
0039 
0040 KWaylandServer::DataDeviceManagerInterface::DnDActions XwlDataSource::supportedDragAndDropActions() const
0041 {
0042     return m_supportedDndActions;
0043 }
0044 
0045 void XwlDataSource::setSupportedDndActions(KWaylandServer::DataDeviceManagerInterface::DnDActions dndActions)
0046 {
0047     m_supportedDndActions = dndActions;
0048     Q_EMIT supportedDragAndDropActionsChanged();
0049 }
0050 
0051 KWaylandServer::DataDeviceManagerInterface::DnDAction XwlDataSource::selectedDndAction() const
0052 {
0053     return m_dndAction;
0054 }
0055 
0056 void XwlDataSource::dndAction(KWaylandServer::DataDeviceManagerInterface::DnDAction action)
0057 {
0058     m_dndAction = action;
0059 }
0060 
0061 bool XwlDataSource::isAccepted() const
0062 {
0063     return m_accepted;
0064 }
0065 }
0066 }