Merge "show/hide view when applet asked to be destroyed"

This commit is contained in:
Marco Martin 2014-11-04 15:21:41 +01:00 committed by Gerrit Code Review
commit 8fe43b3c20
2 changed files with 10 additions and 0 deletions

View File

@ -44,6 +44,7 @@ public:
Plasma::Types::FormFactor formFactor() const;
Plasma::Types::Location location() const;
void showConfigurationInterface(Plasma::Applet *applet);
void updateDestroyed(bool destroyed);
View *q;
friend class View;
@ -102,6 +103,9 @@ void ViewPrivate::setContainment(Plasma::Containment *cont)
q, &View::formFactorChanged);
QObject::connect(cont, &Plasma::Containment::configureRequested,
q, &View::showConfigurationInterface);
QObject::connect(cont, SIGNAL(destroyedChanged(bool)),
q, SLOT(updateDestroyed(bool)));
q->setVisible(!cont->destroyed() && cont->isUiReady());
} else {
return;
}
@ -162,6 +166,11 @@ void ViewPrivate::showConfigurationInterface(Plasma::Applet *applet)
configView->show();
}
void ViewPrivate::updateDestroyed(bool destroyed)
{
q->setVisible(!destroyed);
}
View::View(Plasma::Corona *corona, QWindow *parent)
: QQuickView(parent),
d(new ViewPrivate(corona, this))

View File

@ -127,6 +127,7 @@ Q_SIGNALS:
private:
ViewPrivate *const d;
Q_PRIVATE_SLOT(d, void updateDestroyed(bool))
friend class ViewPrivate;
};