Wednesday, August 29, 2007

List of new KDE features

Hi, our list of KDE features heavily lacks updates :)
So everyone checkout
trunk/www/sites/developer/development-versions
and update kde-features.xml :) At some point we'll enable the techbase extension so the list shows up there as well.

Sunday, August 12, 2007

OT: T-Online Software

I had to install the "T-Online Software 5" recently on a Win98 box. Starting the T-Online setup a message popped up:
You need at least Internet Explorer 5.5. Setup terminated!
Sigh, I found a IE5.5 offline setup. Next try:
You need at least a resolution of 800x600. Setup terminated!
I found the graphics card chip, installed the drivers and switched the resolution. Next try:
The language version of the OS is not German. Setup terminated!
Now that is clearly how software should not work. It seems to be impossible to install the T-Online software. I would install Linux, but it's quite a change for a ~90 years old user :(

Saturday, July 21, 2007

Extending Kate by Scripts

We have seen how scripting basically works for indentation. It's also possible to register commandline functions (The command line is bound to F7 by default, or invoke View > Switch to Command Line). We will consider a small example again: sort the selected text.
/* kate-script
 * name: unused
 * author: foo bar
 * license: LGPL
 * version: 1
 * kate-version: 3.0
 * functions: sorter
 */

function sorter ()
{
    if (view.hasSelection()) {
        var start = view.startOfSelection().line;
        var end = view.endOfSelection().line;

        var text = document.textRange(start, 0, end, document.lineLength(end));

        var lines = text.split("\n");
        lines.sort();
        text = lines.join("\n");

        view.clearSelection();

        document.editBegin();
        document.removeText(start, 0, end, document.lineLength(end));
        document.insertText(start, 0, text);
        document.editEnd();
    }
}
The header line functions: sorter makes Kate Part aware of the function in the script. A list of functions is supported, separated by white spaces. You can use the function by typing 'sorter' in the commandline.
Some todo items:
  • provide better JavaScript API. For example: document.textRange() takes 4 parameters. It would be more elegant to take one range or two cursors, just like we do in the KTextEditor interfaces in kdelibs/interfaces/ktexteditor
  • make is possible to bind scripts to shortcuts. This could be done by e.g. binding commandline functions to shortcuts or implementing a vim-like command-mode in Kate's commandline. How to configure the shortcuts is unclear, though.
  • then, think about replacing the C++ implementations of 'uppercase', 'lowercase', 'capitalize' etc. with scripts
  • things I forgot...
If you are interested subscribe to kwrite-devel@kde.org and contribute :) We also need indentation scripts, of course!

Friday, July 20, 2007

Kate: More on Indentation Scripting

My last blog was about the theory of how indentation works by using javascripts. Now we will look at a concrete example: a LISP-style indenter. (LISP indentation is easy, that's why it's a good example).
The rules:
  • comments starting with ;;; always have indentation 0
  • comments starting with ;; should be aligned with the next line
  • comments starting with ; should only appear behind code, so they are simply ignored
  • every '(' indents and every ')' unindents
lisp.js looks like this:
/** kate-script
 * name: LISP
 * license: LGPL
 * author: foo bar
 * version: 1
 * kate-version: 3.0
 * type: indentation
 */
// indent should be called when ; is pressed
triggerCharacters = ";";
function indent(line, indentWidth, ch)
{
    // special rules: ;;; -> indent 0
    //                ;;  -> align with next line, if possible
    //                ;   -> usually on the same line as code -> ignore
    textLine = document.line(line);
    if (textLine.search(/^\s*;;;/) != -1) {
        return 0;
    } else if (textLine.search(/^\s*;;/) != -1) {
        // try to align with the next line
        nextLine = document.nextNonEmptyLine(line + 1);
        if (nextLine != -1) {
            return document.firstVirtualColumn(nextLine);
        }
    }

    cursor = document.anchor(line, 0, '(');
    if (cursor) {
        return document.toVirtualColumn(cursor.line, cursor.column) + indentWidth;
    } else {
        return 0;
    }
}

The result:
;;; fib : number -> number
(define (fib n)
  (if (< n 2)
    1
    (+ (fib (- n 1)) (fib (- n 2)))))
As this indenter is scripted, everybody can adapt the style to the own needs.

