Bug 293141 Fix "Copy" filter action UI issues r+a=shaver sr=bienvenu

This commit is contained in:
neil%parkwaycc.co.uk 2005-05-06 16:42:29 +00:00
parent d1574edf45
commit 987ae6bf26
2 changed files with 18 additions and 13 deletions

View File

@ -48,6 +48,7 @@ var gFilter;
var gFilterList; var gFilterList;
var gFilterNameElement; var gFilterNameElement;
var gActionTargetElement; var gActionTargetElement;
var gActionTargetMoveElement;
var gActionTargetCopyElement; var gActionTargetCopyElement;
var gActionValueDeck; var gActionValueDeck;
var gActionPriority; var gActionPriority;
@ -261,7 +262,7 @@ function setLabelAttributes(labelID, menuItemID)
function initializeFilterWidgets() function initializeFilterWidgets()
{ {
gFilterNameElement = document.getElementById("filterName"); gFilterNameElement = document.getElementById("filterName");
gActionTargetElement = document.getElementById("actionTargetFolder"); gActionTargetMoveElement = document.getElementById("actionTargetFolder");
gActionTargetCopyElement = document.getElementById("actionTargetFolder2"); gActionTargetCopyElement = document.getElementById("actionTargetFolder2");
gActionValueDeck = document.getElementById("actionValueDeck"); gActionValueDeck = document.getElementById("actionValueDeck");
gActionPriority = document.getElementById("actionValuePriority"); gActionPriority = document.getElementById("actionValuePriority");
@ -297,7 +298,7 @@ function initializeDialog(filter)
gMoveToFolderCheckbox.checked = true; gMoveToFolderCheckbox.checked = true;
var target = filterAction.targetFolderUri; var target = filterAction.targetFolderUri;
if (target) if (target)
SetFolderPicker(target, gActionTargetElement.id); SetFolderPicker(target, gActionTargetMoveElement.id);
} }
else if (filterAction.type == nsMsgFilterAction.CopyToFolder) else if (filterAction.type == nsMsgFilterAction.CopyToFolder)
{ {
@ -436,8 +437,8 @@ function saveFilter()
if (gMoveToFolderCheckbox.checked) if (gMoveToFolderCheckbox.checked)
{ {
if (gActionTargetElement) if (gActionTargetMoveElement)
targetUri = gActionTargetElement.getAttribute("uri"); targetUri = gActionTargetMoveElement.getAttribute("uri");
if (!targetUri || targetUri == "") if (!targetUri || targetUri == "")
{ {
if (gPromptService) if (gPromptService)
@ -678,12 +679,14 @@ function showLabelColorFor(menuitem)
function GetFirstSelectedMsgFolder() function GetFirstSelectedMsgFolder()
{ {
var selectedFolder = gActionTargetElement.getAttribute("uri"); var selectedFolder = gActionTargetElement.getAttribute("uri");
if (!selectedFolder)
return null;
var msgFolder = GetMsgFolderFromUri(selectedFolder, true); var msgFolder = GetMsgFolderFromUri(selectedFolder, true);
return msgFolder; return msgFolder;
} }
function SearchNewFolderOkCallback(name,uri,targetid) function SearchNewFolderOkCallback(name, uri)
{ {
var msgFolder = GetMsgFolderFromUri(uri, true); var msgFolder = GetMsgFolderFromUri(uri, true);
var imapFolder = null; var imapFolder = null;
@ -719,7 +722,7 @@ function SearchNewFolderOkCallback(name,uri,targetid)
if (!imapFolder) if (!imapFolder)
{ {
var curFolder = uri+"/"+encodeURIComponent(name); var curFolder = uri+"/"+encodeURIComponent(name);
SetFolderPicker(curFolder, targetid); SetFolderPicker(curFolder, gActionTargetElement.id);
} }
} }

View File

@ -106,22 +106,24 @@
</listcell> </listcell>
<listcell> <listcell>
<button id="newFolderButton" enablefornews="false" label="&newFolderButton.label;" <button id="newFolderButton" enablefornews="false" label="&newFolderButton.label;"
accesskey="&newFolderButton.accesskey;" accesskey="&newFolderButton.accesskey;"
oncommand="MsgNewFolder(function (name,uri){ SearchNewFolderOkCallback(name,uri,'actionTargetFolder'); } )"/> oncommand="gActionTargetElement = gActionTargetMoveElement;
MsgNewFolder(SearchNewFolderOkCallback);"/>
</listcell> </listcell>
</listitem> </listitem>
<listitem allowevents="true"> <listitem allowevents="true">
<listcell> <listcell>
<checkbox id="copyToFolder" enablefornews="false" label="&copyToFolder.label;"/> <checkbox id="copyToFolder" label="&copyToFolder.label;"/>
</listcell> </listcell>
<listcell> <listcell>
<menulist id="actionTargetFolder2" enablefornews="false" flex="1"/> <menulist id="actionTargetFolder2" flex="1"/>
</listcell> </listcell>
<listcell> <listcell>
<button id="copyNewFolderButton" enablefornews="false" label="&newFolderButton.label;" <button id="copyNewFolderButton" label="&newFolderButton.label;"
accesskey="&newFolderButton.accesskey;" accesskey="&newFolderButton.accesskey;"
oncommand="MsgNewFolder(function (name,uri){ SearchNewFolderOkCallback(name,uri,'actionTargetFolder2'); } )"/> oncommand="gActionTargetElement = gActionTargetCopyElement;
MsgNewFolder(SearchNewFolderOkCallback);"/>
</listcell> </listcell>
</listitem> </listitem>