Let containments override CompactApplet.qml
the CompactApplet file from the shell package defines the behavior of the poopup applets in the panel (it implements an internal dialog and all that jazz) implementing a simplified systray(both the one for the phone and a separate one for the desktop), i noticed that a containment may have different ideas on how to expand an applet: the systray would have for instance a single popup dialog and put all of its applet full representtions in the same Dialog, this lets containment representation to override that file (*if* won't get abused, that's the only thing makes me a bit on the fence about this) It would make possible also fairly different designs that have been proposed in the past, such as the bug sidebar similar to the "charm bar" Have to keep an eye opened if having the file list changing with the path may be an issue, but shouldn't as ChangeableMainScript already does something similar. Change-Id: I1c7fda55d6829d3a67f511c91822b131dea85ac1 REVIEW:126244
This commit is contained in:
parent
f35e514b7d
commit
5f92df4799
@ -118,6 +118,20 @@ void PlasmoidPackage::initPackage(KPackage::Package *package)
|
||||
package->addFileDefinition("mainconfigxml", "config/main.xml", i18n("Configuration XML file"));
|
||||
}
|
||||
|
||||
void PlasmoidPackage::pathChanged(KPackage::Package *package)
|
||||
{
|
||||
ChangeableMainScriptPackage::pathChanged(package);
|
||||
|
||||
if (!package->metadata().isValid()) {
|
||||
return;
|
||||
}
|
||||
if (package->metadata().serviceTypes().contains("Plasma/Containment")) {
|
||||
package->addFileDefinition("compactapplet", "applet/CompactApplet.qml", i18n("Custom expander for compact applets"));
|
||||
} else {
|
||||
package->removeDefinition("compactapplet");
|
||||
}
|
||||
}
|
||||
|
||||
void DataEnginePackage::initPackage(KPackage::Package *package)
|
||||
{
|
||||
ChangeableMainScriptPackage::initPackage(package);
|
||||
|
@ -51,6 +51,7 @@ class PlasmoidPackage : public GenericPackage
|
||||
Q_OBJECT
|
||||
public:
|
||||
void initPackage(KPackage::Package *package) Q_DECL_OVERRIDE;
|
||||
void pathChanged(KPackage::Package *package) Q_DECL_OVERRIDE;
|
||||
};
|
||||
|
||||
class DataEnginePackage : public ChangeableMainScriptPackage
|
||||
|
@ -403,6 +403,9 @@ AppletQuickItem::AppletQuickItem(Plasma::Applet *applet, QQuickItem *parent)
|
||||
if (d->applet && d->applet->containment() && d->applet->containment()->corona()) {
|
||||
d->coronaPackage = d->applet->containment()->corona()->package();
|
||||
}
|
||||
if (d->applet && d->applet->containment()) {
|
||||
d->containmentPackage = d->applet->containment()->package();
|
||||
}
|
||||
|
||||
d->compactRepresentationCheckTimer.setSingleShot(true);
|
||||
d->compactRepresentationCheckTimer.setInterval(250);
|
||||
@ -567,7 +570,13 @@ void AppletQuickItem::init()
|
||||
//default compactRepresentationExpander is the popup in which fullRepresentation goes
|
||||
if (!d->compactRepresentationExpander) {
|
||||
d->compactRepresentationExpander = new QQmlComponent(engine, this);
|
||||
d->compactRepresentationExpander->loadUrl(QUrl::fromLocalFile(d->coronaPackage.filePath("compactapplet")));
|
||||
QString compactExpanderPath = d->containmentPackage.filePath("compactapplet");
|
||||
|
||||
if (compactExpanderPath.isEmpty()) {
|
||||
compactExpanderPath = d->coronaPackage.filePath("compactapplet");
|
||||
}
|
||||
|
||||
d->compactRepresentationExpander->loadUrl(QUrl::fromLocalFile(compactExpanderPath));
|
||||
}
|
||||
|
||||
//HACK: check the Layout properties we wrote
|
||||
|
@ -100,6 +100,7 @@ public:
|
||||
|
||||
Plasma::Package appletPackage;
|
||||
Plasma::Package coronaPackage;
|
||||
Plasma::Package containmentPackage;
|
||||
|
||||
bool expanded : 1;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user