philipp’s weblog header image

What’s for lunch?

October 19th, 2008 · 4 Comments · other stuff

If you’re working in a company or go to university or college, that’s probably close to the most important question of the day. Wouldn’t it be great to have that information right on your desktop? While I was playing around with KDE4, I thought it would be great to have a Plasmoid (like a Dashboard Widget for all the Mac users out there) displaying today’s menu.

That was actually half a year ago, but back then I didn’t find time to look more closely at it. First I thought I’d be able to write the Plasmoid using ECMA-Script (JavaScript). But it seems that the bindings are still under heavy development (like everything in the Plasma:: namespace) and not really usable yet. So I found a tutorial on how to write a Plasmoid using C++. Doing further reading, I also found out that I’d need to write a DataEngine to get the data, too.

It took me a while to fight my way throught the documentation *cough* ([1], [2], [3]) and understand the basic concepts, I think I got it mostly working now :-)

Before I continue with more talking, have a look:

The data comes from a webservice I operate, which currently gives the menus of all cafeterias of the Studentenwerk München. Drop me a note if you like it and would like to get your cafeteria’s menu in there, too.

So finally, here are the sources:
The data engine: cafeteria_engine-0.1.tar.bz2
The plasmoid: cafeteria_plasmoid-0.1.tar.bz2

I did development on openSUSE 11.0 using the Factory KDE repository (which currently contains KDE 4.1.2).

This is getting long, so I’ll postpone my rant about missing documentation to the next blog post ;-) I’d love to get some freeback on this, so feel free to drop me a note.

Update: I just noticed that sometimes after adding the plasmoid to the desktop for the first time and clicking on “Configure”, you’ll get a segfault with a backtrace like in bug #168278. To work around that, add the plasmoid to the desktop, log off and on again and configure it then (and possibly do the same again?). That way it should work. I guess this is a bug in Qt, but that’s not yet for sure (the QGraphics* stuff is pretty new and known to be buggy).

Update 2: There is a fix in qt-copy now, which will be part of Qt 4.4.4 and 4.5 (see here).

Tags:

4 responses so far ↓

  • 1 Max Kahnt // Dec 16, 2008 at 19:20

    First of all:
    Thank you, this is nice work!

    Installed it under Kubuntu 8.10, had to apt-get install kdebase-workspace-dev and everything went smoothly.

    Since I do my studies in Berlin it would be nice to have Berlins lunch tables, too! (especially FU Mensa II) I’d be the king of the campus if I had the mensa plan as a plasmoid :-)

    Next I am looking for is a kalender-plasmoid. It should either support the googlemail- oder kde-kalender (or both). But I guess someone’s already working on this. ‘just have to find him (or maybe I should hope to not find him, to increase my motivation on fighting myself through the plasmoids documentations).

  • 2 Philipp // Jan 14, 2009 at 19:42

    Well, it took me some time to respond here, as I initially wanted to spend some time on this plasmoid during Christmas time and have some results ready …
    Bad news is that nothing is ready yet and I probably will not find much time on this before March.

    The first step in order to support a new cafeteria would be to get the data out of their homepage. For the TU Mensa I had to write a parser for their HTML pages as they do not offer a sane way of getting the data. Maybe the FU Berlin is a bit better in this respect?

    Again, more on this in March after I’m done with my exams for this semester.

  • 3 MTemp // Oct 6, 2009 at 12:20

    Hi,

    do you still maintain your great plasmoid?

    If so, could you update your software so that it works (compiles) with KDE 4.31 and libplasma3 (KUbuntu 9.10 beta)
    After deleting line 6 in CMakeLists.txt “find_package(Plasma REQUIRED)” (which isn’t necessary any more) the engine compiles but the plasmoid fails with:
    http://nopaste.info/ae506e8de2.html

    So could you fix that or how should I survive without the menu on my desktop?

  • 4 Philipp // Oct 6, 2009 at 14:14

    I’ll have a look at it before the semester starts again (which is in two weeks :))

Leave a Comment