Well it took about 2 days but I finally got around to getting up to speed with Plasma. I've always wanted a Twitter widget for my KDE desktop like Mac OS X has. Unfortunately I am not the world's best SVG artist. I haven't bothered to make the plasmoid yet. I've only just started the data engine. The thing currently only works with the global timeline.

My engine in the explorer

|Twitter DataEngine|

One of the difficulties of working with Plasma is being limited by how little wiggle room you have. I'd love to be able to stick my own objects and structs into a DataSource but only QVariant is allowed. There are hardly any fine examples of 'proper' usage of Plasma, so all of us are venturing into uncharted territory. Here is how my data is laid out in the engine:

"Friends"
    [
        "SomeoneElse"
    ]
"Timeline"
    [
        34824324
        38902380
        38904302
        38290874
    ]
"Timeline:Workman161"
    [
        38902380
    ]
"Update:38902380"
    "ID"
        38902380
    "Date"
        (QDateTime)
    "Status"
        "Hey, I'm building a plasma engine!"
"Meta"
    "Progress"
        0
    "QueuedJobs"
        0

In case you don't understand it, square brackets denote QLists. Everything else is either a QDateTime, QString, or (u)int. When the plasmoid loads the applet, it first needs to set the username and password to use the Twitter API. That is done through setProperty(). setProperty() will also be used to update your current twitter status.

Once the 'Timeline' source is requested, a QHttp object is created to fetch the xml feed in the background. For each 'status' element in the return, I create an Update source with the update ID as part of the name. After that I create the Timeline source using the list of IDs.

With this namespacing of sources, the engine behaves like some sort of RPC server. The plasmoid requests the source 'Update:1234' and the engine fetches that specific update. Requesting 'Timeline:Workman161' would request my own timeline. The two meta entries can be used by the plasmoid to show a progress bar or something. Perhaps an ajax loading icon?