Teach ContainmentInterface::processMimeData how to handle Task Manager drops
Summary: To explicitly confine Task Manager drops to Plasma and avoid accidental drops on other apps, D13274 makes it store task launcher URLs in a special internal MIME type instead of the generic text/url one. This change to processMimeData() adds the necessary conversion back. Reviewers: davidedmundson, Zren, mart Subscribers: kde-frameworks-devel, plasma-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D13275
This commit is contained in:
parent
b169aa50f9
commit
e108d7e90e
@ -450,6 +450,12 @@ void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y, KI
|
||||
|
||||
qDebug() << "Arrived mimeData" << mimeData->urls() << mimeData->formats() << "at" << x << ", " << y;
|
||||
|
||||
// Catch drops from a Task Manager and convert to usable URL.
|
||||
if (!mimeData->hasUrls() && mimeData->hasFormat(QStringLiteral("text/x-orgkdeplasmataskmanager_taskurl"))) {
|
||||
QList<QUrl> urls = {QUrl(QString::fromUtf8(mimeData->data(QStringLiteral("text/x-orgkdeplasmataskmanager_taskurl"))))};
|
||||
mimeData->setUrls(urls);
|
||||
}
|
||||
|
||||
if (mimeData->hasFormat(QStringLiteral("text/x-plasmoidservicename"))) {
|
||||
QString data = QString::fromUtf8( mimeData->data(QStringLiteral("text/x-plasmoidservicename")) );
|
||||
const QStringList appletNames = data.split(QLatin1Char('\n'), QString::SkipEmptyParts);
|
||||
|
Loading…
Reference in New Issue
Block a user