reshuffle the code for clarity
reshuffle the code for clarity

less spaghetti, less nesting

Change-Id: Ib60214e23e20c9592f4eba362ea7a55fe92d8805
Reviewed-by: hjk <f81b91af79013637d070c18d38a75b90eaae8ba3@nokiamail.com>

mer-qt/qttools,mer-qt/qttools,mer-qt/qttools,mer-qt/qttools,mer-qt/qttools,mer-qt/qttools