Category Archives: Developers

Passive Notifications in Kate Part

In KDE 4.10, Kate Part got a new MessageInterface. The idea of this interface is to have a standardized way of showing notifications in a non-intrusive way, similar to how KMessageWidget in kdelibs works. Using the MessageInterface is extremly easy, for instance to show a quick notification, you write

KTextEditor::Message *message = new KTextEditor::Message(KTextEditor::Message::Positive,
                                                         "Code successfully reformated.");
document->postMessage(message);

That’s basically it! The result looks like this (with a nice fade-in and fade-out animation):

As developer, once you called postMessage(), you can safely forget the message pointer. It’s automatically deleted either if the user closes the notification, or if the document is closed or reloaded. The API for more tricks. You can add multiple actions through KTextEditor::Message::addAction(), which then appear as buttons. For each added action, you can control whether triggering the action should close the widget or not.

Further, you can set an auto hide timer through Message::setAutoHide(int timeInMilliSeconds).

If you want a message to only appear in one specific KTextEditor::View of the Document, you just call Message::setView() before calling postMessage(). If several messages are in the queue, the one with the highest Message::priority() is shown first.

This notification system is already used in Kate Part by the data recovery (swap files), or to show a notification when loading remote files, and in some other places.

The cool thin is that this solution requires no special code in KateView or other classes, hence, it’s a perfectly clean solution with an easy-to-use API. You as KTextEditor user (developer) should definitely consider using it when it’s public.

Note: The MessageInterface is a KTextEditor interface; however, since the 4.10 branch is frozen for BIC changes, we cannot just add this interface for KDE 4.10. Instead, for Kate Part users (Kile, KDevelop, …) this interface will only be available in KDE5.

Finally, an example of all four message types: Positive, Information, Warning and Error:

Kate needs BiDi/Unicode aware developers ;)

During our long bug hunting and fixing sprint I came along some nasty BiDi or Unicode related bugs.

I and most others in the Kate team are not really able to fix such issues :( We lack both the knowledge of the underlying techniques and are not able to write/read any language that really uses complex unicode chars or BiDi text.

Therefore: If you know Qt and you want to help out with fixing BiDi/Unicode related bugs, please provide patches for them in the KDE Bugzilla!

Here are the relevant bugs:

Any help here is highly appreciated! If you have questions about the internals of KatePart needed to fix such an issue, just ask in the bug or kwrite-devel@kde.org.

Contribute to Kate

Currently we are at the Kate/KDevelop sprint in Vienna. Christoph and me took the time to look a bit around in the net for Kate, and more or less accidently stumbled over quite a lot of extensions by our users. Here are some examples:

Kate has just about 20 plugins written in C++. And, ironically, there are more plugins for Kate written in python. This is totally awesome, but still, the Kate developers didn’t even know about it ?¿? :-o

So we started contacting these potential contributors, and also asked why they e.g. upload it in some other git repository. One time, we got the answer, that they uploaded it somewhere to share it with other users. But really, the perfect way to share additions for Kate is to put it into the Kate git repository directly. This is how open source works…

So if you make additions or changes to Kate, please let us know, create a patch and send it to review board, come to our developer sprints, come to the annual KDE conferences… Talk to us, usually we are all pretty friendly and really happy about every single contribution!