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

View File

@ -83,7 +83,7 @@ public:
void mimeTypeRetrieved(KIO::Job *job, const QString &mimetype); void mimeTypeRetrieved(KIO::Job *job, const QString &mimetype);
void containmentActions(KMenu &desktopMenu); void containmentActions(KMenu &desktopMenu);
void appletActions(KMenu &desktopMenu, Applet *applet, bool includeApplet); 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(); void checkRemoveAction();
Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(), Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(),