connected preview button to viewPreview method