add clearApplets() method to Corona, as discussed on panel-devel.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=698001
This commit is contained in:
Leo Franchi 2007-08-08 17:32:32 +00:00
parent b4a001e6e1
commit c89bd8f0bf
2 changed files with 13 additions and 3 deletions

View File

@ -191,9 +191,8 @@ void Corona::saveApplets() const
void Corona::loadApplets(const QString& config) void Corona::loadApplets(const QString& config)
{ {
qDeleteAll(d->applets); clearApplets();
d->applets.clear();
KConfig appletConfig(config, KConfig::OnlyLocal); KConfig appletConfig(config, KConfig::OnlyLocal);
foreach (const QString& group, appletConfig.groupList()) { foreach (const QString& group, appletConfig.groupList()) {
KConfigGroup cg(&appletConfig, group); KConfigGroup cg(&appletConfig, group);
@ -207,6 +206,12 @@ void Corona::loadApplets()
loadApplets("plasma-appletsrc"); loadApplets("plasma-appletsrc");
} }
void Corona::clearApplets()
{
qDeleteAll(d->applets);
d->applets.clear();
}
Applet* Corona::addApplet(const QString& name, const QStringList& args, uint id, const QRectF& geometry) Applet* Corona::addApplet(const QString& name, const QStringList& args, uint id, const QRectF& geometry)
{ {
Applet* applet = Applet::loadApplet(name, id, args); Applet* applet = Applet::loadApplet(name, id, args);

View File

@ -90,6 +90,11 @@ public:
*/ */
void loadApplets(const QString &config); void loadApplets(const QString &config);
/**
* Clear the Corona from all applets.
*/
void clearApplets();
public Q_SLOTS: public Q_SLOTS:
/** /**
* Load applets from the default config file * Load applets from the default config file