Ripped parts of app framework for oC5
Backport simplified import to stable5. Fix owncloud/contacts#125