Added filehandling from kalpana

Somewhat generic, not dependent on PyQt.