= Developing Kleopatra =

This page is meant to give (new) developers a hand. Information about developing Kleopatra are widespread and do currently not link each other.

<<TableOfContents(3)>>

== General information ==

The product page of Kleopatra can be Found on KDE.org

https://www.kde.org/applications/utilities/kleopatra/

=== Coding Guidlines ===

As a KDE-Application, Kleopatra follows the Kdelibs Coding Style.

https://community.kde.org/Policies/Kdelibs_Coding_Style

=== API Docs ===

An automatically generated API-Documentation about Kleopatra and Libkleo can be found here:

http://api.kde.org/4.14-api/kdepim-apidocs/kleopatra/html/index.html

http://api.kde.org/4.14-api/kdepim-apidocs/libkleo/html/index.html

== Getting started ==

=== Build Kleopatra from GIT ===

See: https://wiki.gnupg.org/BuildingFromGIT/Kleopatra?highlight=%28kleopatra%29 

=== Build Kleopatra as part of Gpg4Win ===

At first you might want to build Gpg4Win and Kleopatra. Get information about building Gpg4Win here: https://www.gpg4win.org/build-installer-gnulinux.html

To now Build Gpg4Win with your modified version of Kleopatra, do the following:

* in gpg4win/src/playground/build delete(or move) the "kleopatra-<DATE>" directory Remember the name
* create a symlink to the self-build git-repo. Name it "kleopatra-<DATE>"
* apply the (five) patches in gpg4win/patches/kleopatra
** these are executable scripts. Just execute them, no need to git apply <FILE>
** you might want to create a new local branch for this, to get a clean working tree
* change to gpg4win/src/playground/build/kleopatra-<DATE>-build and "make"


=== Reach Kleopatra from external processes ===

To archive platform independent inter-process communication Kleopatra opens a socket on localhost, which can be reached from localhost.

When Kleopatra is running, "ss -l" should deliver something similar to this:

{{{
u_str  LISTEN  0  128  /home/sengelhardt/.gnupg/S.uiserver  3877681  *  0
}}}

using "gpg-connect-agent", you can reach Kleopatra from different processes.

with 

{{{
gpg-connect-agent -v -S /home/sengelhardt/.gnupg/S.uiserver
}}}

you can access to socket directly. Use "help" to see what the sockets accepts.
In "kleopatra/tests/gpg-connect-agent-scripts" you can find some premade scripts. To try a one out, use

{{{
"gpg-connect-agent -v -S ~/.gnupg/S.uiserver < gpgex-sign"
}}}

for example.

This behavior is defined in kleopatra/src/uiserver.