All posts by Dominik

Dominik is a PhD student at the Control Theory and Robotics Lab, TU Darmstadt, as part of the Research Training Group GKMM (GRK1362). My research focuses on state estimation in distributed systems. As hobby, I contribute to the KDE project and work on the Kate application and editor component.

RFC: Data Recovery

Currently, we use our own passive notification bar to show a recovery bar when a swap file was found:

Since version 4.7 we have a class called KMessageWidget (api documentation). Using KMessageWidget, the notification could also look like this:

Imo, the new one looks nicer, as it much better distinguishes the notification popup from the rest of the ui. However, it several drawbacks:

  • the minimum width is now 800 pixel due to the label (too large, might break layout in apps)
  • the title “Data Recovery” was omitted
  • the “Help” link, showing a tool tip with further information, can not be added anymore (the api does not allow it)

Possible solutions:

  • put the buttons under the label, as it was in the old version (currently, the api does not allow it, so we’d need something like setButtonsUnderText(bool))
  • wrap the text in the label (looks aweful, since the buttons appear then between two lines of text)
  • to get the “Help” label back, the api would need to forward the QLabel’s signal linkActivated(const QString&)

I’m not sure whether the API can be extended in the 4.x line, though…

Comments?

Kate in KDE 4.9

With KDE SC 4.9 around the corner and according to tradition, it’s time to have a look at what’s new in Kate.

Improved Support for Custom Color Schemas

  • improved “Colors” tab in the “Fonts & Colors” config page
  • configurable colors: search & replace, code folding, indentation line,
  • schema export and import honor background colors (bug #291868) and font
  • “highlight selection” plugin and “search and replace” plugin now use search & replace colors from Kate’s color schema

Line Modification System

  • new option to disable in the editor settings: Appearance > Borders > [ ] Show line modification markers
  • colors of the line modification system are configurable

Build Plugin

  • reworked config page (including advanced settings for remote debugging)
  • support for remote debugging

Further Changes

  • new option in Open/Save config page: [ ] Add newline at end of file on save
  • all fixes in the bug tracker

RFC: Exporting JavaScript API

Since quite some time, Kate Part has build-in scripting support through JavaScript. Our plan is to make this API public, so other applications like Kile, Kate App and KDevelop can use it. However, we are currently unsure how to best implement it, so this is a rfc to get feedback.

The bindings for a Kate Document are for instance located in part/script/katescriptdocument.h (header, implementation). As you can see, there are functions like

Q_INVOKABLE bool insertLine(int line, const QString &s),

which can be invoked in our scripting by a call of ‘document.insertLine(5, “hello world”)’. The API only contains basic functions. But for instance Kile maybe also wants to provide a function called ‘document.insertSection()’ or similar LaTeX related functions. The question now is as follows: How can Kile extend our QObject based prototype with their own QObject based classes?

We do not want to make the class KateScriptDocument public. Instead, we just want to return a QScriptValue containing a QObject based KateScriptDocument. You can think of the problem also as follows:

// in Kile:
QScriptEngine *engine = ...;
KTextEditor::Document *kteDocument = ...;

QObject* kateScriptDocument = kteDocument->scriptDocument();
engine->globalObject().setProperty("document", engine->newQObject(kateScriptDocument));
// at this point, the JavaScript object 'document' contains all KateScriptDocument functions

// next, we want to add the Kile related document functions
KileTextDocument* kileDocument = ...;
QObject* kileScriptDocument = kileDocument->...(); // some function that returns the binginds object

// now: how can we populate the 'document' property with the functions in kileScriptDocument?
engine->globalObject().setProperty("document", ? );

If you have any idea or other solutions how to do it right, please let us know!