[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: Plasma/PopupApplet and Plasma::PackageStructure
From:       Richard Dale <richard.j.dale () gmail ! com>
Date:       2010-02-27 15:13:23
Message-ID: 491684421002270713x5be9d698n432814cb13d22311 () mail ! gmail ! com
[Download RAW message or body]

On Sat, Feb 27, 2010 at 2:52 PM, Yuen Hoe Lim <yuenhoe86@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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic