Bug 852690 - Remaining conversion to mailServices.js: import. r=Standard8

This commit is contained in:
Sebastian Hengst 2013-03-25 19:46:22 +01:00
Родитель f955bda266
Коммит 54652fe55e
6 изменённых файлов: 23 добавлений и 20 удалений

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

@ -4,6 +4,7 @@
* 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/. */
Components.utils.import("resource:///modules/mailServices.js");
Components.utils.import("resource://gre/modules/Services.jsm");
var importType = null;
@ -102,15 +103,12 @@ function SetDivText(id, text)
function CheckIfLocalFolderExists()
{
var acctMgr = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
if (acctMgr) {
try {
if (acctMgr.localFoldersServer)
progressInfo.localFolderExists = true;
}
catch (ex) {
progressInfo.localFolderExists = false;
}
try {
if (MailServices.accounts.localFoldersServer)
progressInfo.localFolderExists = true;
}
catch (ex) {
progressInfo.localFolderExists = false;
}
}
@ -550,13 +548,11 @@ function ShowImportResultsRaw(title, results, good)
var backButton = document.getElementById("back");
backButton.setAttribute("disabled", "true");
// If the Local Folder is not existed, create it after successfully
// import "mail" and "settings"
// If the Local Folder doesn't exist, create it after successfully
// importing "mail" and "settings"
var checkLocalFolder = (top.progressInfo.importType == 'mail' || top.progressInfo.importType == 'settings');
if (good && checkLocalFolder && !top.progressInfo.localFolderExists) {
var am = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
if (am)
am.createLocalMailAccount();
MailServices.accounts.createLocalMailAccount();
}
}

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

@ -259,8 +259,7 @@ AbImportHelper.prototype =
getAbByName: function(aName) {
do_check_true(aName && aName.length > 0);
var iter = Cc["@mozilla.org/abmanager;1"].getService(Ci.nsIAbManager)
.directories;
var iter = MailServices.ab.directories;
var data = null;
while (iter.hasMoreElements()) {
data = iter.getNext();

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

@ -6,11 +6,13 @@
* - Bug 264405: The Address Book doesn't show the LDAP-field "labeledURI"
* as Website
*/
Components.utils.import("resource:///modules/mailServices.js");
function run_test()
{
// Due to the import code using nsIAbManager off the main thread, we need
// to ensure that it is initialized before we start the main test.
var abMgr = Cc["@mozilla.org/abmanager;1"].getService(Ci.nsIAbManager);
var abMgr = MailServices.ab;
var file = do_get_file("resources/bug_263304.ldif");
new AbImportHelper(file, "Text file", "bug_263304", "bug_263304").beginImport();

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

@ -8,11 +8,13 @@
* -Bug 182128: Edit Card, Notes on several lines appear on one after
* export/import in text format *(only tests the import).
*/
Components.utils.import("resource:///modules/mailServices.js");
function run_test()
{
// Due to the import code using nsIAbManager off the main thread, we need
// to ensure that it is initialized before we start the main test.
var abMgr = Cc["@mozilla.org/abmanager;1"].getService(Ci.nsIAbManager);
var abMgr = MailServices.ab;
var file = do_get_file("resources/basic_ldif_addressbook.ldif");
new AbImportHelper(file, "Text file", "basic_ldif_addressbook",

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

@ -1,8 +1,10 @@
Components.utils.import("resource:///modules/mailServices.js");
function run_test()
{
// Due to the import code using nsIAbManager off the main thread, we need
// to ensure that it is initialized before we start the main test.
let abMgr = Cc["@mozilla.org/abmanager;1"].getService(Ci.nsIAbManager);
let abMgr = MailServices.ab;
let file = do_get_file("resources/shiftjis_addressbook.csv");
let helper = new AbImportHelper(file, "csv",

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

@ -1,8 +1,10 @@
Components.utils.import("resource:///modules/mailServices.js");
function run_test()
{
// Due to the import code using nsIAbManager off the main thread, we need
// to ensure that it is initialized before we start the main test.
let abMgr = Cc["@mozilla.org/abmanager;1"].getService(Ci.nsIAbManager);
let abMgr = MailServices.ab;
let file = do_get_file("resources/utf16_addressbook.csv");
let helper = new AbImportHelper(file, "csv",