First Plasma BoF in the Sea.

Note to self: Just blog, don’t ask Blauzahl if the picture is good enough, you can always fix it up latah!
Thursday night, I arrived in Kingston, Jamaica after a long, trip. Roger had hooked me up with Michael (who had, the night before also Jos had the pleasure to be Michael’s guest). Michael has been a very nice and caring host. He put me to bed after a marathon of something close to 40 hours without a bed (but the occasional 1-hour-naps on the plane). The plane had taken me from Amsterdam to London to Miami (insert bitching about U.S. customs here).
I arrived in Kingston roughly two hours late because there had been some fuel leaking into the engine. Apparently the crew didn’t feel comfortable to fly my last hop without having it checked by two groups of engineers. After an hour or so, we the problem was fixed and we flew over to Jamaica. Michael picked me up from the airport, got me some good food and put me to bed, which was needed after a long trip. Thanks dude for caring for me so well!
Finally, I had made my way to Jamaica.

The next day I slept in a bit and ate a large amount of really good fruit, including melon, sugar cane, grapes, … Then, Grandville, a friendly taxi driver picked me up to go by the University of the West Indies, to pick up Richard and Monika, two students attending CampKDE and some recording gear.

The next 4 – 5 hours, we drove from Kingston to Negril, a good 200km. The trip was mostly fun, we talked about music and Jamaica, I saw a lot of the inner-Jamaican scenery, we had some patties (Jamaican pasty stuffed with beef) and spicy shrimps on the way. When we arrived in Negril, it was already way beyond dusk, and most of the KDE folks that had arrived already were having foods and drinks near the beach. I met Dmitry here, who happens to be one the same racing team as Grandville, our taxi driver (not kidding!).

After the usual (but pleasurable) hugfest that’s inevitable when seeing all the people again, we went for a Plasma BoF in the sea (which was still nice and warm). Points of discussion were mostly the ZUI, its usecases, how it’s related to virtual desktops, and what we think we’d need to do to make it really usable. We also talked a bit about documentation issues, developer documentation for libplasma, documentation for scripting Plasmoids, and user-oriented documentation. Blauzahl told us that one problem of triaging Plasma bugs is that people often don’t really know what’s what and that the BugSquad in turn has a hard time to get useful bugreports. Something that can easily be solved with an annotated screenshots (this is the one that needs a better version).

Crystal desktop search applet.

Crystal desktop search applet.
Over new year, I’ve been playing around with Strigi and Nepomuk, which are
the two technologies around desktop search and “making sense of your data”. Strigi is the underlying library that is used to analyze all sorts of files and index those results. Nepomuk provides a semantic layer on top of this information, and a nice KDE API for easy integration in applications. While Nepomuk is only lately maturing, it shows some nice ways to interact with information on your desktop. Nepomuk uses RDF and ontologies to make sense of your data. It has the concept of types of data (think of a photo being an an image), and how those types relate to each other. It also stores metadata (for the photo example, that’d be size, camera model, and so on.

Nepomuk started catching my attention when I had been looking at a bug in krunner, that cropped up when the desktop search on my machine magically started working. It displayed too many results and kept the KRunner interface very busy, and sometime even made it crash. I’ve tried some tricks limiting it in a sensible way, but wasn’t really familiar with the workings of Nepomuk. Sebastian Trueg has fixed this bug last week, fortunately.

There are some caveats, when setting up Nepomuk. In order to get reasonably fast search and indexing, make sure your Nepomuk is using the Java JNI based Soprano backend (JNI is an interface to some Java functionality for C++). I am compiling KDE from trunk usually. Soprano sits in kdesupport and has two possible backends you can use, Redland and Sesame2. The former is C++ based, but it’s very slow. So in order to get reasonable performance out of Nepomuk, make sure the Sesame2 backend gets installed. For compiling it, I had to install the necessary Java packages — I’ve installed both the JDK and JRE. CMake apparently didn’t find this enough, when configuring Soprano, it still reported that it cound’t find the JNI, so wouldn’t compile the Sesame2 backend. I had to tell it explicitely where to find Java by putting the following into my .zshrc file:


on my Kubuntu machine, and


on my OpenSuse machine.

After having it installed, you can configure the search in System Settings. The first run took pretty long, but after that, indexing doesn’t get in the way anymore and also doesn’t hurt performance noticably (i.e. having nepomuksearch monitoring). Also, the results I got from Nepomuk and Strigi where quite OK, even when limiting the search to only 5 seconds (which makes the first results display a lot quicker as well). In general, not having Nepomuk do endless searches is a good idea. :-)

Over christmas, I had been thinking how to integrate desktop search into Plasma, and started writing a small applet as interface to the desktop search. I’m not really fond of KRunner’s current interface. It displays too little information about the results, and looks a bit messy to me. We’ve already been thinking about possible improvements on the plasma mailing list, but with all the bug fixing around, we didn’t get to tackle KRunner’s UI in a way that makes it suitable to display results from a desktop search.
So I started writing an applet for Plasma, since nobody seems to have done this yet and called it Crystal, since that’s a cool name. Nepomuk actually made it very easy, with 300 lines of code (C++ even), I had a basic Plasma applet, including configuration to tweak the search, and the whole thing displaying results and opening those files.
I’ve committed the applet yesterday to plasma’s playground so others can have a look at this, too. It’s already quite nifty, but only very basic and totally not polished. Many aspects of the applet might change in the future, but it should be a good starting point to experiment with desktop search on the KDE4 desktop.

