use app[appname].setState if available to allow app to overwrite it (eg. change to non-listview in calendar)

This commit is contained in:
Ralf Becker 2014-03-04 17:00:27 +00:00
parent c6e891952b
commit 3e13b3f77b

View File

@ -179,7 +179,7 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader],
var stored_filters = { var stored_filters = {
'blank': { 'blank': {
name: this.egw().lang("No filters"), name: this.egw().lang("No filters"),
state: {}, state: {}
} }
}; };
@ -194,7 +194,7 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader],
// Keep older favorites working - they used to store nm filters in 'filters',not state // Keep older favorites working - they used to store nm filters in 'filters',not state
if(preferences[pref_name].filters) if(preferences[pref_name].filters)
{ {
stored_filters[pref_name].state = preferences[pref_name].filters stored_filters[pref_name].state = preferences[pref_name].filters;
} }
} }
} }
@ -250,9 +250,17 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader],
onclick: function(node) { onclick: function(node) {
// Apply preferred filter - make sure it's an object, and not a reference // Apply preferred filter - make sure it's an object, and not a reference
if(this.preferred && this.stored_filters[this.preferred]) if(this.preferred && this.stored_filters[this.preferred])
{
// use app[appname].setState if available to allow app to overwrite it (eg. change to non-listview in calendar)
if (typeof app[this.options.app] != 'undefined')
{
app[this.options.app].setState(this.stored_filters[this.preferred]);
}
else
{ {
this.set_nm_filters(jQuery.extend({},this.stored_filters[this.preferred].state)); this.set_nm_filters(jQuery.extend({},this.stored_filters[this.preferred].state));
} }
}
else else
{ {
alert(this.egw().lang("No default set")); alert(this.egw().lang("No default set"));
@ -317,6 +325,8 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader],
/** /**
* Set the nextmatch to filter * Set the nextmatch to filter
* From et2_INextmatchHeader interface * From et2_INextmatchHeader interface
*
* @param {et2_nextmatch} nextmatch
*/ */
setNextmatch: function(nextmatch) setNextmatch: function(nextmatch)
{ {