Delete action now also works for folders.

Cleaned up dialog handling.