don't accept drops that we don't understand or when we are immutable

CCBUG:163908

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=820230
This commit is contained in:
Aaron J. Seigo 2008-06-13 16:21:59 +00:00
parent 1f6736bb42
commit bdb635e3a8
2 changed files with 14 additions and 2 deletions

View File

@ -691,6 +691,14 @@ KPluginInfo::List Containment::listContainmentsForMimetype(const QString &mimety
return KPluginInfo::fromServices(offers);
}
void Containment::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
{
kDebug() << immutability() << Mutable << (immutability() == Mutable);
event->setAccepted(immutability() == Mutable &&
(event->mimeData()->hasFormat(static_cast<Corona*>(scene())->appletMimeType()) ||
KUrl::List::canDecode(event->mimeData())));
}
void Containment::dropEvent(QGraphicsSceneDragDropEvent *event)
{
//kDebug() << event->mimeData()->text();

View File

@ -387,9 +387,13 @@ class PLASMA_EXPORT Containment : public Applet
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event);
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
protected Q_SLOTS:
/**
* @internal
* @reimplemented from QGraphicsItem
*/
void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
/**
* @reimplemented from QGraphicsItem
*/
void dropEvent(QGraphicsSceneDragDropEvent *event);