convenience method for loading applets via a KPluginInfo

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=668033
This commit is contained in:
Aaron J. Seigo 2007-05-24 20:51:59 +00:00
parent 1f797b162f
commit 4d4f9e0140
2 changed files with 21 additions and 0 deletions

View File

@ -230,6 +230,15 @@ Applet* Applet::loadApplet(const QString& appletName, uint appletId)
return applet;
}
Applet* Applet::loadApplet(const KPluginInfo* info, uint appletId)
{
if (!info) {
return 0;
}
loadApplet(info->pluginName(), appletId);
}
} // Plasma namespace
#include "applet.moc"

View File

@ -122,6 +122,18 @@ class PLASMA_EXPORT Applet : public QObject, public QGraphicsItemGroup
**/
static Applet* loadApplet(const QString &name, uint appletId = 0);
/**
* Attempts to load an applet, returning a pointer to the applet if
* successful. The caller takes responsibility for the applet, including
* deleting it when no longer needed.
*
* @param info KPluginInfo object for the desired applet
* @param applet unique ID to assign the applet, or zero to have one
* assigned automatically.
* @return a pointer to the loaded applet, or 0 on load failure
**/
static Applet* loadApplet(const KPluginInfo* info, uint appletId = 0);
Q_SIGNALS:
void requestFocus( bool focus );