The applet can popup on shortcut
(I got this for free with the plasma configuration dialog actually) and pre-fill the clipboard into the lineedit. This way, you just select and copy a word into your clipboard, then hit some shortcut and press enter and dang! it searches for it. When the applet pops up, the text in the query lineedit is selected so you can also just start typing and thus override the pre-filled query (your clipboard or the default from the config dialogue). There’s no keyboard navigation in the list of results yet, and it doesn’t sort the results by relevance. I actually have a small patch that makes the SearchHitView sort by relevance, but it sometimes causes rendering problems, painting resulting items on top of each other. That patch essentially returns a rounded score for the items and makes KCategorizedView to order descending. I’ll have to investigate if that’s the right way to do it. Rafael (ereslibre) has some promising work on KCategorizedView in the pipeline as well. We’ll see where this all goes…

Codewise, actually searching and displaying results with Nepomuk is dead easy. Most of the important functionality is included in KDE 4.2’s kdelibs. There’s the QueryServiceClient which is what you use to fire queries into Nepomuk and retrieve the results (Nepomuk::Search::Result). The client is connected to a SearchHitView, which internally retrieves the hits from Nepomuk and puts them into the model, then updates the view.
The SearchHitView is from playground’s nepomuk-kde. It gives us models and view for search items, and has plugins for different types of files and result types. Here’s how this looks like in an example:

// Create a new client for the search
m_searchclient = new nepomuk::search::queryserviceclient( this );

// Search when the button is clicked
connect( m_buttonsearch, signal( clicked() ),
            this, slot( slotsearch() ) );

// ... also search on Enter in the search field
connect( m_editsearchtext, signal( returnpressed() ),
            this, slot( slotsearch() ) );

// Put new results in the SearchHitView
connect( m_searchclient, signal( newentries( const qlist& ) ),
            m_resultsview, slot( updateresources( const qlist& ) ) );

// Do something when the user clicks on a result
connect( m_resultsview, signal( resourceactivated( const qurl& ) ),
            this, slot( slotresourceactivated( const qurl& ) ) );

You’ll need two functions then, slotresourceactivated(QUrl url), which might be as simple as just KRun(url) in order to open the file (or url), and slotsearch(), which runs the query on the the string from the search lineedit. The plugin system doesn’t quite work for me at the moment, there’s an issue that a factory class always returns the most generic of the visualization plugins, making the results in the view look a bit boring. (The mechanism works fine in knepsearchclient, I dunno what exactly is going on there, deeply in KService …) I hope to get this to work quickly, also to get some more polishing applied to the plugins, and have them — based on their type — display more interesting information so you can quickly see if that file is the one you’re looking for. Also, displaying them at different sizes can reveal or hide some information, which is definitely useful and makes the user interface a lot more flexible. The code isn’t yet stable, and it needs some work.

Earlier on Sunday, richmoore blogged about a small class he has written to interact with MediaWikis. I’ve quickly took his code and put it into Crystal. Within an hour or so, I had Crystal display matches from TechBase along with the Nepomuk matches (albeit not correctly yet since the SearchHitView expects a bit more than a QUrl pointing to a random location (oh noes, our techbase is not random!). After a bit more hacking, Crystal now searches in Wikipedia, TechBase and UserBase for your search term. Display of the results is a bit better, but still not quite there yet. Something to sort out. :)

Some more ideas I have for the Crystal applet are saving of searches, for example to the desktop, a dropdown, or something so you can easily access pre-defined queries. Rich’s MediaWiki code also got me thinking a bit about the difference between searches on the web and on your desktop (other than “I don’t want everything I type submitted to Google“, of course ;-)).
It would be really good if applications started using Nepomuk more, although we see some interesting stuff coming up there as well, Gwenview has nepomuk based tagging and rating in KDE 4.2, for example. What I’d find useful is if applications started tagging files through Nepomuk automatically. It would be really useful to keep track of visited webpages, and have some information about that in the results of the desktop search. And of course Email. Tags for attachments from certain persons would be useful. Also there’s a small problem in the config dialogue for Strigi right now — you can’t enter directories starting with a “.”, and my email is somewhere under ~/.kde4/share/apps/kmail. That should be relatively easy to fix though. Mid-term Akonadi should be accessible in the same way.

And finally, I think we should put a searchbox into our file dialogue. During the redesign that has taken place for KDE 4.2, we left some free space in its top center, arguing that it make be the place to put a desktop search box. Sure enough the desktop search is fast enough (and I’m lazy enough) for me to replace most of the navigation-through-my-filesystem by simply typing the filename and choosing the correct file. The results from Strigi and Nepomuk are usually fast enough and correct. The file dialogue feels as a very natural for file search.

