- remove deprecated createInstance call

- as Containment is going to remain an Applet, we can put the context menu hack in Applet instead which is nicer on the widgets anyways. also make it a bit less of a hack...

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=717489
This commit is contained in:
Aaron J. Seigo 2007-09-26 23:01:57 +00:00
parent f4efdfa1f0
commit 9fa4ea3ec3
2 changed files with 27 additions and 1 deletions

View File

@ -990,7 +990,7 @@ Applet* Applet::loadApplet(const QString& appletName, uint appletId, const QVari
QVariantList allArgs;
allArgs << offers.first()->storageId() << appletId << args;
QString error;
Applet* applet = KService::createInstance<Plasma::Applet>(offers.first(), 0, allArgs, &error);
Applet* applet = offers.first()->createInstance<Plasma::Applet>(0, allArgs, &error);
if (!applet) {
kDebug() << "Couldn't load applet \"" << appletName << "\"! reason given: " << error;
@ -1073,6 +1073,27 @@ QVariant Applet::itemChange(GraphicsItemChange change, const QVariant &value)
return QGraphicsItem::itemChange(change, value);
}
void Applet::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
//kDebug() << "context menu event!";
if (!scene()) {
return;
}
Applet* containment = dynamic_cast<Plasma::Applet*>(topLevelItem());
if (!containment) {
Widget::contextMenuEvent(event);
return;
}
// we want to pass up the context menu event to the Containment at
// this point
containment->contextMenuEvent(event);
return;
}
} // Plasma namespace
#include "applet.moc"

View File

@ -553,6 +553,11 @@ class PLASMA_EXPORT Applet : public Widget
**/
bool eventFilter( QObject *o, QEvent *e );
/**
* Reimplemented from QGraphicsItem
*/
void contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent);
/**
* @internal for adjusting the shadow
*/