Kleopatra hackability (especially with regards to windows)
Kleopatra is often critizied for being to big and to hard to build with an entry level for new hackers that adds uneccessary barriers for contributors. You need a KDE development environment to build / hack kleopatra which is especially hard to set up for Windows users.
This page is intended to take a look at the status quo (as of KDE 4.13) and offer suggestions for potential improvements with the goal of increasing the stability and making kleopatra as an uiserver for gnupg more attractive for hackers and users.
Kleopatra could be made into a Qt only application with optional dependencies to KDE. So that if it is build as part of a distribution including KDE (KDE-Windows / GNU/Linux Distributions focusing on KDE Desktops) it would still integrate with KDE settings / Ui etc. But when built as a standalone application it would no longer pull in the whole kdelibs stack.
There is already a kdepim_only_kleo build option that reduces much of the dependencies needed to build kdepimlibs and only builds the reduced set actually needed for Kleopatra. This reduces the pressure to move the libraries necessary for kleopatra out of kdepimlibs. But as shown below this is only gpgme++.
Only depends on C++.
- Move it out of kdepimlibs into it's own repo with its own releases Rationale: It is fairly unrelated to kdepimlibs and sharing the build system with the dependencies of kdepimlibs led to the requirement of having a "KDEPIM_ONLY_KLEO" macro in there.
- Add a minimum required gpgme version to avoid feature checks and according ifdefs. Rationale: Gpgme++ contains feature checks so that it can be used with old gpgme version. This complicates usage of gpgme++ and the gpgme++ code while there should not be a use case to build gpgme++ with a deprecated version of gpgme and no one maintains problems arising from that anyway.
The eventloopinteractor is no longer necessary on windows as gpgme is used multithreaded there. It might still be used on GNU/Linux but I failed to find it's usage there.
- Remove this library altogether and move the remaining code (dataprovider) into kdepim/libkleo/qgpgme
Kleopatra depends on the monolithic kdelibs (no kdelibs_only_kleo) at least in the build system but it only uses symbols from a small subset of the kdelibs libaries: libkdecore, libkdeui, libkmime, kded_globalaccel and libkcmutils.
Ideally the build would then only depend on the third party libraries necessary to build these but as of KDE 4.13 the kdelibs build system does not support to build such a reduced set. For example there is a dependency to have qsslsocket available during build for which you need a qt build that had openssl headers available. So without actually needing this you need to include openssl in the build system.
Dependencies pulled in by kdelibs:
- sycoca (using kde's desktop file parser)
- Evaluate kde-frameworks to only build / use the necessary parts of kdelibs
- At least for windows it could be feasible not to depend on dbus / dbusmenu-qt and the kde system configuration. For IPC there is already assuan and the uiserver protocol and instead of a dynamic system configuration kleopatra could rely on a "hardcoded" set of available plugins.
- Not sure where attica and dbusmenu-qt are actually used but it is doubtful that they are really necessary for kleopatra on Windows.
- Add a kdelibs_only_kleo option or something like it in case of a monolithic build to reduce build-time dependencies.
As with kdepimlibs there is already a build option to reduce the build time dependencies for kleopatra. This is already a great help building kleopatra only from the kdelibs repository.
Other Applications in kdepim make use of libkleo but kleopatra only slightly uses libkdepim (apparently only the progressmanager)
- Use the UI Server protocol in other kdepim Applications instead of libkleo directly. This would reduce the bind between kleopatra and kdepim.
- Move libkleo out of kdepim into it's own repository and guarantee some ABI stability for kdepim. This could be a candidate for kdepimlibs.
Kleopatra has a fairly unique (at least inside of kdepim) mix of using STD library functions combined with boost c++ extensions and Qt. This increases the entry barrier / knowledge necessary to happily hack away in kleopatra as a prospective hacker needs knowledge not only of Qt and some basic C++ (as is enough in most other places in KDE) but additionally has to understand design patterns and code based on Stdc++ and Qt.
Boost usage could be removed or replaced either with C++11 features (shared pointer, lambda etc.) or by equivalent structures in Qt. It is also probable that some boost features could just be replaced by simpler code which would be easier to maintain / understand while only increasing the overhead a bit.
- It should be possible to remove boost altogether and replace it by Qt / C++11
STD Library usage
While there should not be a necessity to use the std c++ library as much when there is a library like Qt already available, Kleopatra extensively uses the std data structures std::vector, std::map and their functions instead of their Qt variants.
- Changing more and more STD library functions to qt class by class. This is too much to do it in one go.
As written above kleopatra does not use kdelibs very heavily. Mostly kdeui, the kde config management is used.
find kleopatra libkleo -name \*.cpp -o -name \*.h | xargs grep -h -i include | grep k | grep < | sort -u | grep -v kleo
(All <> headers included that contain a k ;) )
- System configuration management
- Selection dialogs
- For mobile ui (Possibly mobile UI only with kdelibs support)
- Shortcut / action helpers (should be replacable by QAction etc.)
- Configuration files (should be replaceable by qsettings)
- General KDE integration (could be replaced by qt)
- kuniqueapplication.h (uniqueness has to be adapted)
- Configuration plugins
- UI extensions over Qt
- Things unecessary with Qt5 / current cmake
- kdemacros.h ?
- kurl.h ?
- kmime/kmime_header_parsing.h (QtMimeDatabase? )
- Use Qt5 Replacements where possible to further reduce KDE dependencies
- Make KDE integration optional and use Qt base classes in case KDE is not avialable.
- Reduce optionality (Using Kleopatra without S/MIME backend on Windows -> Not supported. Etc..) As no one wants to maintain such configurations.
- Localization could be a problem for a kleopatra with optional kdelibs. A possible solution here would be to still use klocale from kde-frameworks so that the translations created by the KDE community could be used.