Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1

This commit is contained in:
Matt A. Tobin 2019-11-03 00:17:46 -04:00 • committed by Roy Tam
commit e400f4130a
1564 changed files with 510348 additions and 0 deletions

View file

@ -0,0 +1,186 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
var importService;
var fieldMap = null;
var recordNum = 0;
var addInterface = null;
var dialogResult = null;
var gPreviousButton;
var gNextButton;
var gMoveUpButton;
var gMoveDownButton;
var gListbox;
var gSkipFirstRecordButton;
function OnLoadFieldMapImport()
{
top.importService = Components.classes["@mozilla.org/import/import-service;1"]
.getService(Components.interfaces.nsIImportService);
// We need a field map object...
// assume we have one passed in? or just make one?
if (window.arguments && window.arguments[0]) {
top.fieldMap = window.arguments[0].fieldMap;
top.addInterface = window.arguments[0].addInterface;
top.dialogResult = window.arguments[0].result;
}
if (top.fieldMap == null) {
top.fieldMap = top.importService.CreateNewFieldMap();
top.fieldMap.DefaultFieldMap( top.fieldMap.numMozFields);
}
gMoveUpButton = document.getElementById("upButton");
gMoveDownButton = document.getElementById("downButton");
gPreviousButton = document.getElementById("previous");
gNextButton = document.getElementById("next");
gListbox = document.getElementById("fieldList");
gSkipFirstRecordButton = document.getElementById("skipFirstRecord");
// Set the state of the skip first record button
gSkipFirstRecordButton.checked = top.fieldMap.skipFirstRecord;
ListFields();
Browse(1);
gListbox.selectedItem = gListbox.getItemAtIndex(0);
disableMoveButtons();
}
function IndexInMap( index)
{
var count = top.fieldMap.mapSize;
for (var i = 0; i < count; i++) {
if (top.fieldMap.GetFieldMap( i) == index)
return( true);
}
return( false);
}
function ListFields() {
if (top.fieldMap == null)
return;
var count = top.fieldMap.mapSize;
var index;
var i;
for (i = 0; i < count; i++) {
index = top.fieldMap.GetFieldMap( i);
AddFieldToList(top.fieldMap.GetFieldDescription( index), index, top.fieldMap.GetFieldActive( i));
}
count = top.fieldMap.numMozFields;
for (i = 0; i < count; i++) {
if (!IndexInMap( i))
AddFieldToList(top.fieldMap.GetFieldDescription( i), i, false);
}
}
function CreateField( name, index, on)
{
var item = document.createElement('listitem');
item.setAttribute('field-index', index);
item.setAttribute('type', "checkbox");
var cell = document.createElement('listcell');
var cCell = document.createElement( 'listcell');
cCell.setAttribute('type', "checkbox");
cCell.setAttribute( 'label', name);
if (on == true)
cCell.setAttribute( 'checked', "true");
item.appendChild( cCell);
cell.setAttribute( "class", "importsampledata");
cell.setAttribute( 'label', "");
item.appendChild( cell);
return( item);
}
function AddFieldToList(name, index, on)
{
var item = CreateField(name, index, on);
gListbox.appendChild(item);
}
function itemClicked(event)
{
if (event.button == 0) {
var on = gListbox.selectedItem.firstChild.getAttribute('checked');
gListbox.selectedItem.firstChild.setAttribute('checked', (on != "true"));
}
}
// The "Move Up/Move Down" buttons should move the items in the left column
// up/down but the values in the right column should not change.
function moveItem(up)
{
var selectedItem = gListbox.selectedItem;
var swapPartner = (up ? gListbox.getPreviousItem(selectedItem, 1)
: gListbox.getNextItem(selectedItem, 1));
var tmpLabel = swapPartner.lastChild.getAttribute('label');
swapPartner.lastChild.setAttribute('label', selectedItem.lastChild.getAttribute('label'));
selectedItem.lastChild.setAttribute('label', tmpLabel);
var newItemPosition = (up ? selectedItem.nextSibling : selectedItem);
gListbox.insertBefore(swapPartner, newItemPosition);
gListbox.ensureElementIsVisible(selectedItem);
disableMoveButtons();
}
function disableMoveButtons()
{
var selectedIndex = gListbox.selectedIndex;
gMoveUpButton.disabled = (selectedIndex == 0);
gMoveDownButton.disabled = (selectedIndex == (gListbox.getRowCount() - 1));
}
function ShowSampleData(data)
{
var fields = data.split("\n");
for (var i = 0; i < gListbox.getRowCount(); i++)
gListbox.getItemAtIndex(i).lastChild.setAttribute('label', (i < fields.length) ? fields[i] : '');
}
function FetchSampleData(num)
{
if (!top.addInterface)
return false;
var data = top.addInterface.GetData( "sampleData-" + num);
if (!(data instanceof Components.interfaces.nsISupportsString))
return false;
ShowSampleData( data.data);
return true;
}
function Browse(step)
{
recordNum += step;
if (FetchSampleData(recordNum - 1))
document.getElementById('recordNumber').setAttribute('value', ("" + recordNum));
gPreviousButton.disabled = (recordNum == 1);
gNextButton.disabled = (addInterface.GetData("sampleData-" + recordNum) == null);
}
function FieldImportOKButton()
{
var max = gListbox.getRowCount();
var fIndex;
var on;
// Ensure field map is the right size
top.fieldMap.SetFieldMapSize(max);
for (var i = 0; i < max; i++) {
fIndex = gListbox.getItemAtIndex(i).getAttribute( 'field-index');
on = gListbox.getItemAtIndex(i).firstChild.getAttribute('checked');
top.fieldMap.SetFieldMap( i, fIndex);
top.fieldMap.SetFieldActive( i, (on == "true"));
}
top.fieldMap.skipFirstRecord = gSkipFirstRecordButton.checked;
top.dialogResult.ok = true;
return true;
}

