In Pardus Corporate we use KDE 3.5.10 and some of our new tools from Pardus 2009 which runs KDE 4.3.5 (for now). Tools in 2009 are designed to work with the current desktop environment which is KDE 4.3.5. So, we have a problem in Pardus Corporate side; we need kdelibs4 on KDE 3.5.10. It is possible to use kdelibs4 but in some ways it is not a great idea.
We think that we can create a solution for making universal apps which run on KDE 4.x with kdelibs4 and for others (kde3.5, xfce etc.) which use Qt libs.
Most of the code in our applications just depends on Qt 4.x, but some important parts for the desktop integration depends on KDE.
Basics of desktop integration
- Language Selection
I started with KIconLoader port for Qt, which I have found the C++ version on this blog entry and ported it to Python from scratch. For colors, fonts or language selection it is enough to read the user’s
kdeglobals files. Notifications are handled by PyNotify on Qt-Only mode… When things started to grow up I decided to merge them under the name of Pardus Desktop Services (Pds).
Example Usage of Pds
>> import pds
>> desktop = pds.Pds()
>> desktop.settings('Icons/Theme', 'default')
PDS also provides the following classes;
QIconLoader – for icon loading from current desktop settings (Kde 4, Kde 3.5, Xfce ..)
QUniqueApplication – for creating a unique application like KUniqueApplication. It also provides sending commands to running instances through QLocalServer.
I18n – Pds uses Gettext for translations and supports the kdelibs’ i18n-like parameters such as (%1, %2).
Notification – Uses PyNotify if it’s installed otherwise it uses QSystemTrayIcon balloon message.
worth a thousand words..
The following example shows two running Package-Manager instances; first one is running as a KUniqueApplication on Kde 4.4 provided by kdelibs4 and the second one is running as a QUniqueApplication which is provided by Pardus Desktop Services on Kde 3.5. Same application, same features, one code..