consolidate loading a bit more even, only save when applet is new

This commit is contained in:
Aaron Seigo 2013-02-13 21:38:47 +01:00
parent ec1c4d18fc
commit bc1b63ebad
3 changed files with 11 additions and 11 deletions

View File

@ -539,10 +539,19 @@ void Containment::addApplet(Applet *applet, const QPointF &pos)
connect(applet, SIGNAL(activate()), this, SIGNAL(activate()));
if (!currentContainment) {
applet->restore(*applet->d->mainConfigGroup());
const bool isNew = applet->d->mainConfigGroup()->entryMap().isEmpty();
if (!isNew) {
applet->restore(*applet->d->mainConfigGroup());
}
applet->init();
if (isNew) {
applet->save(*applet->d->mainConfigGroup());
emit configNeedsSaving();
}
//FIXME: an on-appear animation would be nice to have again
d->appletAppeared(applet);
}
applet->updateConstraints(Plasma::AllConstraints);

View File

@ -423,14 +423,6 @@ void ContainmentPrivate::appletDeleted(Plasma::Applet *applet)
emit q->configNeedsSaving();
}
void ContainmentPrivate::appletAppeared(Applet *applet)
{
//kDebug() << type << Containment::DesktopContainment;
KConfigGroup *cg = applet->d->mainConfigGroup();
applet->save(*cg);
emit q->configNeedsSaving();
}
bool ContainmentPrivate::isPanelContainment() const
{
return type == Containment::PanelContainment || type == Containment::CustomPanelContainment;

View File

@ -88,7 +88,6 @@ public:
bool isPanelContainment() const;
void setLockToolText();
void appletDeleted(Applet*);
void appletAppeared(Applet*);
void addContainmentActions(KMenu &desktopMenu, QEvent *event);
void addAppletActions(KMenu &desktopMenu, Applet *applet, QEvent *event);
void checkRemoveAction();