View file

@ -0,0 +1,68 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- 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/. -->
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://messenger/locale/fieldMapImport.dtd">
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttons="accept,cancel"
title="&fieldMapImport.title;"
style="&fieldMapImport.size;"
ondialogaccept="FieldImportOKButton();"
onload="OnLoadFieldMapImport();">
<script type="application/javascript" src="chrome://messenger/content/fieldMapImport.js"/>
<hbox align="center">
<label value="&fieldMapImport.recordNumber;"/>
<label id="recordNumber"/>
<spacer flex="1"/>
<button id="previous" oncommand="Browse(-1);"
label="&fieldMapImport.previous.label;"
accesskey="&fieldMapImport.previous.accesskey;"/>
<button id="next" oncommand="Browse(1);"
label="&fieldMapImport.next.label;"
accesskey="&fieldMapImport.next.accesskey;"/>
</hbox>
<hbox align="center">
<checkbox id="skipFirstRecord"
label="&fieldMapImport.skipFirstRecord.label;"
accesskey="&fieldMapImport.skipFirstRecord.accessKey;"/>
</hbox>
<separator class="thin"/>
<label control="fieldList">&fieldMapImport.text;</label>
<separator class="thin"/>
<!-- field list -->
<hbox flex="1">
<listbox id="fieldList" flex="1" onselect="disableMoveButtons();"
onclick="itemClicked(event);">
<listcols>
<listcol flex="7"/>
<listcol flex="13"/>
</listcols>
<listhead>
<listheader id="fieldNameHeader" label="&fieldMapImport.fieldListTitle;"/>
<listheader id="sampleDataHeader" label="&fieldMapImport.dataTitle;"/>
</listhead>
</listbox>
<vbox>
<spacer flex="1"/>
<button id="upButton" class="up" label="&fieldMapImport.up.label;"
accesskey="&fieldMapImport.up.accesskey;"
oncommand="moveItem(true);"/>
<button id="downButton" class="down" label="&fieldMapImport.down.label;"
accesskey="&fieldMapImport.down.accesskey;"
oncommand="moveItem(false);"/>
<spacer flex="1"/>
</vbox>
</hbox>
</dialog>

View file

