Fixed build problems on MacOS. Thanks to Greg.

Cherry-picked Martin's commit that has my patch for building on MacOS. This is the minimum needed to compile (because of the missing NO_DBUS) on any environment that lacks QtDBus adapters.