This is a duplication of the functionality in NavigationHandler::loadFile(), also already slightly different (one does update the canvas, the other does not). Make only one function loadFile(const QString &filename) and let both ways of selecting a file in the end call that same function.