Client: advertise utf-8 text formats when creating drags

Some clients ignore text/plain only look for utf-8 text to be sent.

When creating a clipboard source we advertise both, but this step was
previously not copied for drag handling.

Pick-to: 6.9
Change-Id: Ibe1476c309e88d6499ae0e6cb96a96aa07b4af71
Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
David Edmundson 2024-11-29 15:15:27 +00:00
parent 0a8fe091f7
commit 446c613fa7

View File

@ -98,6 +98,12 @@ bool QWaylandDataDevice::startDrag(QMimeData *mimeData, Qt::DropActions supporte
if (mimeData->formats().isEmpty())
mimeData->setData("application/x-qt-avoid-empty-placeholder"_L1, QByteArray("1"));
static const QString plain = QStringLiteral("text/plain");
static const QString utf8 = QStringLiteral("text/plain;charset=utf-8");
if (mimeData->hasFormat(plain) && !mimeData->hasFormat(utf8))
mimeData->setData(utf8, mimeData->data(plain));
m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData));
if (version() >= 3)