Subversion Repositories general

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1422 dev 1
var EXPORTED_SYMBOLS = ["NoModal_DialogParams"];
2
 
3
// =====================================================================================================================
4
var NoModal_DialogParams = {
5
	MAX_VALUES: 8,
6
 
7
	// -----------------------------------------------------------------------------------------------------------------
8
	create: function()
9
	{
10
		return Components.classes["@mozilla.org/embedcomp/dialogparam;1"]
11
			.createInstance(Components.interfaces.nsIDialogParamBlock);
12
	},
13
 
14
	// -----------------------------------------------------------------------------------------------------------------
15
	encode: function(obj, params)
16
	{
17
		params.QueryInterface(Components.interfaces.nsIDialogParamBlock);
18
 
19
		var i = 0;
20
		for(var a in obj) {
21
			params.SetString(i++, a);
22
			params.SetString(i++, obj[a]);
23
		}
24
 
25
		for(; i < NoModal_DialogParams.MAX_VALUES * 2; ++i) {
26
			params.SetString(i, null);
27
		}
28
	},
29
 
30
	// -----------------------------------------------------------------------------------------------------------------
31
	decode: function(params, obj)
32
	{
33
		params.QueryInterface(Components.interfaces.nsIDialogParamBlock);
34
 
35
		for(var i = 0; i < NoModal_DialogParams.MAX_VALUES; ++i) {
36
			var k = params.GetString(i*2);
37
			var v = params.GetString(i*2+1);
38
 
39
			if(k != "") obj[k] = v;
40
		}
41
	},
42
}