Implemented the preferencesChanged event