зеркало из https://github.com/mozilla/gecko-dev.git
fixed bug 28254 -- restrictions on new folder dialog for UW Imap server plus provide choice for creating either folders-only or messages-only mail folder; r=putterman
This commit is contained in:
Родитель
862f1ae904
Коммит
51fed80933
|
@ -277,7 +277,8 @@ function GetNextNMessages(folder)
|
|||
dump("### nodeList is invalid\n");
|
||||
}
|
||||
|
||||
function CreateNewSubfolder(chromeWindowURL,windowTitle, preselectedMsgFolder)
|
||||
function CreateNewSubfolder(chromeWindowURL,windowTitle, preselectedMsgFolder,
|
||||
dualUseFolders)
|
||||
{
|
||||
var preselectedURI;
|
||||
|
||||
|
@ -294,6 +295,7 @@ function CreateNewSubfolder(chromeWindowURL,windowTitle, preselectedMsgFolder)
|
|||
"",
|
||||
"chrome,titlebar,modal",
|
||||
{preselectedURI:preselectedURI, title:windowTitle,
|
||||
dualUseFolders:dualUseFolders,
|
||||
okCallback:NewFolder});
|
||||
}
|
||||
|
||||
|
|
|
@ -384,8 +384,24 @@ function MsgNewFolder()
|
|||
{
|
||||
var windowTitle = Bundle.GetStringFromName("newFolderDialogTitle");
|
||||
var preselectedFolder = GetFirstSelectedMsgFolder();
|
||||
|
||||
CreateNewSubfolder("chrome://messenger/content/newFolderNameDialog.xul",windowTitle, preselectedFolder);
|
||||
var dualUseFolders = true;
|
||||
var server = null;
|
||||
if (preselectedFolder)
|
||||
{
|
||||
try {
|
||||
server = preselectedFolder.server;
|
||||
if (server)
|
||||
{
|
||||
var imapServer =
|
||||
server.QueryInterface(Components.interfaces.nsIImapIncomingServer);
|
||||
if (imapServer)
|
||||
dualUseFolders = imapServer.dualUseFolders;
|
||||
}
|
||||
} catch (e) {
|
||||
dump ("Exception: dualUseFolders = true\n");
|
||||
}
|
||||
}
|
||||
CreateNewSubfolder("chrome://messenger/content/newFolderNameDialog.xul",windowTitle, preselectedFolder, dualUseFolders);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
var okCallback = 0;
|
||||
var pickerID = null;
|
||||
var preselectedFolderURI = null;
|
||||
var dualUseFolders = true;
|
||||
var foldersOnly = 0;
|
||||
|
||||
function newFolderNameOnLoad(pickerDOMID)
|
||||
{
|
||||
|
@ -14,6 +16,8 @@ function newFolderNameOnLoad(pickerDOMID)
|
|||
// dump("title = " + window.arguments[0].title + "\n");
|
||||
top.window.title = window.arguments[0].title;
|
||||
}
|
||||
|
||||
dualUseFolders = window.arguments[0].dualUseFolders;
|
||||
|
||||
if ( window.arguments[0].okCallback ) {
|
||||
top.okCallback = window.arguments[0].okCallback;
|
||||
|
@ -35,6 +39,15 @@ function newFolderNameOnLoad(pickerDOMID)
|
|||
var picker = document.getElementById(pickerID);
|
||||
if(picker)
|
||||
MsgFolderPickerOnLoad(pickerID);
|
||||
if (!dualUseFolders)
|
||||
{
|
||||
var newFolderTypeBox = document.getElementById("newFolderTypeBox");
|
||||
if (newFolderTypeBox)
|
||||
{
|
||||
newFolderTypeBox.setAttribute("hidden", "false");
|
||||
window.sizeToContent();
|
||||
}
|
||||
}
|
||||
moveToAlertPosition();
|
||||
}
|
||||
|
||||
|
@ -44,11 +57,22 @@ function newFolderNameOKButtonCallback()
|
|||
{
|
||||
var name = document.getElementById("name").value;
|
||||
var picker = document.getElementById(pickerID);
|
||||
|
||||
var uri = picker.getAttribute("uri");
|
||||
|
||||
dump("uri,name in callback = " + uri + "," + name + "\n");
|
||||
top.okCallback(name, uri);
|
||||
// make sure we have a valid name and parent uri
|
||||
if (name.length <= 0 || uri.length <=0)
|
||||
return false;
|
||||
|
||||
//dump("uri,name in callback = " + uri + "," + name + "\n");
|
||||
|
||||
if (!dualUseFolders && foldersOnly && name.charAt(name.length-1) != "/")
|
||||
{
|
||||
top.okCallback(name + "/", uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
top.okCallback(name, uri);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -124,3 +148,13 @@ function renameFolderNameCancelButtonCallback()
|
|||
dump("in renameFolderNameCancelButtonCallback\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
function onFoldersOnly()
|
||||
{
|
||||
foldersOnly = 1;
|
||||
}
|
||||
|
||||
function onMessagesOnly()
|
||||
{
|
||||
foldersOnly = 0;
|
||||
}
|
||||
|
|
|
@ -48,8 +48,19 @@ Rights Reserved.
|
|||
<text value="&newDialogDescription.label;"/>
|
||||
<box align="horizontal">
|
||||
<menu id="msgNewFolderPicker"/>
|
||||
<spring flex="100%"/>
|
||||
</box>
|
||||
<spring flex="100%"/>
|
||||
</box>
|
||||
<box align="vertical" orient="vertical" hidden="true" id="newFolderTypeBox">
|
||||
<separator class="thin"/>
|
||||
<text value="&folderRestriction1.label;"/>
|
||||
<text value="&folderRestriction2.label;"/>
|
||||
<separator class="thin"/>
|
||||
<radiogroup id="folderGroup">
|
||||
<radio group="folderGroup" oncommand="onFoldersOnly();" value="&foldersOnly.label;"/>
|
||||
<radio group="folderGroup" oncommand="onMessagesOnly();" value="&messagesOnly.label;" checked="true"/>
|
||||
<spring flex="100%"/>
|
||||
</radiogroup>
|
||||
</box>
|
||||
<spring flex="100%"/>
|
||||
<separator/>
|
||||
<box id="okCancelButtons"/>
|
||||
|
|
|
@ -22,3 +22,7 @@ Rights Reserved.
|
|||
<!ENTITY name.label "Name:">
|
||||
<!ENTITY rename.label "Enter the new name for your folder:">
|
||||
<!ENTITY newDialogDescription.label "Create as a subfolder of:">
|
||||
<!ENTITY folderRestriction1.label "This server restricts folders to two special kinds.">
|
||||
<!ENTITY folderRestriction2.label "Allow your new folder to contain:">
|
||||
<!ENTITY foldersOnly.label "Folders Only">
|
||||
<!ENTITY messagesOnly.label "Messages Only">
|
||||
|
|
|
@ -1133,6 +1133,20 @@ nsImapMailFolder::GetCanCreateSubfolders(PRBool *aResult)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = !(mFlags & MSG_FOLDER_FLAG_IMAP_NOINFERIORS);
|
||||
|
||||
PRBool isServer = PR_FALSE;
|
||||
GetIsServer(&isServer);
|
||||
if (!isServer)
|
||||
{
|
||||
nsCOMPtr<nsIImapIncomingServer> imapServer;
|
||||
nsresult rv = GetImapIncomingServer(getter_AddRefs(imapServer));
|
||||
PRBool dualUseFolders = PR_TRUE;
|
||||
if (NS_SUCCEEDED(rv) && imapServer)
|
||||
imapServer->GetDualUseFolders(&dualUseFolders);
|
||||
if (!dualUseFolders && *aResult)
|
||||
*aResult = (mFlags & MSG_FOLDER_FLAG_IMAP_NOSELECT);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -697,8 +697,6 @@ nsresult nsPop3Protocol::LoadUrl(nsIURI* aURL, nsISupports * /* aConsumer */)
|
|||
server->SetServerBusy(PR_TRUE); // the server is now busy
|
||||
}
|
||||
|
||||
m_pop3ConData->uidlinfo = net_pop3_load_state(host, GetUsername(), mailDirectory);
|
||||
|
||||
m_pop3ConData->uidlinfo = net_pop3_load_state(host, GetUsername(), mailDirectory);
|
||||
m_pop3ConData->biffstate = nsIMsgFolder::nsMsgBiffState_NoMail;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче