Fix leaked print dialogues, Qt 4.7 compatibility