On Sat, Feb 27, 2010 at 2:52 PM, Yuen Hoe Lim <yuenho...@gmail.com> wrote:
> While implementing support for PopupApplets in Plasmate (Bug 228498) , I
> discovered that Plasma/PopupApplet is not recognized as a package format by
> Plasma::PackageStructure:
> http://api.kde.org/4.x-api/kdelibs-apidocs/plasma/html/packagestructure_8cpp_source.html#l00114
>
> Is this a bug or is this intentional? If the latter, then is it acceptable
> to simply do
>
> if (is Plasma/PopupApplet)
My understanding is that scripting applets, popup applets and
containments are all treated the same way and are PlasmoidPackages.
>From scripting/scriptengine.cpp:

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
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to