@ -0,0 +1,36 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- 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/. -->
<html>
<body>
<script type="application/javascript">
function toImport(importType)
{
/*
window.openDialog("chrome:/messenger/content/fieldMapImport.xul",
"fieldMapImportDialog",
"chrome,modal");
*/
window.openDialog("chrome:/messenger/content/importDialog.xul",
"",
"chrome,modal",
{importType:importType});
}
</script>
<p>
<form name="form">
<input type="button" value="Import Address Books" onclick="toImport( 'addressbook');"><br>
<input type="button" value="Import Mail" onclick="toImport( 'mail');"><br>
<input type="button" value="Import Settings" onclick="toImport( 'settings');"><br>
<input type="button" value="Import Filters" onclick="toImport( 'filters');"><br>
<form>
</body>
</html>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,143 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- 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/. -->
<?xml-stylesheet href="chrome://messenger/skin/dialogs.css" type="text/css"?>
<!DOCTYPE window [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
%brandDTD;
<!ENTITY % importDTD SYSTEM "chrome://messenger/locale/importDialog.dtd" >
%importDTD;
]>
<window xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="OnLoadImportDialog()"
#ifdef XP_MACOSX
style="width: &window.macWidth; !important;"
#else
style="width: &window.width; !important;"
#endif
title="&importDialog.windowTitle;">
<stringbundle id="bundle_importMsgs" src="chrome://messenger/locale/importMsgs.properties"/>
<stringbundle id="bundle_addressbook" src="chrome://messenger/locale/addressbook/addressBook.properties"/>
<stringbundle id="bundle_vcardImportMsgs" src="chrome://messenger/locale/vCardImportMsgs.properties"/>
<stringbundle id="bundle_feeds" src="chrome://messenger-newsblog/locale/newsblog.properties"/>
<script type="application/javascript" src="chrome://messenger/content/importDialog.js"/>
<script type="application/javascript" src="chrome://messenger-newsblog/content/feed-subscriptions.js"/>
<keyset id="dialogKeys"/>
<hbox class="box-header" id="header"
title="&importTitle.label;"
description="&importShortDesc.label;"/>
<deck id="stateDeck" selectedIndex="0" style="min-height: 30em">
<vbox class="wizard-box">
<description>&importDescription1.label;</description>
<description>&importDescription2.label;</description>
<separator/>
<radiogroup id="importFields">
<radio id="allRadio"
value="all"
label="&importAll.label;"
accesskey="&importAll.accesskey;"/>
<separator/>
<label control="importFields">&select.label;</label>
<separator class="thin"/>
<vbox class="indent">
<radio id="addressbookRadio"
value="addressbook"
label="&importAddressbook.label;"
accesskey="&importAddressbook.accesskey;"/>
<radio id="mailRadio"
value="mail"
label="&importMail.label;"
accesskey="&importMail.accesskey;"/>
<radio id="feedsRadio"
value="feeds"
label="&importFeeds.label;"
accesskey="&importFeeds.accesskey;"/>
<radio id="settingsRadio"
value="settings"
label="&importSettings.label;"
accesskey="&importSettings.accesskey;"/>
<radio id="filtersRadio"
value="filters"
label="&importFilters.label;"
accesskey="&importFilters.accesskey;"/>
</vbox>
</radiogroup>
</vbox>
<vbox class="wizard-box">
<deck id="modulesFound"
selectedIndex="0">
<vbox>
<deck id="selectDescriptionDeck"
selectedIndex="0">
<label control="moduleList"
value="&selectDescription.label;"
accesskey="&selectDescription.accesskey;"/>
<label control="moduleList"
value="&selectDescriptionB.label;"
accesskey="&selectDescription.accesskey;"/>
</deck>
<listbox id="moduleList" flex="3"
onselect="ImportSelectionChanged(); enableAdvance();"/>
</vbox>
<label>&noModulesFound.label;</label>
</deck>
<grid flex="1">
<columns><column flex="1"/></columns>
<rows>
<row>
<description control="moduleList" id="description" class="box-padded"/>
</row>
<row>
<hbox id="acctName-box" flex="1" style="visibility: hidden;">
<label control="acctName" class="box-padded"
accesskey="&acctName.accesskey;"
value="&acctName.label;"/>
<textbox id="acctName" clickSelectsAll="true"/>
</hbox>
</row>
</rows>
</grid>
</vbox>
<vbox class="wizard-box">
<spacer flex="1"/>
<groupbox>
<caption id="progressTitle" label="&title.label;"/>
<label class="indent" id="progressStatus" value="&processing.label;"/>
<vbox class="box-padded">
<progressmeter id="progressMeter" mode="determined" value="5"/>
</vbox>
</groupbox>
</vbox>
<vbox class="wizard-box">
<description id="status"/>
<hbox style="overflow: auto" class="inset" flex="1">
<description id="results" flex="1"/>
</hbox>
</vbox>
</deck>
<separator/>
<separator class="groove"/>
<hbox class="box-padded">
<spacer flex="1"/>
<button id="back" label="&back.label;" disabled="true"
oncommand="back();"/>
<button id="forward" label="&forward.label;" nextval="&forward.label;" finishedval="&finish.label;"
oncommand="next();"/>
<separator orient="vertical"/>
<button id="cancel" label="&cancel.label;"
oncommand="close();"/>
</hbox>
</window>