diff --git a/applet.cpp b/applet.cpp index 8834cb0a0..392494683 100644 --- a/applet.cpp +++ b/applet.cpp @@ -4,6 +4,7 @@ * Copyright 2005 by Aaron Seigo * Copyright 2007 by Riccardo Iaconelli * Copyright 2008 by Ménard Alexis + * Copyright (c) 2009 Chani Armitage * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as diff --git a/containment.cpp b/containment.cpp index 84352721c..a08d29dd1 100644 --- a/containment.cpp +++ b/containment.cpp @@ -1,6 +1,7 @@ /* * Copyright 2007 by Aaron Seigo * Copyright 2008 by Ménard Alexis + * Copyright 2009 Chani Armitage * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -524,6 +525,10 @@ void Containment::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void Containment::mousePressEvent(QGraphicsSceneMouseEvent *event) { event->ignore(); + QGraphicsItem *item = scene()->itemAt(event->scenePos()); + if (item != this) { + return; //no unexpected click-throughs + } QString trigger = ContextAction::eventToString(event); @@ -534,10 +539,7 @@ void Containment::mousePressEvent(QGraphicsSceneMouseEvent *event) } if (d->wallpaper && d->wallpaper->isInitialized() && !event->isAccepted()) { - QGraphicsItem *item = scene()->itemAt(event->scenePos()); - if (item == this) { - d->wallpaper->mousePressEvent(event); - } + d->wallpaper->mousePressEvent(event); } if (event->isAccepted()) { @@ -551,6 +553,10 @@ void Containment::mousePressEvent(QGraphicsSceneMouseEvent *event) void Containment::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { event->ignore(); + QGraphicsItem *item = scene()->itemAt(event->scenePos()); + if (item != this) { + return; //no unexpected click-throughs + } QString trigger = ContextAction::eventToString(event); @@ -563,10 +569,7 @@ void Containment::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) } if (d->wallpaper && d->wallpaper->isInitialized()) { - QGraphicsItem *item = scene()->itemAt(event->scenePos()); - if (item == this) { - d->wallpaper->mouseReleaseEvent(event); - } + d->wallpaper->mouseReleaseEvent(event); } if (event->isAccepted() || !isContainment()) { @@ -614,6 +617,12 @@ void ContainmentPrivate::containmentActions(KMenu &desktopMenu) QString trigger = "RightButton;NoModifier"; //get base context actions if (ContextAction *cAction = contextActions.value(trigger)) { + if (!cAction->isInitialized()) { + KConfigGroup cfg(&(q->config()), "ContextActions"); + KConfigGroup actionConfig = KConfigGroup(&cfg, cAction->pluginName()); + cAction->restore(actionConfig); + } + if (cAction->configurationRequired()) { //it needs configuring //FIXME the text could be better. @@ -703,6 +712,7 @@ bool ContainmentPrivate::showContextMenu(const QPointF &point, const QPoint &scr item = 0; } + //FIXME what if it's a handle? while (item) { applet = qgraphicsitem_cast(item); if (applet && !applet->isContainment()) { @@ -1413,6 +1423,12 @@ void Containment::keyPressEvent(QKeyEvent *event) void Containment::wheelEvent(QGraphicsSceneWheelEvent *event) { + event->ignore(); + QGraphicsItem *item = scene()->itemAt(event->scenePos()); + if (item != this) { + return; //no unexpected click-throughs + } + QString trigger = ContextAction::eventToString(event); if (d->contextActions.contains(trigger)) { @@ -1729,9 +1745,10 @@ QStringList Containment::contextActionTriggers() return d->contextActions.keys(); } -ContextAction *Containment::contextAction(QString trigger) +QString Containment::contextAction(const QString &trigger) { - return d->contextActions.value(trigger); + ContextAction *c = d->contextActions.value(trigger); + return c ? c->pluginName() : QString(); } void Containment::setActivity(const QString &activity) diff --git a/containment.h b/containment.h index c6d4fc8e6..affa95b1d 100644 --- a/containment.h +++ b/containment.h @@ -1,6 +1,7 @@ /* * Copyright 2007 by Aaron Seigo * Copyright 2008 by Ménard Alexis + * Copyright (c) 2009 Chani Armitage * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -381,10 +382,10 @@ class PLASMA_EXPORT Containment : public Applet QStringList contextActionTriggers(); /** - * @return the plugin for the given trigger + * @return the plugin name for the given trigger * @since 4.3 */ - ContextAction *contextAction(QString trigger); + QString contextAction(const QString &trigger); Q_SIGNALS: /** diff --git a/contextaction.cpp b/contextaction.cpp index 9cd9ca91b..0702f1683 100644 --- a/contextaction.cpp +++ b/contextaction.cpp @@ -1,6 +1,5 @@ /* - * Copyright 2008 by Aaron Seigo - * Copyright 2008 by Petri Damsten + * Copyright (c) 2009 Chani Armitage * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as diff --git a/contextaction.h b/contextaction.h index 64d84534d..d10428d02 100644 --- a/contextaction.h +++ b/contextaction.h @@ -1,6 +1,5 @@ /* - * Copyright 2008 by Aaron Seigo - * Copyright 2008 by Petri Damsten + * Copyright (c) 2009 Chani Armitage * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as diff --git a/corona.cpp b/corona.cpp index c77067c32..d6c350b94 100644 --- a/corona.cpp +++ b/corona.cpp @@ -2,6 +2,7 @@ * Copyright 2007 Matt Broadstone * Copyright 2007 Aaron Seigo * Copyright 2007 Riccardo Iaconelli + * Copyright (c) 2009 Chani Armitage * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as diff --git a/private/contextaction_p.h b/private/contextaction_p.h index c0eb1c644..4bba60757 100644 --- a/private/contextaction_p.h +++ b/private/contextaction_p.h @@ -1,6 +1,5 @@ /* - * Copyright 2008 by Aaron Seigo - * Copyright 2008 by Petri Damsten + * Copyright (c) 2009 Chani Armitage * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as