Merge changes Ib2cc8d90,I6f2751b3 into tm-qpr-dev

* changes:
  Only bring desktop app to front when necessary
  Sort tasks by Z-order instead of lastActiveTime