source: DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/removeDialog.js @ 2711

Last change on this file since 2711 was 2711, checked in by olof, 11 years ago

moved to trunk

File size: 2.3 KB
Line 
1var removeDialog = {
2
3/////////////////////////////////////////////////////////////////////
4        get STRING()     { return document.getElementById("removeDialogString"); },
5        get DataSource() { return window.opener.top.bitsObjectMng.DataSource; },
6        get Common()     { return window.opener.top.bitsObjectMng.Common;     },
7        get XPath()      { return window.opener.top.bitsObjectMng.XPath;      },
8        get Database()   { return window.opener.top.bitsObjectMng.Database;   },
9        get gBrowser()   { return window.opener.top.bitsObjectMng.getBrowser();},
10
11        get DIALOG()     { return document.getElementById("removeDialog"); },
12        get LIST()       { return document.getElementById("removeList"); },
13
14/////////////////////////////////////////////////////////////////////
15        init : function(){
16                if(removeDialog._init) return;
17
18                try {
19                        this.info = window.arguments[0];
20
21                        if(this.info.title) document.title = this.info.title;
22
23                        this.LIST.suppressonselect = true;
24                        if(this.info.list){
25                                for(var i=0;i<this.info.list.length;i++){
26                                        this.LIST.appendItem(unescape(this.info.list[i].leafName) , this.Common.convertFilePathToURL(this.info.list[i].path));
27                                }
28                        }
29                        this.LIST.currentIndex = -1;
30                        this.LIST.clearSelection();
31                        this.LIST.suppressonselect = false;
32
33                        this._init = true;
34                }catch(ex){
35                        this.Common.alert("removeDialog.init():"+ex);
36                }
37        },
38
39/////////////////////////////////////////////////////////////////////
40        done : function(event){
41                if(this._init){
42                        this._init = false;
43                }
44        },
45
46/////////////////////////////////////////////////////////////////////
47        commandList : function(aEvent){
48                if(this.LIST.currentIndex>=0) this.DIALOG.removeAttribute("buttondisabledaccept");
49        },
50
51/////////////////////////////////////////////////////////////////////
52        accept : function(aEvent){
53                window.arguments[0].accept = true;
54                for(var i=this.LIST.selectedItems.length-1;i>=0;i--){
55                        var aFile = this.Common.convertURLToFile(this.LIST.selectedItems[i].value);
56                        if(aFile && aFile.exists()) aFile.remove(true);
57                }
58        },
59
60/////////////////////////////////////////////////////////////////////
61        cancel : function(aEvent){
62                window.arguments[0].accept = false;
63        },
64
65/////////////////////////////////////////////////////////////////////
66        _dump : function(aString){
67                if(nsPreferences.getBoolPref("wiredmarker.debug", false)) window.dump(aString+"\n");
68        },
69};
Note: See TracBrowser for help on using the repository browser.