[contactsd] Build with either Qt4 or Qt5

Tests are not working correctly in either case, and are only
partially ported.