[Dialog] Don't alter mainItem's visibility
The item's visible property is independent of the window visibility, which can be checked using Window.visible.
Differential Revision: https://phabricator.kde.org/D17543