KDE Tutorial: Get Hot New Stuff |
IntroductionSince KDE 3.2, applications can use a central framework for downloading and uploading media files such as wallpapers, game levels, spreadsheet templates and so on. The KNewStuff library is flexible enough to allow for both easy-to-use invocation and detailed control about what's going on. In this tutorial, 2 applications are highlighted to cover these cases: Kamikaze and KOrganizer.KamikazeAs an external KDE application, the very first task to do is to check whether the KNewStuff library is actually available. The code could use version checking (KDE_VERSION >= 3.2), but since the library must be linked in conditionally, an autoconf macro is provided here.All the application author has to do is to call AC_KNEWSTUFF in configure.ac, and then check for HAVE_KNEWSTUFF (defined in config.h) and use $(KNEWSTUFF) in the application's Makefile.am (which will be set to -lknewstuff if available). The source is modified as follows:
![]() The game Kamikaze provides an easy way to get new levels. ![]() This is the dialog including only Kamikaze levels. KOrganizerKOrganizer is part of KDE CVS, and thus doesn't need to check for library availability. Furthermore, the application needs more fine-grained control over the installation of new content, especially an updated calendar view if new calendars are installed.Beside the steps mentioned above, the following is to be done:
![]() The help menu of KOrganizer containing the download and upload menu items. ![]() A dedicated KNewStuff-derived object can display additional information. ![]() Installed items are marked with a green ok sign, while outdated ones are marked with a history icon. |
Josef Spillner <spillner kde org> 29.08.2003 |