Bug 1615417 - Implement the subdialogs in Account Manager. r=mkmelin DONTBUILD

This commit is contained in:
Richard Marti 2020-02-19 12:36:42 +02:00
Родитель 03afe1aad4
Коммит 6e3eab6ebb
21 изменённых файлов: 240 добавлений и 234 удалений

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

@ -10,7 +10,7 @@ const { Localization } = ChromeUtils.import(
const syncL10n = new Localization(["messenger/otr/finger.ftl"], true);
var [account] = window.arguments;
var [account] = window.arguments.account;
var gFingers;
var fingerTreeView = {

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

@ -139,11 +139,11 @@ var account = {
},
viewFingerprintKeys() {
window.docShell.rootTreeItem.domWindow.openDialog(
let otrAccount = { account: this.account };
parent.gSubDialog.open(
"chrome://chat/content/otr-finger.xhtml",
"",
"chrome,modal,titlebar,centerscreen",
this.account
null,
otrAccount
);
},
};

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

@ -5,6 +5,7 @@
<!-- extracted from AccountManager.xhtml -->
<!ENTITY accountManagerTitle.label "Account Settings">
<!ENTITY accountManagerCloseButton.label "Close">
<!ENTITY accountActionsButton.label "Account Actions">
<!ENTITY accountActionsButton.accesskey "A">

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

@ -5,7 +5,6 @@
<!-- LOCALIZATION NOTE (identityDialog.style): This value should be roughly
equal to the value of accountManager.size entity minus the value
of accountTree.width entity. -->
<!ENTITY identityDialog.style "min-width: 75ch;">
<!ENTITY identityListDesc.label "Configure the settings for this identity:">
<!ENTITY settingsTab.label "Settings">

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

@ -117,7 +117,7 @@ function subtest_initial_state(identity) {
"chrome://messenger/content/am-archiveoptions.xhtml",
"",
"centerscreen,chrome,modal,titlebar,resizable=yes",
identity
{ identity }
);
wait_for_modal_dialog("Mailnews:archiveOptions");
}
@ -143,7 +143,7 @@ function subtest_save_state(identity, granularity, kfs) {
"chrome://messenger/content/am-archiveoptions.xhtml",
"",
"centerscreen,chrome,modal,titlebar,resizable=yes",
identity
{ identity }
);
wait_for_modal_dialog("Mailnews:archiveOptions");
}

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

@ -20,6 +20,10 @@ fieldset {
padding: initial;
}
fieldset:last-of-type {
margin-bottom: 0;
}
#accountTreeBox {
margin-block: 28px;
margin-inline: 28px 3px;

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

@ -11,7 +11,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"
title="&accountManagerTitle.label;"
persist="width height screenX screenY"
onload="onLoad(event);"
onload="onLoad(event); gSubDialog.init();"
onunload="onUnload();">
<stringbundle id="bundle_brand" src="chrome://branding/locale/brand.properties"/>
<stringbundle id="bundle_prefs" src="chrome://messenger/locale/prefs.properties"/>
@ -22,7 +22,9 @@
<script src="chrome://messenger/content/am-help.js"/>
#endif
<script src="chrome://messenger/content/amUtils.js"/>
<script src="chrome://messenger/content/preferences/subdialogs.js"/>
<stack id="preferences-stack" flex="1">
<hbox flex="1">
<vbox id="accountTreeBox" style="&accountTree.width;">
<tree flex="1" onselect="onAccountTreeSelect(null, null);" id="accounttree"
@ -84,7 +86,28 @@
accesskey="&removeButton.accesskey;"/>
#endif
</vbox>
<iframe id="contentFrame" name="contentFrame" flex="1"/>
</hbox>
<stack id="dialogStack" hidden="true"/>
<vbox id="dialogTemplate"
class="dialogOverlay"
align="center"
pack="center"
topmost="true"
hidden="true">
<vbox class="dialogBox"
pack="end"
role="dialog"
aria-labelledby="dialogTitle">
<hbox class="dialogTitleBar" align="center">
<label class="dialogTitle" flex="1"/>
<button class="dialogClose close-icon"
aria-label="&accountManagerCloseButton.label;"/>
</hbox>
<browser class="dialogFrame"
autoscroll="false"
disablehistory="true"/>
</vbox>
</vbox>
</stack>
</window>

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

