Fix the temporary filename template for an attachment

Currently a temporary filename is suffixed with an auto-generated random string due to lack of the `XXXXXX` part in `tmpFileTemplate`, which makes the OS unable to determine the application to open the file. (at least on OS X)

This patch makes QTemporaryFile prefix the temporary filename with a random string preserving the original suffix of an attachment to help the OS invoke the correct application associated with the file type.