Development/Tutorials/KDE4 Porting Guide

From KDE TechBase
Revision as of 01:08, 15 January 2007 by Milliams (talk | contribs) (Beginings of a porting tutorial/documentation source)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Porting a KDE3 based application needn't be a difficult process. Already, there are many scripts and sources of documentation which can help.

CMake

Unlike KDE3, KDE4 applications will be build with the help of CMake. The easiest way to port your autotools system to CMake is with the help of the am2cmake script which can be found in the cmake/scripts directory of the kdesdk module. This will create a series of CMakeLists.txt files alongside your old buildsystem files.

KDE4 API

A portion porting your code to KDE4 is simply renaming of class names and header files. Since it would be rather tedious to change all these by hand, there is a handy script in the scripts/qt4 directory of kdesdk called adapt-to-kde4-api.pl. This will scan all your files and create a diff output which can then be used to patch your code.

Once that simple code substitution has been done, you will still have to go through your code to port to, for example, the new KAction API. Documentation about all API changes is kept in the KDE4PORTING.html file in the kdelibs module.