Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

New Stuff again

Hi there,
now that the KDE Software Compilation 4.4 is branched, it’s time to think about the next iteration. Next to bug fixing that is.

I’ll keep fixing things I broke with the hot new stuff framework re-write that makes it’s first public appearance in 4.4.
Since this was the first release including KNewStuff3, not that many apps have been ported yet – I just didn’t want breakage all over the place, but only in a few chosen locations to be able to fix bugs 😉
If you’re curious about the new stuff (no pun intended whatsoever), check these: Plasma Image Wallpaper, Comic Plasma Applet, Kate’s Snippets NG (deep inside Kate’s config, you need to enable the new snippets plugin) and Parley. Parley features an upload dialog in addition to the download version. Here’s fun to play with and dreams coming true 😀 (we spoke about this on the first KDE meeting I was at – back in 2007 in Paris).

Jos poked me on the promo list, that maybe more information should be out there. I cannot agree more… so I’ll try to make up for that. Here is a quick update mostly for application developers wanting to use KNS3 or port apps already using the older version.

ghns_list

So why did we decide to redo something that was working? In such an intrusive manner even, that it now resides in it’s own namespace (KNS3 as opposed to just KNS)?

Well, I read over the old code and talked to Jeremy a lot (thanks dude!). In the end Jeremy created a branch to restart the hot new stuff framework with some binary incompatible changes that made a lot of sense. I started hacking away on the branch and since it was incompatible anyway, I could freely play with it. Later Dmitry also joined to help with lots of polishing and fixes 🙂
First up was the creation of a new “provider” type – that is a data source that hot new stuff uses – a server representation. Getting that to work was easier than expected since I could just hack away and change stuff as I saw fit.
Also there are surprisingly many crashes in the old framework. I didn’t know about that, but now I get cc’ed on the bug reports automagically… (ouch). Many thanks go to Dario who manages this incredible mass of bugs (how do you do that??).
One problem I think is that the engine class (that users of the old API had to use) set up an event loop that would take care of managing the dialog itself. Confusing? For sure. I’m not sure if it managed to set up yet another event loop in the dialog itself, but I suspect this is the cause for some of the little buggers. Anyway, the new version is just a subclass of KDialog, easy to use, little public API. And it reuses K/QDialog’s proven and tested event loop – less code, more robust. On the way it gained a few features – such as a details dialog, here you can vote for a stuff-item-thingy or become a fan of it. Which will be reflected in the openDesktop plasma applet where your friends can see that you now like the stuff-item-thingy you just became a fan of 😉

ghns_details

I wrote a little tutorial on techbase to get you started.
Porting apps that already use KNewStuff2 is dead easy:
Change the include to <KNS3/DownloadDialog>, use the download dialog like any dialog (show/exec) and check for installed or changed items when it is done.

This is described in more detail in the KNewStuff3 tutorial on techbase.

In addition you need to update your .knsrc file:
[KNewStuff3]
ProvidersUrl=http://download.kde.org/ocs/providers.xml
Categories=KDE Wallpaper 1920x1200,KDE Wallpaper 1600x1200
TargetDir=wallpapers

That’s it! (don’t forget to link to knewstuff3… and happiness ensues…)

If you need help on porting an application, let me know. You can ping me on #kde-devel on freenode.

There are some fun interesting todos (yeah, right) for KNewStuff3. Let me know if you want to dapple with the insides of KNewStuff3 🙂
The upload dialog is still very basic. It needs love. Lots of it. Another feature that will be easy to implement but probably takes some thought and re-factoring to reuse things from the download dialog in the best way possible, is a class to automatically check for updates. The idea is that apps can let it contact the server on and notify the user that a new version of there favorite stuff is available.

On a totally unrelated note: I’m going to visit a KDE SC 4.4 release party! So should you! And if there’s none close by, how about just organizing one? It’s not much work but fun 😉