Wednesday, July 18, 2007

Kate Scripting: Indentation

Kate Part in KDE4 supports the ECMAScript (JavaScript) language by using kjs. In KDE3 we had several hard-coded indenters in C++, the idea is to let scripts do all the indentation in KDE4.
How does it work? It is similar to vim: You simply create a script in the directory $KDEDIR/share/apps/katepart/jscript. An indentation script has to follow several rules:
  1. it must have a valid script header (the first line must include the string kate-script and indentation scripts must have the type: indentation)
  2. it must define some variables and functions
Whenever the user types a character, the flow in Kate Part works like this
  1. check the indentation script's trigger characters, i.e. whether the script wants to indent code for the typed character
  2. if yes, call the indentation function
  3. the return value of the indentation function is an integer value representing the new indentation depth in spaces.
In the 3rd step there are 2 special cases for the return value:
  1. return value = -1: Kate keeps the indentation, that is it searches for the last non-empty line and uses its indentation for the current line
  2. return value < -1 tells Kate to do nothing
So how does a script look like exactly?
The name does not really matter, so let's call it foobar.js:
/* kate-script
* name: MyLanguage Indenter
* license: LGPL
* author: Foo Bar
* version: 1
* kate-version: 3.0
* type: indentation
*
* optional bla bla here
*/

// specifies the characters which should trigger indent() beside the default '\n'
triggerCharacters = "{}";

// called for the triggerCharacters {} and
function indent(line, indentWidth, typedChar)
{
// do calculations here
// if typedChar is an empty string, the user hit enter/return

// todo: Implement your indentation algorithms here.
return -1; // keep indentation
}
More details on the header:
  • name [required]: the name will appear in Kate's menus
  • license [optional]: not visible in gui, but should be specified in js-files. it is always better to have a defined license
  • author [optional]: name
  • version [optional]: recommended. an integer
  • kate-version [required]: the minimum required kate-version (e.g. for api changes)
  • type [required]: must be set to indentation
The only missing part is the API which Kate Part exports to access the document and the view. Right now, there is no API documentation, so you have to look at the code:
You will find, that the current document exports functions like
  • document.fileName()
  • document.isModified()
  • document.charAt(line, column)
  • etc...
The view exports functions like
  • view.cursorPosition()
  • view.hasSelection()
  • view.clearSelection()
  • ...
That's the boring part of this blog. The interesting one is unfortunately shorter: we are looking for contributors who want to write scripts or help in the C++ implementation :)

Saturday, July 14, 2007

Luggage continued

Quick notice: I have my bag back. It was wet inside -- probably for 2 weeks, no wonder it started to get moldy inside, and I'm not sure yet whether I can use some of the clothes. Well done BA & Heathrow.

Wednesday, July 11, 2007

Deeply impressed...

Hey, I wasn't aware there was another one who did not get his luggage at all in Glasgow. I traveled from Frankfurt(Germany) to London (Heathrow) and then on to Glasgow. When I arrived, my luggage was missing. British Airways told me it would still be in London but it should arrive the same day and they would bring it to the Euro Hostel - cool :) How naive! Of course it did not arrive... and it didn't arrive the whole week.
The online status always said "Still tracing, check back later". When I flew back I asked at the Glasgow airport again and was told they can not see more than what I see online. When I asked whether they could call London/Heathrow by phone they said in London/Heathrow 20.000 bags are missing so it would be pointless. If the system is so unreliable, why don't they simply close the airport. moo
When I arrived in London I asked again, and a BA-service guy told me he could see that my luggage was being sent to Glasgow by road. By road??? Hell, it takes them 1 hour by plane, so what? And I even told them that I would leave this day. So why to Glasgow at all now?
Well, finally I sat in the plane... which ironically had a delay because it had one bag too much. Hey, that could have been mine... :)
Back in Frankfurt I asked again, and at least this time they were capable of changing the destination address to where I live in Germany. Strange, I told them in Glasgow in the first place, but they seem to be pretty much incapable... :)
So here we go: Back in Germany... in the meanwhile I wondered whether I'd see my bag ever again. Today, almost 2 weeks later, the state incredibly changed to "Received at the airport, delivery in progress". Wow, I'm deeply impressed... really great job. Wait: at which airport? Glasgow? London? Frankfurt? Or somewhere else in the world? *sigh*
So in short: I still don't have my luggage back... :)

