Skip to content

Add named signature-setting presets (+ XDG-aware config location)#360

Open
kwart wants to merge 13 commits intomasterfrom
claude/presets
Open

Add named signature-setting presets (+ XDG-aware config location)#360
kwart wants to merge 13 commits intomasterfrom
claude/presets

Conversation

@kwart
Copy link
Copy Markdown
Member

@kwart kwart commented Apr 21, 2026

Adds named signature-setting presets to the JavaFX UI and moves per-user config to a platform-native location.

Closes #252 (config-file location). Presets had no dedicated issue — requested by a user who regularly switches between several signing configurations.

What's new

  • Presets — save the current signing configuration under a name, switch between them with one click.
    • Toolbar drop-down: picking an entry loads the preset immediately (fire-and-forget — no "active preset" tracked).
    • Presets menu: Save current as new preset… and Manage presets… (rename / overwrite / delete, with confirmations for the destructive actions).
    • Presets capture the whole signing configuration except session state (input/output paths).
  • Config directory — moves per-user state out of ~/.JSignPdf into:
    • Linux/BSD: $XDG_CONFIG_HOME/jsignpdf/ (fallback ~/.config/jsignpdf/)
    • Windows: %APPDATA%\JSignPdf\
    • macOS: ~/Library/Application Support/JSignPdf/
    • Override with JSIGNPDF_CONFIG_DIR env var.
    • One-shot migration: on first run, if the new dir is absent and ~/.JSignPdf exists, it's copied to <cfg>/config.properties. The legacy file is left in place so downgrades keep working.

Internals

  • PropertyProvider lost its singleton; PropertyStoreFactory hands out the cached main-config store and fresh preset stores (preset-<epoch-ms>.properties with collision retry).
  • BasicSignerOptions got loadFromPreset / storeToPreset alongside the existing loadOptions / storeOptions, gated by a shared flag so the main-config path and preset path don't drift.
  • VisibleSignatureCoordinator centralises placement ↔ signing-VM sync (previously duplicated inline in two controller methods) so the visible-signature rectangle survives the save → load round-trip.
  • Reset Settings now wipes the whole config directory (including presets/), exposed as a testable PropertyStoreFactory.resetAll().

Docs

  • Design doc: design-doc/3.0.0-presets-feature.md.
  • User guide: new Using presets section in the JavaFX chapter and a Configuration directory section under Advanced configuration. Rebuilt the asciidoctor PDF locally as a smoke check.

Test plan

  • mvn test — 160/160 pass (106 existing + 54 new across ConfigLocationResolver, PropertyStoreFactoryReset, PresetManager, PresetValidation, VisibleSignatureCoordinator).
  • asciidoctor PDF builds without errors.
  • Manual UI smoke: save preset → restart → load → verify settings + visible-signature rectangle reappear.
  • Manual UI smoke: Manage dialog rename / overwrite / delete reflect in the toolbar combo without restart.
  • Fresh Linux install (no ~/.JSignPdf): new config dir created, combo shows No presets saved.
  • Upgrade path: existing ~/.JSignPdf → new <cfg>/config.properties appears, legacy file untouched.

kwart and others added 13 commits April 21, 2026 12:14
Resolves conflict in BasicSignerOptions.java: keeps the new
loadFromStore(store, includeMainConfigOnly) refactor from this branch
and applies master's DEFVAL_APPEND / DEFVAL_STOREPWD explicit-default
fallbacks on top. Migrates two BasicSignerOptionsTest tests added on
master to use PropertyStoreFactory.mainConfig() now that the
PropertyProvider singleton is gone.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Place config to $XDG_CONFIG_HOME/JSignPdf

1 participant