I use the virtual desktop feature of KDE fairly heavily. I have 8 working desktops, and most of them have something running at some point or another during the day. One of the annoyances with this approach is that if I want to drop a quick IM to someone on my roster, I have to click on the Kopete icon, choose the person from the list, click their name, wait for the window (granted, a fraction of a second), and then start typing. Annoying, at least to me.
So, I starting investigating a way to get a small window/applet/something on my desktop that would list the current people in my roster as a drop down, and have a small text field and a ‘Send!’ button. KJSEmbed looks like the way to do it, so off I go, looking for documentation.
That was problem number 1 - Google was a veritable wealth of SVN/CVS commits and bugs, but barely any documentation. I did manage to find a page on SourceXtreme that gave me some basic info though, and a link to the reference site.
Problem number 2 - the reference site has horrible API documentation (which has been a thread on Planet KDE recently). The examples are fairly ok, but it still hurt my head. I should mention that I do write code fairly often, but blah, that documentation hurt.
So I finally got things into a half-decent shape. I hopped right into QT designer, and whipped up a sweet little dialog. Yep, that’s problem 3 - I needed a widget, not a dialog. No, I don’t do GUI programming very often, and I may do it even less now :p So I recoded the UI as a widget. Whoa, it displays!
Next stage, work out how to reference all of the (2) text fields in the widget so I can make a DCOP call. A bit of reading of the SourceXtreme presentation and things became a bit clearer. So now I have a small KJS app that can display a window, fear me!
Next I messed up the KMainWindow::UI::connect() call, and had the 4th parameter pointing to a non-existent sub-routine. The error you get for this isn’t very useful though
Uncaught TypeError exception at: -2147483648
Yes, very clear.
So now I have a small app where you can press a button, and nothing happens. Well, the dcop.call to kopete->kopeteiface->messagecontact() returns false, so I can only guess it doesn’t like the parameters I’m passing to it. I’ve toString()’d the two fields that matter, but that obviously isn’t the answer.
If you’re a bored KDE programming guru, and want to poke me in the eye, these files should entertain you :)