Sunday, June 17, 2007

Translation of TechBase

As contributors started to translate articles in TechBase to other languages I wrote a quick howto which explains the translation system. It is pretty easy since danimo simplified it with a nifty template :)

Thursday, May 31, 2007

Quickies: classmapper, tb

api.kde.org got an overhaul, the redirect of the old class mapper does not work yet, so just edit your web shortcuts and change the one for 'kde:' to point to
  • http://api.kde.org/classmapper.php?class=\{@}
  • appending &version=3.5 will search in KDE3.5
Thanks to Bram, we have a new article called How to create useful crash reports in our tb. It is mainly aimed at users who fill in bug reports in KDE's bug tracking system.

Tuesday, March 27, 2007

svn up qt-copy...

...and only 1 hour, 35 minutes later it was finished! Enough said.
Update (disambiguation): svn via https took the time, not the compiling itself :-)

Sunday, March 18, 2007

KDE@CeBIT: first two days

Carsten was already faster and blogged about day 3@CeBIT - so it's time to talk about the first two days :)
The first two days we had a rather small booth compared to other projects in the LinuxPark (Hall 5): Placed in the corner next to the Debian booth (see photo). However, we managed to attract many interested eyes, and that's after all what's important (see photo).
The CeBIT is very much a business event: many people are wearing suits which is not really surprising as the audience is of course different to for example the LinuxTag. As such they have another background: Sometimes they never even saw KDE. That's good as we could show step by step the power of KDE: the desktop itself (kicker, K-button, desktop), applications like KMail users usually need or Amarok with iPod support.
Sometimes the questions were more detailed, amongst others -- of course -- What will KDE4 look like? This one is very important and we tried to promote the difference between KDE4 and KDE4.0, the very first KDE4 release. In short, KDE4.0 is the first release in the whole KDE4 lifetime. As such will ship new technologies and cleaned up APIs. Many work went into the core of KDE which is not even visible to the user. When KDE4.0 is released applications will first have to use it. It does not make *plop* and we have a full blown KDE4 which can be compared to the thousands of applications available for KDE3.5. Even the KDE4 components itself (like plasma) probably will not contain all the features and be perfect right from the start.
This is even good to some degree: It is perfectly fine if plasma is basically the same as what we know from the KDE3.5 workspace - it's a well and long tested behaviour after all. I think we did a good job with regard to issues like this and the interested parties understood that. We demonstrated KDE4 versions of Kate, Dolphin, KRunner and KSysGuard including the new Oxygen icon theme and the general feedback was positive :)
Besides that, we gave lots of KDE-T-shirts, pins and bags for free (iff they made a small donation). I'm sure I forgot something, but it's a way too late now and I have to be at the decibel hackathon in some hours again *tired* :)

Monday, March 05, 2007

Quickies: D-Bus, TechBase

  • DBUS D-Bus
  • techbase.kde.org finally has a name
  • KDE contributors with an svn account are in the group KDEDevelopers, they additionally have the right to delete pages in techbase... if you are not in this group but have a svn account please let us know (#kde-www)
  • ...todo: they also should be able to protect pages so that they are only editable for users in the KDEDevelopers group
  • techbase uses subpages - please avoid adding toplevel pages :)

Sunday, January 07, 2007

Developer Wiki Structure

The last friday we had 20 people on IRC in #kde-www, that is a lot compared to the 2-5 people usually sticking around there. Some of those 20 are quite active in the techbase wiki so that we have a constant flow of commits. However, there is still a lot of work to do: Migrating tutorials, architecture pages, and more. As you probably know MediaWiki is usually a flat wiki, that is all pages are usually placed in the top. For instance, this is how Wikipedia works. On KDE's techbase wiki we wanted to have a structure even in the URL if possible. It turned out we were lucky because MediaWiki has a features called sub-pages. In short, a sub-page is something like a parent-child relation (like a sub-folder), and the benefits for us are
  • they automatically provide us with a hierarchy which is reflected in the URL itself
  • automatically generated backlinks provide easy navigation
For further information, read the page about our wiki structure.

Wednesday, December 27, 2006

API documentation & refactored kdelibs/kdeui

