Page MenuHome GnuPG

Location of qt-application config files
Testing, HighPublic

Description

Current problematic status:
If we do not change anything, Okular config files will stay in several different locations (same issue we had with Kleopatra):
%LOCALAPPDATA% (okularrc), %APPDATA%/okular (okularstaterc) and %LOCALAPPDATA%/okular/docdata

Currently, in Gpg4win 5 (and in VSD 3.4 if T7700 is done) all Qt-programs are configured via qt.conf to use %GNUPGHOME%/kleopatra if they set GNUPGHOME. Which Kleopatra does, Okular doesn't.
So if we want to move the Okular config files by setting GNUPGHOME there, too, or if a global GNUPGHOME is set, %GNUPGHOME%/kleopatra is the folder where the config files will go.

Which is fine when we only have Kleopatra. But where do we want to store those application related files for Okular?
Suggestions to use for both Kleopatra and Okular:

  • %GNUPGHOME%/kleopatra (i.e. leave as-is)
  • %GNUPGHOME%/kde (i.e. use a more generic name; kleopatragroupsrc could stay in %GNUPGHOME%/kleopatra or move here, too)

Note: A location that depends on the application name (e.g. %GNUPGHOME%/$applicationname) might seem nicer, but it would require extending our patch for QStandardPaths. Moreover, it will cause problems if config files need to be shared (which, at the moment, doesn't seem necessary).

For the solution we want to implement see T7717#208938
For hints for testing see T7717#209211

Copied from T7700: Kleopatra: Move kleopatrarc away from %LOCALAPPDATA% (with adjustment to new file locations):

For reference for testing:

  • In VSD 3.1.26 < 3.3.0, Kleopatra uses the following config files
    • %LOCALAPPDATA%/kxmlgui5/kleopatra/kleopatra.rc -> move/migrate
    • %LOCALAPPDATA%/klanguageoverridesrc -> move/migrate
    • %LOCALAPPDATA%/kleopatrarc -> move/migrate
    • %APPDATA%/kleopatra/kleopatrastaterc -> move/migrate
    • %LOCALAPPDATA%/kleopatragroupsrc -> move/migrate
  • In VSD 3.3.0, Kleopatra uses the following config files
    • %LOCALAPPDATA%/kxmlgui5/kleopatra/kleopatra.rc -> move/migrate
    • %LOCALAPPDATA%/klanguageoverridesrc -> move/migrate
    • %LOCALAPPDATA%/kleopatrarc -> move/migrate
    • %APPDATA%/kleopatra/kleopatrastaterc -> move/migrate
    • %APPDATA%/gnupg/kleopatra/kleopatragroupsrc -> this is the desired location; if future VSDs use %APPDATA%/gnupg-vsd then they need to migrate everything from %APPDATA%/gnupg to %APPDATA%/gnupg-vsd, i.e. kleopatra doesn't need to care for this
  • In GPD 4.3.0, Kleopatra uses the following config files
    • %LOCALAPPDATA%/kxmlgui5/kleopatra/kleopatra.rc -> move/migrate
    • %LOCALAPPDATA%/klanguageoverridesrc -> move/migrate
    • %LOCALAPPDATA%/kleopatragroupsrc -> move/migrate
    • %LOCALAPPDATA%/kleopatrarc -> move/migrate
    • %APPDATA%/kleopatra/kleopatrastaterc -> move/migrate
  • In Gpg4win 4.3.1, Kleopatra uses the following config files
    • %APPDATA%/kleopatra/kxmlgui5/kleopatra/kleopatra.rc -> move/migrate
    • %APPDATA%/kleopatra/klanguageoverridesrc -> move/migrate
    • %APPDATA%/kleopatra/kleopatragroupsrc -> move/migrate
    • %APPDATA%/kleopatra/kleopatrarc -> move/migrate
    • %APPDATA%/kleopatra/kleopatrastaterc -> move/migrate
  • In Gpg4win 4.4.1, Kleopatra uses the following config files
    • %APPDATA%/gnupg/kleopatra/kleopatragroupsrc -> OK
    • %APPDATA%/kleopatra/kxmlgui5/kleopatra/kleopatra.rc -> move/migrate
    • %APPDATA%/kleopatra/klanguageoverridesrc -> move/migrate
    • %APPDATA%/kleopatra/kleopatrarc -> move/migrate
    • %APPDATA%/kleopatra/kleopatrastaterc -> move/migrate

Further notes for testing:

  • How to create some of the config files with the old versions:
    • Add an action to the toolbar (e.g. About Kleopatra) to get the file kxmlgui5/kleopatra/kleopatra.rc.
    • Configure a different language to get the file klanguageoverridesrc.
    • Create a group to get the file kleopatragroupsrc.
  • In VSD 3.4+ the old config files should be migrated to the following locations/names:
    • kxmlgui5/kleopatra/kleopatra.rc -> %APPDATA%/kleopatra-vsd/kxmlgui5/kleopatra-vsd/kleopatra.rc
    • klanguageoverridesrc -> %APPDATA%/kleopatra-vsd/klanguageoverridesrc
    • kleopatrarc -> %APPDATA%/kleopatra-vsd/kleopatra-vsdrc
    • kleopatrastaterc -> %LOCALAPPDATA%/kleopatra-vsd/State/kleopatra-vsdstaterc
    • kleopatragroupsrc -> %GNUPGHOME%/kleopatra/kleopatragroupsrc
  • In GPD 4.4+ the old config files should be migrated to the following locations/names:
    • kxmlgui5/kleopatra/kleopatra.rc -> %APPDATA%/kleopatra-gpd/kxmlgui5/kleopatra-gpd/kleopatra.rc
    • klanguageoverridesrc -> %APPDATA%/kleopatra-gpd/klanguageoverridesrc
    • kleopatrarc -> %APPDATA%/kleopatra-gpd/kleopatra-gpdrc
    • kleopatrastaterc -> %LOCALAPPDATA%/kleopatra-gpd/State/kleopatra-gpdstaterc
    • kleopatragroupsrc -> %GNUPGHOME%/kleopatra/kleopatragroupsrc
  • In Gpg4win 5.0+ the old config files should be migrated to the following locations/names:
    • kxmlgui5/kleopatra/kleopatra.rc -> %APPDATA%/kleopatra/kxmlgui5/kleopatra/kleopatra.rc
    • klanguageoverridesrc -> %APPDATA%/kleopatra/klanguageoverridesrc
    • kleopatrarc -> %APPDATA%/kleopatra/kleopatrarc
    • kleopatrastaterc -> %LOCALAPPDATA%/kleopatra/State/kleopatrastaterc
    • kleopatragroupsrc -> %GNUPGHOME%/kleopatra/kleopatragroupsrc

Details

Version
vsd 3.3.2 / 3.3.3

Event Timeline

werner triaged this task as Normal priority.Jul 17 2025, 9:04 AM

For our GnuPG Okular, we should not use the standard file names (okularrc, …) as this would conflict with a regular Okular installation.

New plan:

We keep only the kleopatragroupsrc in %GNUPGHOME%/kleopatra. Everything else will go into application specific folders below %APPDATA% or %LOCALAPPDATA%.

To distinguish our applications from the default apps the application-ID will have one of the following suffixes:

  • GnuPG VS-Desktop: -vsd
  • GnuPG Desktop: -gpd
  • Gpg4Win: -g4w (except Kleopatra, which is the default application here)

The qt.conf entries will be change like this:

[StandardPaths]
AppConfigLocation=%APPDATA%/$appid$
AppDataLocation=%APPDATA%/$appid$
AppLocalDataLocation=%LOCALAPPDATA%/$appid$
CacheLocation=%LOCALAPPDATA%/$appid$
ConfigLocation=%APPDATA%/$appid$
StateLocation=%LOCALAPPDATA%/$appid$
GenericCacheLocation=%LOCALAPPDATA%/$appid$
GenericConfigLocation=%APPDATA%/$appid$
GenericDataLocation=%LOCALAPPDATA%/$appid$
GenericStateLocation=%LOCALAPPDATA%/$appid$
ebo renamed this task from Draft: Location of qt-application config files to Location of qt-application config files.Tue, Nov 25, 5:04 PM
ebo raised the priority of this task from Normal to High.
ebo updated the task description. (Show Details)
ebo set Version to vsd 3.3.2 / 3.3.3.
ikloecker moved this task from Backlog to WIP on the gpd5x board.
ikloecker mentioned this in Unknown Object (Maniphest Task).Mon, Dec 1, 8:46 AM

This is now implemented for Gpg4win 5.

Regarding the qt.conf mentioned above in T7717#208938 I made a few changes:

  • I changed the placeholder for the application name from $appid$ to ::APPNAME:: so that environment variables on Linux can be supported in the future (and APPNAME instead of appid is closer to the Qt documentation and avoids confusion with other app IDs which often use a reverse-domain format).
  • I have commented out a few locations that are already used by default by Qt. I left them in the qt.conf so that we see that we considered those locations.
  • I adapted a few locations to those used by Qt by default, e.g. the cache locations and the state locations use a subfolder. Don't ask me why Qt uses "cache" (lower case) but "State" (title case).
AppConfigLocation=%APPDATA%/::APPNAME::
#AppDataLocation=%APPDATA%/::APPNAME::
#AppLocalDataLocation=%LOCALAPPDATA%/::APPNAME::
#CacheLocation=%LOCALAPPDATA%/::APPNAME::/cache
ConfigLocation=%APPDATA%/::APPNAME::
#StateLocation=%LOCALAPPDATA%/::APPNAME::/State
# we want all locations to be namespaced with the application name
GenericCacheLocation=%LOCALAPPDATA%/::APPNAME::/cache
GenericConfigLocation=%APPDATA%/::APPNAME::
GenericDataLocation=%LOCALAPPDATA%/::APPNAME::
GenericStateLocation=%LOCALAPPDATA%/::APPNAME::/State

Regarding testing I suggest to look at the tests done for T7700: Kleopatra: Move kleopatrarc away from %LOCALAPPDATA%. Since %GNUPGHOME%/kleopatra was only used in beta releases I didn't write any code for migrating files from there to the new locations.

Backported for VSD 3.4

ikloecker changed the task status from Open to Testing.Tue, Dec 2, 12:00 PM
ikloecker updated the task description. (Show Details)

While working on https://dev.gnupg.org/T7962 I realized that https://dev.gnupg.org/T7717#208938 is probably not the best solution for separating the config files of different distributions of Kleopatra, Okular, etc. Changing the application name has many side effects, e.g. it changes the name of the config files, but that's unnecessary because we put the apps' files already in different folders. There are also other side effects that make things complicated (and require many changes in okular). Taking a step back what we need is different folders for VSD, GPD, and Gpg4win (and KDE Okular). And, for Kleopatra, we need different unique service IDs, but let's ignore this for now. That can easily be solved separately. For the different folders it would be sufficient (and maybe even nicer for selective backups) to use something like %(LOCAL)APPDATA%/GnuPG VS-Desktop, etc., as location for all apps' files of VSD/GPD/Gpg4win. Then we wouldn't have to change/patch anything in Okular (or any other Qt apps).