for contextmenu events triggered by the mouse on the containment, fall

through to the mouse events. it's easier to handle that way

svn path=/trunk/KDE/kdelibs/; revision=1017492
This commit is contained in:
Chani Armitage 2009-08-30 18:52:10 +00:00
parent 93aead97a1
commit 024d23a07f
2 changed files with 7 additions and 4 deletions

View File

@ -578,7 +578,7 @@ void Containment::showDropZone(const QPoint pos)
void Containment::showContextMenu(const QPointF &containmentPos, const QPoint &screenPos)
{
d->showContextMenu(mapToScene(containmentPos), screenPos, false);
d->showContextMenu(mapToScene(containmentPos), screenPos, false, false);
}
void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
@ -589,7 +589,8 @@ void Containment::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
return;
}
if (d->showContextMenu(event->scenePos(), event->screenPos(), true)) {
if (d->showContextMenu(event->scenePos(), event->screenPos(), true,
event->reason() == QGraphicsSceneContextMenuEvent::Mouse)) {
event->accept();
} else {
Applet::contextMenuEvent(event);
@ -714,7 +715,7 @@ Applet* ContainmentPrivate::appletAt(const QPointF &point)
return applet;
}
bool ContainmentPrivate::showContextMenu(const QPointF &point, const QPoint &screenPos, bool includeApplet)
bool ContainmentPrivate::showContextMenu(const QPointF &point, const QPoint &screenPos, bool includeApplet, bool isMouseEvent)
{
Applet *applet = appletAt(point);
@ -722,6 +723,8 @@ bool ContainmentPrivate::showContextMenu(const QPointF &point, const QPoint &scr
//kDebug() << "context menu event " << (QObject*)applet;
if (applet) {
appletActions(desktopMenu, applet, includeApplet);
} else if (isMouseEvent) {
return false; //fall through to plugin/wallpaper stuff
} else {
containmentActions(desktopMenu);
}

View File

@ -83,7 +83,7 @@ public:
void mimeTypeRetrieved(KIO::Job *job, const QString &mimetype);
void containmentActions(KMenu &desktopMenu);
void appletActions(KMenu &desktopMenu, Applet *applet, bool includeApplet);
bool showContextMenu(const QPointF &point, const QPoint &screenPos, bool includeApplet);
bool showContextMenu(const QPointF &point, const QPoint &screenPos, bool includeApplet, bool isMouseEvent);
void checkRemoveAction();
Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(),