stop relying on Package for Plasmoid publishing help

This commit is contained in:
Aaron Seigo 2011-07-13 20:04:13 +02:00
parent e4be1cecf5
commit d83433557e

View File

@ -1645,16 +1645,21 @@ bool Applet::hasConfigurationInterface() const
void Applet::publish(AnnouncementMethods methods, const QString &resourceName)
{
if (d->package) {
d->package->d->publish(methods);
} else if (d->appletDescription.isValid()) {
if (!d->service) {
d->service = new PlasmoidService(this);
}
if (!d->service) {
d->service = new PlasmoidService(this);
}
kDebug() << "publishing package under name " << resourceName;
d->service->d->publish(methods, resourceName, d->appletDescription);
const QString resName = resourceName.isEmpty() ? i18nc("%1 is the name of a plasmoid, %2 the name of the machine that plasmoid is published on",
"%1 on %2", name(), QHostInfo::localHostName())
: resourceName;
kDebug() << "publishing package under name " << resName;
if (d->package && d->package->isValid()) {
d->service->d->publish(methods, resName, d->package->structure()->metadata());
} else if (!d->package && d->appletDescription.isValid()) {
d->service->d->publish(methods, resName, d->appletDescription);
} else {
delete d->service;
d->service = 0;
kDebug() << "Can not publish invalid applets.";
}
}