Different layout for dialog title in 2.x versus 4.x

Centralize the code which sets the custom dialog title