[Theme] Carry Default theme directory customizations over to System (#7385)

* [Theme] Carry Default theme directory customizations over to System

The Default -> System rename rewrote the stored theme name but left the
user profile's themes/Default directory behind, so anyone who had
customized zone graphics, stylesheets or palettes there silently lost them.

Migrate the directory alongside the name. Rename it when System does not
exist yet, otherwise merge file by file without overwriting what System
already has, then drop the legacy directory. Users who already ran the
rename get their customizations back on the next start, and a hand-made
Default folder of a user on another theme is left untouched.

* [Tests] Give theme_migration_test an explicit main and gate it on WITH_CLIENT

The build machines that cannot find GTest fall back to the downloaded
googletest, which links the bare gtest library without gtest_main. Every
other test defines its own main() for that reason; this one did not, so
Debian 13, Fedora 44 and Ubuntu 26.04 failed to link it.

The test compiles client sources, so -DTEST=1 -DWITH_CLIENT=0 has no way
to build it. Gate the subdirectory on WITH_CLIENT like the other
client-source test.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-10-03 13:43:25 +02:00 • committed by GitHub
parent add65caae5
commit 014983b5bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 299 additions and 1 deletions

View file

@ -71,6 +71,14 @@ public:
// read-only system themes fall back to the user themes directory, creating
// it if needed, so customisations never get lost on upgrade.
static QString writableThemeDir(const QString &themeName);
// Carries a user profile's customised "Default" theme directory over to the
// "System" directory the theme was renamed to, so zone graphics,
// stylesheets, palettes and theme.cfg survive the rename. Renames the
// directory when "System" does not exist yet, otherwise merges file by
// file without overwriting what "System" already has. No-op unless the
// active theme is one of the two names, so a hand-made "Default" folder of
// a user on another theme is left alone.
static void migrateLegacyThemeDir(const QString &themesPath, const QString &currentThemeName);
// Probe whether a directory is truly writable by trying to create and remove
// a temporary file. QFileInfo::isWritable() on a directory is unreliable
// (notably on Windows where UAC VirtualStore can make a system dir appear