During the last weeks/days the directory structure of especially kdelibs/kdeui got a major overhaul: in KDE 3 all files of a module were in the same directory which was more or less a mess as you did not know immediately which files belonged to the same category. kdelibs/kdeui in KDE4 has a rather clean structure now (similar to the one in Qt) by using subfolders like
  • actions
  • dialogs
  • widgets
  • xmlgui
  • several others...
Compare this to KDE3's kdelibs/kdeui structure. For KDE4 this is a huge benefit, as we have clearly defined groups. We already had lots of discussions in the past about API documentation and this is exactly where the new structure is important: In Qt every class usually belongs to a group (example). Our API documentation tool doxygen of course supports grouping, and now it is even easy to know which class should be in which group. For instance, all classes in the widgets directory should be in the 'Widgets' group, and then maybe even more fine-grained divided into sub-groups.
By the way, we have a policy that every widget in kdelibs has a screenshot to immediately see how it looks like - another nice way to get involved :)
All in all this is really awesome and I'd like to thank all involved developers. Next prey is kdelibs/kdecore? =)

Friday is developer wiki day

Some time ago we started to migrate our developer.kde.org pages to a mediawiki based solution at techbase.kde.org. In order to give the wiki a big boost we always meet on fridays on irc.kde.org #kde-www. This friday we will continue to migrate content, besides that we want to find a roadmap and a target date at which we can turn off the old developer pages.
To make this friday an even greater success we need as many volunteers as possible joining us. It is also a nice opportunity to get in touch with the KDE community - we are happy about every new face and - believe us - we don't eat anyone :)

Monday, December 25, 2006

God Jul

I'm back in Germany after my stay in Sweden. All in all, it was an awesome time. I also traveled to the north to a town called Kiruna (indeed starting with a 'K' =) and you probably guess what I found there: snow, lots of snow. To give you an impression here are two images :)That are nice pictures for the current time of year, so God Jul to everyone and KDE :)

Friday, December 15, 2006

developer wiki

Now it's kind of official: The first blog about our new developer wiki by Aaron. I'm very happy the wiki gets more attention, and in fact this is a very good opportunity to get started with KDE. As Aaron already mentioned we want the wiki to become a first class citizen for KDE related developer resources. The main task right now is to port pages from the "old" developer pages to the new wiki. At the same time we can restructure the pages like moving KDE 2 and KDE 3 related content to own pages etc. As it is a wiki, everyone is welcome to help. If you want to get in touch with us join us in irc (irc.kde.org, #kde-www)!
Some time ago I wrote a small perl script with which you can convert the html code of the old developer pages to wiki syntax. It's not perfect, but speeds up the process of porting a page tremendously :)

Tuesday, November 28, 2006

KateMDI: sidebar and focus...

Since KDE 3.5.5 Kate has its own MDI implementation. It is similar to KMDI but ships with a lot less bugs (yes, and features). One thing bothering me is the focus issue: Which sidebar has the focus? If you do not know, you have to have sharp eyes to find out. In KDE4 I just hacked in such a feature (here is the patch). On the screenshot you can see that every sidebar now has an additional pane on the top. Unfocused sidebars have a gray pane (default window background color), a focused sidebar has a blue pane with white text (just like selected text). Which sidebar has focus? - Right, it's the Documents sidebar :) It work's pretty well, so is it worth committing (a cleaner version of) the patch? I initially hoped that QDockWidgets would provide this functionality by default. Similar discussions take place on kde-core-devel as well (about KTabBar & friends)...

Thursday, October 12, 2006

Share Kate Highlighting Files

Thanks to Frank we have a dedicated section for Kate Highlighting files on kde-files.org now. We encourage everyone to publish their .xml files there. The Kate team agreed to add more highlighting files to the official Kate releases, though, as long as they are of general use. For KDE4 we plan to have a section for Kate Indentation scripts, too. But that's content for another blog, which will follow later :)

Friday, September 29, 2006

Kate: More eye-candy

Two years ago we had the KDE conference in Ludwigsburg, Germany. At that time, Martijn Klingens committed a patch to show trailing spaces in Kate. I just change the visualization a bit, the change is in for KDE4 :) Tabs are marked with a '»' character, and spaces with a dot. On the left you can see the old and on the right the new version; Here is a screenshot: