* addPlasmoid -> addApplet

* pop up a failure applet when that happens...

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=687030
This commit is contained in:
Aaron J. Seigo 2007-07-12 18:37:13 +00:00
parent 8ee8f97aa1
commit 843ab6a69f
2 changed files with 16 additions and 14 deletions

View File

@ -185,20 +185,22 @@ QRectF Corona::maxSizeHint() const
return sceneRect();
}
Applet* Corona::addPlasmoid(const QString& name, const QStringList& args)
Applet* Corona::addApplet(const QString& name, const QStringList& args)
{
Applet* applet = Applet::loadApplet(name, 0, args);
if (applet) {
addItem(applet);
//applet->constraintsUpdated();
d->applets << applet;
connect(applet, SIGNAL(destroyed(QObject*)),
this, SLOT(appletDestroyed(QObject*)));
Phase::self()->animateItem(applet, Phase::Appear);
} else {
kDebug() << "Plasmoid " << name << " could not be loaded." << endl;
if (!applet) {
kDebug() << "Applet " << name << " could not be loaded." << endl;
applet = new Applet;
applet->setFailedToLaunch(true);
}
addItem(applet);
//applet->constraintsUpdated();
d->applets << applet;
connect(applet, SIGNAL(destroyed(QObject*)),
this, SLOT(appletDestroyed(QObject*)));
Phase::self()->animateItem(applet, Phase::Appear);
return applet;
}
@ -249,7 +251,7 @@ void Corona::dropEvent(QGraphicsSceneDragDropEvent *event)
//TODO This will pretty much move into dragEnterEvent()
QString plasmoidName;
plasmoidName = event->mimeData()->data("text/x-plasmoidservicename");
addPlasmoid(plasmoidName);
addApplet(plasmoidName);
d->applets.last()->setPos(event->pos());
event->acceptProposedAction();
@ -258,7 +260,7 @@ void Corona::dropEvent(QGraphicsSceneDragDropEvent *event)
foreach (const KUrl& url, urls) {
QStringList args;
args << url.url();
Applet* button = addPlasmoid("url", args);
Applet* button = addApplet("url", args);
if (button) {
//button->setSize(128,128);
button->setPos(event->scenePos() - QPoint(button->boundingRect().width()/2,

View File

@ -83,13 +83,13 @@ public Q_SLOTS:
void setFormFactor(Plasma::FormFactor formFactor);
/**
* Adds a plasmoid applet to the scene
* Adds an applet to the scene
*
* @param name the plugin name for the applet, as given by
* KPluginInfo::pluginName()
* @param args argument list to pass to the plasmoid
*/
Applet* addPlasmoid(const QString& name, const QStringList& args = QStringList());
Applet* addApplet(const QString& name, const QStringList& args = QStringList());
/**
* Adds a SuperKaramba theme to the scene