Checking in stuff I have for widgetglue.js (to know that I'm checkin into the right branch :) )

This commit is contained in:
hwaara%chello.se 2001-04-10 21:11:43 +00:00
Родитель 7504a0e711
Коммит ca4a94cbb1
1 изменённых файлов: 28 добавлений и 39 удалений

Просмотреть файл

@ -29,6 +29,7 @@
//NOTE: gMessengerBundle must be defined and set or this Overlay won't work //NOTE: gMessengerBundle must be defined and set or this Overlay won't work
/* not used
function ConvertDOMListToResourceArray(nodeList) function ConvertDOMListToResourceArray(nodeList)
{ {
var result = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray); var result = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
@ -39,36 +40,24 @@ function ConvertDOMListToResourceArray(nodeList)
return result; return result;
} }
*/
function GetSelectedFolderURI() function GetSelectedFolderURI()
{ {
dump('In GetSelectedFolderURI\n');
var uri = null; var uri = null;
var selectedFolder = null;
try { var folderOutliner = GetFolderOutliner();
var folderTree = GetFolderTree(); var startRange = {value: 0};
var selectedFolderList = folderTree.selectedItems; var endRange = {value: 0};
folderOutliner.outlinerBoxObject.selection.getRangeAt(0, startRange, endRange);
// you can only select one folder / server to add new folder / subscribe to // you can only select one folder / server to add new folder / subscribe to
if (selectedFolderList.length == 1) { if (startRange.value >= 0 && startRange.value == endRange.value)
selectedFolder = selectedFolderList[0]; {
} var resource = GetFolderResource(startRange.value);
else { if (resource)
//dump("number of selected folder was " + selectedFolderList.length + "\n"); uri = resource.Value;
}
}
catch (ex) {
// dump("failed to get the selected folder\n");
uri = null;
}
try {
if (selectedFolder) {
uri = selectedFolder.getAttribute('id');
// dump("folder to preselect: " + preselectedURI + "\n");
}
}
catch (ex) {
uri = null;
} }
return uri; return uri;
@ -78,9 +67,9 @@ function GetSelectedFolderURI()
function MsgRenameFolder() function MsgRenameFolder()
{ {
var preselectedURI = GetSelectedFolderURI(); var preselectedURI = GetSelectedFolderURI();
var folderTree = GetFolderTree(); var folderOutliner = GetFolderOutliner();
var name = GetFolderNameFromUri(preselectedURI, folderTree); var name = GetFolderNameFromUri(preselectedURI, folderOutliner);
dump("preselectedURI = " + preselectedURI + "\n"); dump("preselectedURI = " + preselectedURI + "\n");
var dialog = window.openDialog( var dialog = window.openDialog(
@ -94,8 +83,8 @@ function MsgRenameFolder()
function RenameFolder(name,uri) function RenameFolder(name,uri)
{ {
dump("uri,name = " + uri + "," + name + "\n"); dump("uri,name = " + uri + "," + name + "\n");
var folderTree = GetFolderTree(); var folderOutliner = GetFolderOutliner();
if (folderTree) if (folderOutliner)
{ {
if (uri && (uri != "") && name && (name != "")) { if (uri && (uri != "") && name && (name != "")) {
var selectedFolder = GetResourceFromUri(uri); var selectedFolder = GetResourceFromUri(uri);
@ -111,14 +100,14 @@ function RenameFolder(name,uri)
ClearThreadPane(); ClearThreadPane();
ClearMessagePane(); ClearMessagePane();
folderTree.clearItemSelection(); folderOutliner.outlinerBoxObject.selection.clearSelection();
} }
else { else {
dump("no name or nothing selected\n"); dump("no name or nothing selected\n");
} }
} }
else { else {
dump("no folder tree\n"); dump("no folder outliner\n");
} }
} }
@ -228,9 +217,9 @@ function MsgCompactFolder(isAll)
function MsgFolderProperties() function MsgFolderProperties()
{ {
var preselectedURI = GetSelectedFolderURI(); var preselectedURI = GetSelectedFolderURI();
var folderTree = GetFolderTree(); var folderOutliner = GetFolderOutliner();
var name = GetFolderNameFromUri(preselectedURI, folderTree); var name = GetFolderNameFromUri(preselectedURI, folderOutliner);
dump("preselectedURI = " + preselectedURI + "\n"); dump("preselectedURI = " + preselectedURI + "\n");
var windowTitle = gMessengerBundle.getString("folderProperties"); var windowTitle = gMessengerBundle.getString("folderProperties");
@ -308,8 +297,8 @@ function LastToClose()
function MsgSetFolderCharset() function MsgSetFolderCharset()
{ {
var preselectedURI = GetSelectedFolderURI(); var preselectedURI = GetSelectedFolderURI();
var folderTree = GetFolderTree(); var folderOutliner = GetFolderOutliner();
var name = GetFolderNameFromUri(preselectedURI, folderTree); var name = GetFolderNameFromUri(preselectedURI, folderOutliner);
var windowTitle = gMessengerBundle.getString("folderProperties"); var windowTitle = gMessengerBundle.getString("folderProperties");
var dialog = window.openDialog( var dialog = window.openDialog(
"chrome://messenger/content/imapFolderProps.xul", "chrome://messenger/content/imapFolderProps.xul",