Week 6: Clipboard Auto-Clear with Klipper Protection

Wait 5 sec.

This week I implemented clipboard auto-clear for KeepSecret (!36).When a user copies a password, it shouldn't stay in the clipboard indefinitely — that's a real security risk if the clipboard gets inspected, synced, or accessed by another application.##What was implemented:After copying a password, the clipboard is automatically cleared after 30 seconds. A Kirigami.InlineMessage countdown notification appears in the entry page showing "Password copied. Clipboard will be cleared in X seconds", updating every second. The clipboard is also cleared when the app quits via QCoreApplication::aboutToQuit.Instead of QClipboard::clear() (which on X11 reverts to the previous clipboard entry), the clipboard is overwritten with an empty string. A single repeating QTimer of 1 second handles both the countdown and the clear — subtracting 1 second each tick, stopping and clearing when it reaches 0. The timeout uses std::chrono::seconds as suggested by Marco Martin during review.##Klipper history protection:One tricky KDE-specific problem: even if you clear the clipboard after the timeout, the password could still be sitting in Klipper's clipboard history. The fix is to add the x-kde-passwordManagerHint MIME type (set to "secret") alongside the password data when copying. Klipper specifically checks for this hint and skips adding that entry to its history entirely — so the password never gets recorded there in the first place. This approach was pioneered by KeePassXC.