show/hide view when applet asked to be destroyed

Change-Id: Id53300532c2322467188dbb44259f25dc6183a1e
This commit is contained in:
Marco Martin 2014-10-31 21:18:52 +01:00
parent 72b9a37fe9
commit 280902bbb5
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;
};