@ -22,11 +22,8 @@ function onInitCompositionAndAddressing() {
}
function onEditDirectories() {
window.docShell.rootTreeItem.domWindow.openDialog(
"chrome://messenger/content/addressbook/pref-editdirectories.xhtml",
"editDirectories",
"chrome,modal=yes,resizable=no",
null
parent.gSubDialog.open(
"chrome://messenger/content/addressbook/pref-editdirectories.xhtml"
);
}

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

@ -13,7 +13,7 @@ document.addEventListener("dialogaccept", onAcceptArchiveOptions);
*/
function onLoadArchiveOptions() {
// extract the account
gIdentity = window.arguments[0];
gIdentity = window.arguments[0].identity;
let granularity = document.getElementById("archiveGranularity");
granularity.selectedIndex = gIdentity.archiveGranularity;

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

@ -530,12 +530,11 @@ function setupArchiveItems() {
*/
function ChangeArchiveHierarchy() {
let identity = parent.gIdentity || parent.getCurrentAccount().defaultIdentity;
let arg = { identity };
window.docShell.rootTreeItem.domWindow.window.openDialog(
parent.gSubDialog.open(
"chrome://messenger/content/am-archiveoptions.xhtml",
"",
"centerscreen,chrome,modal,titlebar,resizable=yes",
identity
null,
arg
);
return true;
}

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

@ -86,15 +86,17 @@ function openIdentityEditor(identity) {
? gIdentityListBox.selectedIndex
: gIdentityListBox.itemCount;
window.docShell.rootTreeItem.domWindow.openDialog(
"am-identity-edit.xhtml",
"",
"chrome,modal,resizable,centerscreen",
args
parent.gSubDialog.open(
"chrome://messenger/content/am-identity-edit.xhtml",
null,
args,
onCloseIdentity
);
if (args.result) {
refreshIdentityList(indexToSelect);
function onCloseIdentity() {
if (args.result) {
refreshIdentityList(indexToSelect);
}
}
}

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

@ -430,18 +430,18 @@ function editVCardCallback(escapedVCardStr) {
function editVCard() {
var escapedVCard = document.getElementById("identity.escapedVCard");
let args = {
escapedVCardStr: escapedVCard.value,
okCallback: editVCardCallback,
titleProperty: "editVCardTitle",
hideABPicker: true,
};
// read vCard hidden value from UI
window.docShell.rootTreeItem.domWindow.openDialog(
parent.gSubDialog.open(
"chrome://messenger/content/addressbook/abNewCardDialog.xhtml",
"",
"chrome,modal,resizable=no,centerscreen",
{
escapedVCardStr: escapedVCard.value,
okCallback: editVCardCallback,
titleProperty: "editVCardTitle",
hideABPicker: true,
}
"resizable=no",
args
);
}
@ -496,9 +496,12 @@ function editCurrentSMTP() {
smtpKey === ""
? MailServices.smtp.defaultServer
: MailServices.smtp.getServerByKey(smtpKey);
let args = { server, result: false, addSmtpServer: "" };
let args = editSMTPServer(server);
if (args.result) {
loadSMTPServerList();
}
parent.gSubDialog.open(
"chrome://messenger/content/SmtpServerEdit.xhtml",
null,
args,
loadSMTPServerList
);
}

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

@ -23,7 +23,7 @@
<window xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="onLoadIdentityProperties();"
style="&identityDialog.style;">
style="width: 75ch; height: 56em;">
<dialog id="identityDialog">
<stringbundle id="bundle_prefs"
src="chrome://messenger/locale/prefs.properties"/>
@ -192,6 +192,7 @@
<hbox align="center" class="input-container">
<label id="identity.input.label" value="&identityAlias.label;"
accesskey="&identityAlias.accesskey;"
style="margin-block: auto;"
control="identity.label"/>
<html:input id="identity.label"
type="text"
@ -200,7 +201,6 @@
</hbox>
</html:fieldset>
<spacer flex="1"/>
</vbox>
<!-- Copies & Folders Tab -->

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

@ -48,20 +48,21 @@ function manageIdentities() {
var identity = gAccount.defaultIdentity;
saveIdentitySettings(identity);
window.docShell.rootTreeItem.domWindow.openDialog(
"am-identities-list.xhtml",
"",
"chrome,modal,resizable=no,centerscreen",
args
parent.gSubDialog.open(
"chrome://messenger/content/am-identities-list.xhtml",
null,
args,
onCloseIdentities
);
if (args.result) {
// now re-initialize the default identity settings in case they changed
identity = gAccount.defaultIdentity; // Refetch the default identity in case it changed.
initIdentityValues(identity);
function onCloseIdentities() {
if (args.result) {
// now re-initialize the default identity settings in case they changed
identity = gAccount.defaultIdentity; // Refetch the default identity in case it changed.
initIdentityValues(identity);
// Refresh the SMTP list in case the user changed server properties
// from the identity dialog.
loadSMTPServerList();
}
}
// Refresh the SMTP list in case the user changed server properties
// from the identity dialog.
loadSMTPServerList();
}

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

@ -192,7 +192,5 @@
accesskey="&manageIdentities.accesskey;"
wsm_persist="true" id="identity.manageIdentitiesbutton"/>
</hbox>
<spacer flex="1"/>
</vbox>
</window>

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

@ -175,12 +175,9 @@ function onPreInit(account, accountValues) {
}
function onClickSelect() {
window.docShell.rootTreeItem.domWindow.window.openDialog(
"chrome://messenger/content/msgSelectOfflineFolders.xhtml",
"",
"centerscreen,chrome,modal,titlebar,resizable=yes"
parent.gSubDialog.open(
"chrome://messenger/content/msgSelectOfflineFolders.xhtml"
);
return true;
}
/**

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

@ -229,7 +229,6 @@ function onAdvanced() {
serverSettings.maximumConnectionsNumber = document
.getElementById("imap.maximumConnectionsNumber")
.getAttribute("value");
// string prefs
serverSettings.personalNamespace = document
.getElementById("imap.personalNamespace")
.getAttribute("value");
@ -254,148 +253,149 @@ function onAdvanced() {
.getAttribute("value");
}
window.docShell.rootTreeItem.domWindow.openDialog(
"chrome://messenger/content/am-server-advanced.xhtml",
"_blank",
"chrome,modal,titlebar",
serverSettings
);
if (serverType == "imap") {
document.getElementById("imap.dualUseFolders").checked =
serverSettings.dualUseFolders;
document.getElementById("imap.usingSubscription").checked =
serverSettings.usingSubscription;
document
.getElementById("imap.maximumConnectionsNumber")
.setAttribute("value", serverSettings.maximumConnectionsNumber);
// string prefs
document
.getElementById("imap.personalNamespace")
.setAttribute("value", serverSettings.personalNamespace);
document
.getElementById("imap.publicNamespace")
.setAttribute("value", serverSettings.publicNamespace);
document
.getElementById("imap.serverDirectory")
.setAttribute("value", serverSettings.serverDirectory);
document
.getElementById("imap.otherUsersNamespace")
.setAttribute("value", serverSettings.otherUsersNamespace);
document.getElementById("imap.overrideNamespaces").checked =
serverSettings.overrideNamespaces;
} else if (serverType == "pop3") {
document.getElementById("pop3.deferGetNewMail").checked =
serverSettings.deferGetNewMail;
document
.getElementById("pop3.deferredToAccount")
.setAttribute("value", serverSettings.deferredToAccount);
let pop3Server = gServer.QueryInterface(Ci.nsIPop3IncomingServer);
// we're explicitly setting this so we'll go through the SetDeferredToAccount method
pop3Server.deferredToAccount = serverSettings.deferredToAccount;
// Setting the server to be deferred causes a rebuild of the account tree,
// losing the current selection. Reselect the current server again as it
// didn't really disappear.
parent.selectServer(
parent.getCurrentAccount().incomingServer,
parent.currentPageId
);
// Iterate over all accounts to see if any of their junk targets are now
// invalid (pointed to the account that is now deferred).
// If any such target is found it is reset to a new safe folder
// (the deferred to account or Local Folders). If junk was really moved
// to that folder (moveOnSpam = true) then moving junk is disabled
// (so that the user notices it and checks the settings).
// This is the same sanitization as in am-junk.js, just applied to all POP accounts.
let deferredURI =
serverSettings.deferredToAccount &&
MailServices.accounts.getAccount(serverSettings.deferredToAccount)
.incomingServer.serverURI;
for (let account of fixIterator(
MailServices.accounts.accounts,
Ci.nsIMsgAccount
)) {
let accountValues = parent.getValueArrayFor(account);
let type = parent.getAccountValue(
account,
accountValues,
"server",
"type",
null,
false
let onCloseAdvanced = function() {
if (serverType == "imap") {
document.getElementById("imap.dualUseFolders").checked =
serverSettings.dualUseFolders;
document.getElementById("imap.usingSubscription").checked =
serverSettings.usingSubscription;
document
.getElementById("imap.maximumConnectionsNumber")
.setAttribute("value", serverSettings.maximumConnectionsNumber);
document
.getElementById("imap.personalNamespace")
.setAttribute("value", serverSettings.personalNamespace);
document
.getElementById("imap.publicNamespace")
.setAttribute("value", serverSettings.publicNamespace);
document
.getElementById("imap.serverDirectory")
.setAttribute("value", serverSettings.serverDirectory);
document
.getElementById("imap.otherUsersNamespace")
.setAttribute("value", serverSettings.otherUsersNamespace);
document.getElementById("imap.overrideNamespaces").checked =
serverSettings.overrideNamespaces;
} else if (serverType == "pop3") {
document.getElementById("pop3.deferGetNewMail").checked =
serverSettings.deferGetNewMail;
document
.getElementById("pop3.deferredToAccount")
.setAttribute("value", serverSettings.deferredToAccount);
let pop3Server = gServer.QueryInterface(Ci.nsIPop3IncomingServer);
// we're explicitly setting this so we'll go through the SetDeferredToAccount method
pop3Server.deferredToAccount = serverSettings.deferredToAccount;
// Setting the server to be deferred causes a rebuild of the account tree,
// losing the current selection. Reselect the current server again as it
// didn't really disappear.
parent.selectServer(
parent.getCurrentAccount().incomingServer,
parent.currentPageId
);
// Try to keep this list of account types not having Junk settings
// synchronized with the list in AccountManager.js.
if (type != "nntp" && type != "rss" && type != "im") {
let spamActionTargetAccount = parent.getAccountValue(
account,
accountValues,
"server",
"spamActionTargetAccount",
"string",
true
);
let spamActionTargetFolder = parent.getAccountValue(
account,
accountValues,
"server",
"spamActionTargetFolder",
"string",
true
);
let moveOnSpam = parent.getAccountValue(
account,
accountValues,
"server",
"moveOnSpam",
"bool",
true
);
// Check if there are any invalid junk targets and fix them.
[
spamActionTargetAccount,
spamActionTargetFolder,
moveOnSpam,
] = sanitizeJunkTargets(
spamActionTargetAccount,
spamActionTargetFolder,
deferredURI || account.incomingServer.serverURI,
parent.getAccountValue(
// Iterate over all accounts to see if any of their junk targets are now
// invalid (pointed to the account that is now deferred).
// If any such target is found it is reset to a new safe folder
// (the deferred to account or Local Folders). If junk was really moved
// to that folder (moveOnSpam = true) then moving junk is disabled
// (so that the user notices it and checks the settings).
// This is the same sanitization as in am-junk.js, just applied to all POP accounts.
let deferredURI =
serverSettings.deferredToAccount &&
MailServices.accounts.getAccount(serverSettings.deferredToAccount)
.incomingServer.serverURI;
for (let account of fixIterator(
MailServices.accounts.accounts,
Ci.nsIMsgAccount
)) {
let accountValues = parent.getValueArrayFor(account);
let type = parent.getAccountValue(
account,
accountValues,
"server",
"type",
null,
false
);
// Try to keep this list of account types not having Junk settings
// synchronized with the list in AccountManager.js.
if (type != "nntp" && type != "rss" && type != "im") {
let spamActionTargetAccount = parent.getAccountValue(
account,
accountValues,
"server",
"moveTargetMode",
"int",
"spamActionTargetAccount",
"string",
true
),
account.incomingServer.spamSettings,
moveOnSpam
);
);
let spamActionTargetFolder = parent.getAccountValue(
account,
accountValues,
"server",
"spamActionTargetFolder",
"string",
true
);
let moveOnSpam = parent.getAccountValue(
account,
accountValues,
"server",
"moveOnSpam",
"bool",
true
);
parent.setAccountValue(
accountValues,
"server",
"moveOnSpam",
moveOnSpam
);
parent.setAccountValue(
accountValues,
"server",
"spamActionTargetAccount",
spamActionTargetAccount
);
parent.setAccountValue(
accountValues,
"server",
"spamActionTargetFolder",
spamActionTargetFolder
);
// Check if there are any invalid junk targets and fix them.
[
spamActionTargetAccount,
spamActionTargetFolder,
moveOnSpam,
] = sanitizeJunkTargets(
spamActionTargetAccount,
spamActionTargetFolder,
deferredURI || account.incomingServer.serverURI,
parent.getAccountValue(
account,
accountValues,
"server",
"moveTargetMode",
"int",
true
),
account.incomingServer.spamSettings,
moveOnSpam
);
parent.setAccountValue(
accountValues,
"server",
"moveOnSpam",
moveOnSpam
);
parent.setAccountValue(
accountValues,
"server",
"spamActionTargetAccount",
spamActionTargetAccount
);
parent.setAccountValue(
accountValues,
"server",
"spamActionTargetFolder",
spamActionTargetFolder
);
}
}
}
}
};
parent.gSubDialog.open(
"chrome://messenger/content/am-server-advanced.xhtml",
null,
serverSettings,
onCloseAdvanced
);
}
function secureSelect(aLoading) {

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

@ -442,9 +442,9 @@
</html:fieldset>
<separator class="thin"/>
<hbox hidefor="imap,pop3,movemail" align="center" valign="middle" iscontrolcontainer="true">
<separator class="thin"/>
<label value="&serverDefaultCharset2.label;" control="nntp.charset"/>
<menulist is="menulist-charsetpicker-viewing" id="nntp.charset"
hidable="true"

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

@ -3,6 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* import-globals-from am-smtp.js */
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { MailServices } = ChromeUtils.import(
"resource:///modules/MailServices.jsm"
@ -258,11 +260,17 @@ function accountNameExists(aAccountName, aAccountKey) {
function editSMTPServer(aServer) {
let args = { server: aServer, result: false, addSmtpServer: "" };
window.docShell.rootTreeItem.domWindow.openDialog(
let onCloseSMTPDialog = function() {
if (args.result) {
gSmtpServerListWindow.refreshServerList(aServer, true);
}
};
parent.gSubDialog.open(
"chrome://messenger/content/SmtpServerEdit.xhtml",
"smtpEdit",
"chrome,titlebar,modal,centerscreen",
args
null,
args,
onCloseSMTPDialog
);
return args;

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

@ -157,10 +157,8 @@ function disableIfLocked(prefstrArray) {
* the global receipts settings can be found.
*/
function showGlobalReceipts() {
openPrefsFromAccountManager(
"paneAdvanced",
"readingAndDisplayCategory",
{ subdialog: "showReturnReceipts" },
"receipts_pane"
parent.gSubDialog.open(
"chrome://messenger/content/preferences/receipts.xhtml",
"resizable=no"
);
}

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

@ -488,35 +488,11 @@ function smimeClearCert(smime_cert) {
}
function openCertManager() {
// Check for an existing certManager window and focus it; it's not
// application modal.
let lastCertManager = Services.wm.getMostRecentWindow("mozilla:certmanager");
if (lastCertManager) {
lastCertManager.focus();
} else {
window.docShell.rootTreeItem.domWindow.openDialog(
"chrome://pippki/content/certManager.xhtml",
"",
"centerscreen,resizable=yes,dialog=no"
);
}
parent.gSubDialog.open("chrome://pippki/content/certManager.xhtml");
}
function openDeviceManager() {
// Check for an existing deviceManager window and focus it; it's not
// application modal.
let lastCertManager = Services.wm.getMostRecentWindow(
"mozilla:devicemanager"
);
if (lastCertManager) {
lastCertManager.focus();
} else {
window.docShell.rootTreeItem.domWindow.openDialog(
"chrome://pippki/content/device_manager.xhtml",
"",
"centerscreen,resizable=yes,dialog=no"
);
}
parent.gSubDialog.open("chrome://pippki/content/device_manager.xhtml");
}
function smimeOnLoadEditor() {