AppletScript & configAccepted

Richard Dale richard.j.dale at gmail.com
Thu Sep 11 14:19:34 CEST 2008


2008/9/11 Petri Damstén <petri.damsten at gmail.com>

> Hi,
>
> I have been playing with webkit AppletScript. There is a small example
> (webkit/code/test.html) using plasma dataengines so I have added more
> functions (init(), engine.connectSource(), etc.) and plasma package support
> so
> it looks more like a normal plasma applet.
>
> Applets connect to apply & ok to know when user accepted config, but if
> AppletScript uses configxml there seems to be no way to do that? Maybe
> configAccepted signal in applet? I guess this could be good for Applets too
> so
> they don't have to rely parent to have ok/apply.

The biggest problem with using configxml with script engine based applets is
in this code where it tests 'if (d->script) {' and then leaves early. I've
no idea what script engine applets would want to do that is different from a
normal applet as the whole point of configxml is that it is a sort of 'fire
and forget' api that doesn't actually need any programmer intervention to
use.

    if (d->package && d->configXml) {
        QString uiFile = d->package->filePath("mainconfigui");
        if (uiFile.isEmpty()) {
            return;
        }

        KConfigDialog *dialog = new KConfigDialog(0, dialogId,
d->configXml);
        dialog->setWindowTitle(windowTitle);
        dialog->setAttribute(Qt::WA_DeleteOnClose, true);

        QUiLoader loader;
        QFile f(uiFile);
        if (!f.open(QIODevice::ReadOnly)) {
            delete dialog;

            if (d->script) {
                d->script->showConfigurationInterface();
            }
            return;
        }

        QWidget *w = loader.load(&f);
        f.close();

        dialog->addPage(w, i18n("Settings"), icon(), i18n("%1 Settings",
name()));
        dialog->show();
    } else if (d->script) {

-- Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/plasma-devel/attachments/20080911/4c5380d1/attachment.htm 


More information about the Plasma-devel mailing list