Fix minor usability bugs

Elements for add dialog are sorted only once in the beginning now to
avoid trouble with indices later.

Fixed focus control bugs when opening and closing dialogs.

Change-Id: Ibf0b9afd440c2beebb0775b85171f00f4913f7be
Signed-off-by: Denis Knoepfle <denis.knoepfle@sap.com>
Merge pull request #85 from DenisKnoepfle/master

Fix minor usability bugs