don't call restore() two times when swapping the containment

svn path=/trunk/KDE/kdelibs/; revision=1153214
This commit is contained in:
Giulio Camuffo 2010-07-22 20:06:06 +00:00
parent 5faa771dcb
commit 2a46966c22
2 changed files with 7 additions and 1 deletions

View File

@ -432,6 +432,7 @@ private:
Q_PRIVATE_SLOT(d, void showShortcutConfig())
friend class CoronaPrivate;
friend class View;
};
} // namespace Plasma

View File

@ -312,8 +312,10 @@ Containment *View::swapContainment(Plasma::Containment *existing, const QString
Containment *old = existing;
Plasma::Corona *corona = old->corona();
Plasma::Containment *c = corona->addContainment(name, args);
Plasma::Containment *c = corona->addContainmentDelayed(name, args);
if (c) {
c->init();
KConfigGroup oldConfig = old->config();
KConfigGroup newConfig = c->config();
@ -330,6 +332,9 @@ Containment *View::swapContainment(Plasma::Containment *existing, const QString
// load the configuration of the old containment into the new one
c->restore(newConfig);
c->updateConstraints(Plasma::StartupCompletedConstraint);
c->flushPendingConstraintsEvents();
emit corona->containmentAdded(c);
foreach (Applet *applet, c->applets()) {
applet->init();
// We have to flush the applet constraints manually