Keep collapsed/expanded state of the files view

Made some delegate methods optional in TreeViewDelegate and ListViewDelegate.
Fixed #402: Keep expanded/collapsed state of tree nodes.