remove ContainmentActions::event, replace with triggering methods

This commit is contained in:
Aaron Seigo 2012-11-09 19:50:40 +01:00
parent 471e1b82f5
commit b75080eb57
3 changed files with 18 additions and 16 deletions

View File

@ -482,18 +482,6 @@ void Containment::setLocation(Location location)
return;
}
bool emitGeomChange = false;
if ((location == TopEdge || location == BottomEdge) &&
(d->location == TopEdge || d->location == BottomEdge)) {
emitGeomChange = true;
}
if ((location == RightEdge || location == LeftEdge) &&
(d->location == RightEdge || d->location == LeftEdge)) {
emitGeomChange = true;
}
d->location = location;
foreach (Applet *applet, d->applets) {
@ -751,7 +739,11 @@ void Containment::wheelEvent(QWheelEvent *event)
QString trigger = ContainmentActions::eventToString(event);
if (d->prepareContainmentActions(trigger, event->globalPos())) {
d->actionPlugins()->value(trigger)->contextEvent(event);
if (event->delta() > 0) {
d->actionPlugins()->value(trigger)->performNext();
} else {
d->actionPlugins()->value(trigger)->performPrevious();
}
event->accept();
}
}

View File

@ -128,9 +128,17 @@ void ContainmentActions::configurationAccepted()
//do nothing by default
}
void ContainmentActions::contextEvent(QEvent *event)
QAction *ContainmentActions::triggerableContextAction()
{
return 0;
}
void ContainmentActions::performNext()
{
}
void ContainmentActions::performPrevious()
{
Q_UNUSED(event)
}
QList<QAction*> ContainmentActions::contextualActions()

View File

@ -115,7 +115,9 @@ class PLASMA_EXPORT ContainmentActions : public QObject
* those parameters.
* The event may be a QMouseEvent or a QWheelEvent.
*/
virtual void contextEvent(QEvent *event);
virtual QAction *triggerableContextAction();
virtual void performNext();
virtual void performPrevious();
/**
* Implement this to provide a list of actions that can be added to another menu