Use file path as working directory for Save As

I've changed the behavior so that if user runs save as action on the existing file, save dialog should point to the folder containing that file. If file is new, home folder is used as a base folder for the dialog. fixes #1044