Validate the dirty flag before saving preferences in each modules
Pressing apply button is applicable to all settings module, not only for the one that is visible. Unless we do a validation before we save preferences, other module can cause incorrect (old) preferences to be saved. Bug: 56885 Change-Id: I31df2ee0bf8b600a94e8fed1a784daf529186b16
This commit is contained in:
committed by
Nikerabbit
parent
037984a67f
commit
8b3d27a505
@@ -569,10 +569,18 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the apply button press
|
* Handle the apply button press.
|
||||||
|
* Note that the button press may not be from the input settings module.
|
||||||
|
* For example, a user can change input settings and then go to display settings panel,
|
||||||
|
* do some changes and press apply button there. That press is applicable for all
|
||||||
|
* modules.
|
||||||
*/
|
*/
|
||||||
apply: function () {
|
apply: function () {
|
||||||
var displaySettings = this;
|
var displaySettings = this;
|
||||||
|
if ( !displaySettings.dirty ) {
|
||||||
|
// No changes to save in this module.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Save the preferences
|
// Save the preferences
|
||||||
mw.webfonts.preferences.save( function ( result ) {
|
mw.webfonts.preferences.save( function ( result ) {
|
||||||
|
|||||||
@@ -500,7 +500,11 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the apply button press
|
* Handle the apply button press.
|
||||||
|
* Note that the button press may not be from the input settings module.
|
||||||
|
* For example, a user can change input settings and then go to display settings panel,
|
||||||
|
* do some changes and press apply button there. That press is applicable for all
|
||||||
|
* modules.
|
||||||
*/
|
*/
|
||||||
apply: function () {
|
apply: function () {
|
||||||
var previousIM,
|
var previousIM,
|
||||||
@@ -510,6 +514,11 @@
|
|||||||
currentLanguage = $.ime.preferences.getLanguage(),
|
currentLanguage = $.ime.preferences.getLanguage(),
|
||||||
currentIM = $.ime.preferences.getIM( currentLanguage );
|
currentIM = $.ime.preferences.getIM( currentLanguage );
|
||||||
|
|
||||||
|
if ( !inputSettings.dirty ) {
|
||||||
|
// No changes to save in this module.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( previousLanguage ) {
|
if ( previousLanguage ) {
|
||||||
previousIM = inputSettings.savedRegistry.imes[previousLanguage];
|
previousIM = inputSettings.savedRegistry.imes[previousLanguage];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user