X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/ee06f37b0f6f6d94cd05a6ffae556660f7c4a2bc..c930e9176a5a85509c5b0230e2bff5c22a591432:/air/src/FileProvider.js diff --git a/air/src/FileProvider.js b/air/src/FileProvider.js deleted file mode 100644 index 25008244..00000000 --- a/air/src/FileProvider.js +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Ext JS Library 0.30 - * Copyright(c) 2006-2009, Ext JS, LLC. - * licensing@extjs.com - * - * http://extjs.com/license - */ - -/** - * @class Ext.air.FileProvider - * @extends Ext.state.Provider - * - * An Ext state provider implementation for Adobe AIR that stores state in the application - * storage directory. - * - * @constructor - * @param {Object} config - */ -Ext.air.FileProvider = function(config){ - Ext.air.FileProvider.superclass.constructor.call(this); - - this.defaultState = { - mainWindow : { - width:780, - height:580, - x:10, - y:10 - } - }; - - Ext.apply(this, config); - this.state = this.readState(); - - var provider = this; - air.NativeApplication.nativeApplication.addEventListener('exiting', function(){ - provider.saveState(); - }); -}; - -Ext.extend(Ext.air.FileProvider, Ext.state.Provider, { - /** - * @cfg {String} file - * The file name to use for the state file in the application storage directory - */ - file: 'extstate.data', - - /** - * @cfg {Object} defaultState - * The default state if no state file can be found - */ - // private - readState : function(){ - var stateFile = air.File.applicationStorageDirectory.resolvePath(this.file); - if(!stateFile.exists){ - return this.defaultState || {}; - } - - var stream = new air.FileStream(); - stream.open(stateFile, air.FileMode.READ); - - var stateData = stream.readObject(); - stream.close(); - - return stateData || this.defaultState || {}; - }, - - // private - saveState : function(name, value){ - var stateFile = air.File.applicationStorageDirectory.resolvePath(this.file); - var stream = new air.FileStream(); - stream.open(stateFile, air.FileMode.WRITE); - stream.writeObject(this.state); - stream.close(); - } -}); \ No newline at end of file