support config for applets children of applets

This commit is contained in:
Marco Martin 2014-05-07 13:08:55 +02:00
parent 1805bb7496
commit 2d94312f97
3 changed files with 20 additions and 3 deletions

View File

@ -145,6 +145,13 @@ void Containment::init()
actions()->addAction("lock widgets", lockDesktopAction);
}
}
//HACK: this is valid only in the systray case
connect(this, &Containment::configureRequested, [=] (Plasma::Applet *a) {
if (Plasma::Applet *p = qobject_cast<Plasma::Applet *>(parent())) {
emit p->containment()->configureRequested(a);
}
});
}
// helper function for sorting the list of applets

View File

@ -53,11 +53,13 @@ public:
ConfigView *q;
QWeakPointer <Plasma::Applet> applet;
ConfigModel *configModel;
Plasma::Corona *corona;
};
ConfigViewPrivate::ConfigViewPrivate(Plasma::Applet *appl, ConfigView *view)
: q(view),
applet(appl)
applet(appl),
corona(0)
{
}
@ -75,8 +77,16 @@ void ConfigViewPrivate::init()
q->setColor(Qt::transparent);
q->setTitle(i18n("%1 Settings", applet.data()->title()));
if (!applet.data()->containment()->corona()->package().isValid()) {
//systray case
if (!applet.data()->containment()->corona()) {
Plasma::Applet *a = qobject_cast<Plasma::Applet *>(applet.data()->containment()->parent());
if (a) {
corona = a->containment()->corona();
}
} else if (!applet.data()->containment()->corona()->package().isValid()) {
qWarning() << "Invalid home screen package";
} else {
corona = applet.data()->containment()->corona();
}
q->setResizeMode(QQuickView::SizeViewToRootObject);
@ -116,7 +126,7 @@ ConfigView::~ConfigView()
void ConfigView::init()
{
setSource(QUrl::fromLocalFile(d->applet.data()->containment()->corona()->package().filePath("appletconfigurationui")));
setSource(QUrl::fromLocalFile(d->corona->package().filePath("appletconfigurationui")));
}
ConfigModel *ConfigView::configModel() const