Bug 1617449 - Make the "Remove Account" dialog in-content. r=mkmelin

This commit is contained in:
Richard Marti 2020-02-24 12:44:26 +02:00
Родитель 1df3128698
Коммит 60b9c24fe0
3 изменённых файлов: 30 добавлений и 26 удалений

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

@ -28,6 +28,7 @@
/* import-globals-from accountUtils.js */
/* import-globals-from am-prefs.js */
/* import-globals-from amUtils.js */
/* globals gSubDialog */
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { BrowserUtils } = ChromeUtils.import(
@ -918,32 +919,34 @@ function onRemoveAccount(event) {
result: false,
};
window.docShell.rootTreeItem.domWindow.openDialog(
let onCloseDialog = function() {
// If result is true, the account was removed.
if (!removeArgs.result) {
return;
}
// clear cached data out of the account array
currentAccount = currentPageId = null;
if (serverId in accountArray) {
delete accountArray[serverId];
}
if (serverIndex >= 0 && serverIndex < serverList.length) {
selectServer(serverList[serverIndex], null);
}
// Either the default account was deleted so there is a new one
// or the default account was not changed. Either way, there is
// no need to unmark the old one.
markDefaultServer(MailServices.accounts.defaultAccount, null);
};
gSubDialog.open(
"chrome://messenger/content/removeAccount.xhtml",
"removeAccount",
"chrome,titlebar,modal,centerscreen,resizable=no",
removeArgs
"resizable=no",
removeArgs,
onCloseDialog
);
// If result is true, the account was removed.
if (!removeArgs.result) {
return;
}
// clear cached data out of the account array
currentAccount = currentPageId = null;
if (serverId in accountArray) {
delete accountArray[serverId];
}
if (serverIndex >= 0 && serverIndex < serverList.length) {
selectServer(serverList[serverIndex], null);
}
// Either the default account was deleted so there is a new one
// or the default account was not changed. Either way, there is
// no need to unmark the old one.
markDefaultServer(MailServices.accounts.defaultAccount, null);
}
function saveAccount(accountValues, account) {

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

@ -83,6 +83,7 @@ function openLocalDirectory() {
}
function showInfo() {
let removeAccountBox = document.getElementById("removeAccountBox");
let descs = document.querySelectorAll("vbox.indent");
for (let desc of descs) {
desc.collapsed = false;
@ -97,7 +98,7 @@ function showInfo() {
document.getElementById("localAccount").collapsed = false;
}
window.sizeToContent();
window.resizeBy(0, removeAccountBox.getBoundingClientRect().height);
gDialog.getButton("disclosure").disabled = true;
gDialog.getButton("disclosure").blur();
}

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

@ -50,7 +50,7 @@
accesskey="&removeData.accesskey;"
accesskeyChat="&removeDataChat.accesskey;"
oncommand="enableRemove();"/>
<vbox class="indent" collapsed="true">
<vbox id="removeAccountBox" class="indent" collapsed="true">
<description id="localAccount" collapsed="true">
&removeDataLocalAccount.desc;
</description>