Add optional leave-page confirmation (fixes #7).

By default, the user is prompted to confirm before
closing the page. This can be disabled.

(Note: Considered making this setting dependent on
connection and chatlist content, but that's overkill.)