Merging branches upstream with Git.

This is one of those “I write it on my blog so I can easily find it

posts, that’s hopefully useful to someone out there.
For KDE development, I’m using git and git-svn to manage the codebase. Earlier today, I’ve merged a branch I had created over new year’s holiday. It consisted of 25 patches, some larger (implementing a new feature), some smaller, cleanups, but also some patches I wanted to keep separate for easier reference and review. I didn’t want to commit it to KDE’s SVN as one huge commit, but also not as 25, with a lot of those smaller ones that were more the “savegame” type of commit you do once in a while to easily get back to a “working state” when you’re about to break things or experiment.
Git’s rebase tool is what I wanted then. I’ve started off with my branch, counted it was 25 commits I want to restructure.

git rebase --interactive HEAD~25

Gives you a list you can pick commits from. Every commit is shown on one line, starting with the keyword “pick”. For commits you want to keep as-is, leave that line alone. Make it “squash” to combine this commit with the one on the previous line. Write “edit” to tweak the commit message. Just remove the commits you don’t want. Git will instruct you to do what’s needed, changing a log message, possibly solving a conflict. You pick up the rebasing process with

git rebase --continue

then. If you’re done, you can merge your branch, for example using “git svn dcommit” (do check with “git log”, “git show” and “git svn dcommit -n” first if everything worked OK).

Networkmanager in KDE4.

The KDE4 networkmanager plasmoid
Networkmanager is a daemon that keeps track of lower level bits on computers that have changing network hardware. It’s designed to do this dynamically, and exchange information about status with a user interface that acts as configuration UI and policy agent. Networkmanager has gone through a large redesign between the 0.6 and 0.7 version, including the necessary API and DBus interface changes. Not without advantages though. I personally didn’t really like networkmanager’s behaviour in the past, found it too random, too much getting in the way. Networkmanager 0.7 is better in that regard, it doesn’t drop my connection all the time for a start, it stays online while you log out and operates mostly within the bounds of what I deem sane.

One of the projects I’ve been working on over the last couple of months is the networkmanager plasmoid for KDE4. Will has put the infrastructural bits and pieces that are needed to work with networkmanager 0.7 into place. There is the networkmanager backend for Solid, KDE’s library for interaction with hardware, but also all the different configuration interfaces for all kinds of network access.
During development of the networkmanager plasmoid, I’ve often used the GNOME nm-applet. It does the job quite well and is a reliable interface to networkmanager. Something I find a bit confusing is that it offers two context menues, one on right click and one on left click. I often find myself looking in both until I’ve found the option I’ve been looking for. This also has to do with a limitation of the whole systray interface, which seems really outdated when looking at how we usually do these things in Plasma. As a matter of fact, nm-applet uses the GNOME keyring, which reminds me that it would be nice at some point to share this functionality (i.e. have it uses kwallet on KDE and keyring on GNOME). Right now when using nm-applet, I’ve two password stores that I need to unlock after login. I’ve also tried some other ‘wifi connection’ UIs. One, I’ve seen in Windows was particularly bad. It would ask the user to type in a WEP key (the long versions, often), didn’t offer any help doing this, but made it made it harder. You had to fill in the long HEX key twice, and both fields for that were password fields, so you can’t even see what you’re typing. It was just plain horrible. Quite a bit better is the interface of the iPod Touch (and presumably the iPhone). It does a good job on the input side (especially given that the user doesn’t use a keyboard but the touchscreen). It does fall flat on its face technically though. First, support for WPA2 is lacking, that rules out access to the network at the university, and supposedly many others. Then, it often reports that it has established a connection when it merely logged on to the access point, but didn’t get an IP yet. Since you can often connect to accesspoints (even encrypted ones) but don’t actually get an IP address, that information is often bogus and it can be quite annoying being told you’re connected, while you’re not. One of my favourite wifi settings UI is the one shipped with Maemo. While it’s nothing fancy, it gets the job done reliable and it doesn’t confuse me.

So one of my personal goals is to not make all those mistakes in the interface for networkmanager in KDE4. We’re not there yet, but progressing OK. Settings for wired and wireless start to work, as in “at least three persons on this Planet have ever been able to connect to a wireless network using it”. It has UI glitches, it’s not nicely streamlined for workflows we have in mind, the configuration interfaces are no beauty yet, and it has bugs, lots of it. It is in no way near release quality yet, more like an early Alpha. We’re trying to have a first working version out within the next couple of months, hopefully in time for the distros that ship in spring. So the applet won’t ship with KDE 4.2 we’re planning to release it individually so you (or your distro) can grab it in the meantime. We’re looking at putting it into KDE 4.3 then.
If you’re interested in hacking on it or just trying it, the current code can be checked out from playground. For this to work, you need to have the libsolid code from kdebase/workspace/solid installed. There are actually two networkmanager plugins, one is for networkmanager 0.6, one for 0.7. The latter one is the one we’re relying on. Yesterday, coolo started committing patches to the networkmanager plasmoid, scratching an itch. That’s pretty cool given that he’s one of KDE’s oldtimers. A true honour to share code with :-)