cmake: Use Qt 5 only with WITH_QT5=TRUE
Fixes for external editor management

Set correct write permission to temporary file on Windows.

Read content of file properly, i.e. close QTemporaryFile and create new
QFile to read content.

Fix build with cmake.