Initial Dashboard Widgets support

Aaron J. Seigo aseigo at kde.org
Fri Feb 22 23:52:49 CET 2008


On Friday 22 February 2008, Andre Magalhaes wrote:
> So I decided to try and create an applet that was able to load
> Dashboard Widgets.

cool; unfortunately zack's also working on this right now (as in, he's in my 
living room working on it). it would've been cool to coordinate a bit on 
this. anywasy...

> Attached there is the very initial version of it, that should be applied
> from playground/base/plasma/applets directory.
>
> Problems I would like to discuss with you:
>
> - Some (read most) dashboard widgets "include" local files:
>   Eg.: file:///System/Library/WidgetResources/button/genericButton.js
>   How should we deal with this. Should we create our own javascript
> code and ship with it,

we will have to, yes.

> - WebView always draws a white background, no matter what.

zack has fixed this already in webkit.

> - Should we do like the SuperKaramba support (Show the applets in the
> applet browser)?

yes, of course.

>   Ps.: Who knows the code knows it's a hack, but if we want the
> applets to appear on the applet
>          browser we need to do it. This would require changes on the
> appletbrowser code.

the answer can be found by asking the question: "how does the user install a 
dashboard widget?" i think the process of installing a dashboard widget, just 
as with installing a native plasma Package, should result in creating the 
necessary .desktop file that we can put in the services directory.

that .desktop file will then contain a X-Plasma-Language=macdashboard entry 
(or whatever key is associated with the webkit support) and the webkit 
support should *not* be provided via an Applet subclass but via a 
AppletScript ScriptEngine. that way we can easily provide the JS API and 
plasma itself doesn't need to be modified in any way.

so all we need is a UI for package installation for plasma that can handle 
native Plasma::Package's, MacOS Dashboard widgets and whatever else comes 
along. 

i'd suggest a button in the Add Widgets dialog that allows one to add a widget 
from file, which would then install it. the actual installation could be done 
by a class that takes a file on disk, determines the type of the file (e.g. 
Plasma::Package vs MacOS Dashboard; at worst through user interaction, at 
best autodetect) and does the correct installation routine.

that part we don't have anyone actually working on. if you're interested in 
that part we can discuss it more in depth if needed and get that support into 
plasma .. this will come in handy not just for mac dashboard widgets, but 
also for superkaramba widgets and any other widgets we add support for in the 
future.

>   Right now, you will find an applet in the applet browser that when
> running can load dashboard widgets
>   either by dropping files on it or trough the config dialog.

ScriptEngine was designed to prevent the need to take this approach, as it 
really degrades the user experience by making them care about native 
versus "just" supported widgets. one Add Widgets dialog to rule them all!

> - How can we propagate the webview events to the applet widget, so for
> eg. dragging would work.

there's support in Applet for this now (watchForMouseMove(QGraphicsItem * 
watched, bool watch)) .. i don't know how well it will work with webkit 
content, but i would hope it would work ok. if not, we can provide a webkit 
wrapper in libplasma that forwards the appropriate events "manually"

> Also I would like to commit this to playground/base/plasma/applets, so
> I could work from there.

there's no real control over playground. you are free to do as you wish there. 
just be aware that we already have this working here, though we need to 
finish out the parts that i've outline above which aren't addressed in your 
approach either =)

btw, there's a few copy 'n paste type errors in the code:

+        m_dialog->setCaption(i18n("Configure Clock"));


-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Trolltech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080222/35168288/attachment.pgp 


More information about the Panel-devel mailing list