Skip to content

feat: recent files menu and password confirmation#6

Merged
nelsonduarte merged 2 commits into
mainfrom
feature/recent-files
Mar 26, 2026
Merged

feat: recent files menu and password confirmation#6
nelsonduarte merged 2 commits into
mainfrom
feature/recent-files

Conversation

@nelsonduarte
Copy link
Copy Markdown
Owner

Summary

  • Recent files menu with history icon in toolbar (max 10 files)
  • All open methods (button, drag & drop, tools) track recent files
  • Clear recent files option in menu
  • Password confirmation field in Encrypt tool
  • Persistent storage in ~/.pdfapps_config.json

Test plan

  • Open a PDF, close app, reopen — file appears in recent menu
  • Open multiple PDFs — all appear in order
  • Click a recent file — opens correctly
  • Click "Clear recent files" — list is emptied
  • Encrypt tool: type different passwords — shows mismatch warning
  • Encrypt tool: type matching passwords — encrypts successfully

🤖 Generated with Claude Code

nelsonduarte and others added 2 commits March 26, 2026 16:35
Click the history icon to see recently opened PDFs. Files are saved
to ~/.pdfapps_config.json (max 10). All open methods (button, drag
& drop, tools) track recent files. Clear option in menu.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Users must retype the owner password before encrypting.
Shows warning if passwords don't match.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nelsonduarte nelsonduarte merged commit a07e74d into main Mar 26, 2026
1 check passed
nelsonduarte added a commit that referenced this pull request Jun 5, 2026
…ge (#79)

* fix(encrypt): wipe password fields after run

QLineEdit text for owner/user/decrypt passwords persisted in memory
for the entire session. Now cleared via try/finally in _run() to align
with the broader wipe_pdf_password() pattern.

Addresses R8-H1.

* fix(window): deleteLater _update_worker after check completes

The _update_worker QObject lived for the lifetime of the application
because only _update_thread.deleteLater was wired. Now released in
_on_update_found() via _release_update_worker() and called defensively
from closeEvent.

Also removes the dead _update_ready signal: it was declared at the
class level and connected to _notify_update, but never emitted — the
actual update notification path is via _update_worker.done.

Addresses R8-H2 and R8 dead-code finding.

* feat(cli): argparse with multiple PDFs, --help, --version

Previously only sys.argv[1] was opened, so multi-file "Open With" or
drag-and-drop of N>1 PDFs onto the executable silently dropped every
file after the first. -h / --help was treated as an invalid path and
the app launched into the welcome screen.

Now uses argparse: accepts multiple PDF paths (each opens in its own
tab via _load_and_track), and exposes standard --help / --version
flags that exit before QApplication is constructed.

Addresses R8-M1.

* fix(viewer): re-render canvas on screen DPR change

Both viewer/canvas.py and editor/canvas.py read devicePixelRatioF()
only inside _schedule_visible(). Without a screenChanged handler,
moving the window between 100% and 200% monitors (or changing the
DPR of an active monitor via Windows Display Settings) left every
visible page blurry until the next zoom interaction.

New showEvent override connects to window.windowHandle().screenChanged
and invalidates cached pixmaps on DPR change, then re-queues the
visible range. The connect is guarded against duplicate handlers on
re-show / tab switch.

Addresses R8/D1.

* fix(watermark): prompt for password on encrypted watermark PDF

PdfReader(wm_path) raised PdfReadError cryptically when the watermark
PDF was itself encrypted (rare but observed with corporate stamp
PDFs). Now a dedicated _prompt_watermark_password() helper prompts
for the watermark's password before pre-flight and the worker
decrypts the second reader with it, kept separate from
self._pdf_password so source and watermark credentials don't mix.

Addresses R8 bonus #6.

* fix(viewer): wrap _populate_toc in try/except

A malformed outline (cyclic refs, bad page indexes, unexpected entry
shape) could raise mid-build and leave the TOC panel in an
inconsistent state — half-populated and surfaced as a stack trace.
Now the failure is logged via logging.warning and the TOC tree is
reset to an empty / hidden state so the rest of the viewer stays
usable.

Addresses R8 bonus #7.

* test: source-level regressions for Round 8 selective fixes

10 new tests guard the PR-C wiring against silent regressions:

- encrypt._clear_password_fields() + try/finally hookup
- _release_update_worker helper + _update_ready signal removal
- argparse CLI (multi-PDF, --help, --version) — also exercises
  the subprocess version/help flags end-to-end
- screenChanged DPR handler on viewer + editor canvases
- watermark encrypted PDF prompt path
- _populate_toc try/except + logging
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.

1 participant