Home GnuPG

Cache exported keys and use temp dirs instead of temp files in cwd

Description

Cache exported keys and use temp dirs instead of temp files in cwd

QMimeData::retrieveData is called multiple times while dragged
certificates are moved over drop targets. To avoid exporting the
certificates multiple times we cache the exported data.

The old code created the temporary file in the current working
directory. This could be a user visible folder (not ideal) or a
read-only folder (which would cause an error). Moreover, multiple
d'n'd operations could result in numbered files (to avoid filename
collisions in the current working directory) even if numbering wasn't
needed for the drop target or if at the drop target (e.g. a folder)
another filename collision occurred. Using a separate temporary
directory for each d'n'd operation avoids any filename collisions at
the temporary file location.

Last but not least, this change fixes the warnings about missing
handling of the no-discard return value of QFile::open().