No subject


Sat Feb 27 01:32:52 CET 2010


PackageStructure::Ptr defaultPackageStructure(ComponentType type)
{
    switch (type) {
    case AppletComponent:
    case DataEngineComponent:
    case WallpaperComponent:
    case RunnerComponent:
        return PackageStructure::Ptr(new PlasmoidPackage());
        break;
    default:
        // TODO: we don't have any special structures for other components yet
        break;
    }

    return PackageStructure::Ptr(new PackageStructure());
}

PackageStructure::Ptr packageStructure(const QString &language,
ComponentType type)
{
    KService::List offers = engineOffers(language, type);

    if (offers.isEmpty()) {
        return defaultPackageStructure(type);
    }

    KService::Ptr offer = offers.first();
    QString packageFormat =
offer->property("X-Plasma-PackageFormat").toString();

    if (packageFormat.isEmpty()) {
        return defaultPackageStructure(type);
    } else {
        PackageStructure::Ptr structure = PackageStructure::load(packageFormat);
        return structure;
    }
}

Note we recently added support for scripting Containments with a
service type of Plasma/Containment in the metadata.desktop

-- Richard


More information about the Plasma-devel mailing list