Gracefully handle encrypted PDF
Created by: textPreferred
By accident I tried to add an encrypted PDF to my paperwork documents.
Here's what happened:
- The "import" froze (progress bar stayed at 0%) without any notification as to why and how to stop it.
- The document was not added to the list of documents as shown in the UI
- The document was added to the paperwork document folders
- The document was detected as being encrypted every time I restarted paperwork, but that information was only shown in the command line error messages
- The existence of the document in the folders made paperwork "freeze" any time I started it.
- Removing folder and file fixed the misbehaviour
Expected result:
- Notify user that encrypted PDFs can not be added
- Don't add to folders
- Don't freeze
Even better: Do support encrypted PDF
- Notify user that the PDF is encrypted
- Ask whether it should be imported anyway; tell user that it will be imported in unencrypted form
- If user confirms: Ask user for password
- Decrypt temporarily
- Import temporary document
- Delete temporary document
Edited by Jerome Flesch