From abc22bfd1df5facdb25cfd82356569cc9831cdfe Mon Sep 17 00:00:00 2001 From: "tonyr%fbdesigns.com" Date: Sat, 5 Feb 2000 16:51:41 +0000 Subject: [PATCH] Added workaround for bug #26291 --- .../import/resources/content/importDialog.js | 73 +++++++++++-------- 1 file changed, 42 insertions(+), 31 deletions(-) diff --git a/mailnews/import/resources/content/importDialog.js b/mailnews/import/resources/content/importDialog.js index 693331a4e8e3..8f5c6eedcec8 100644 --- a/mailnews/import/resources/content/importDialog.js +++ b/mailnews/import/resources/content/importDialog.js @@ -28,6 +28,16 @@ var errorStr = null; var progressInfo = null; var selectedModuleName = null; +function GetBundleString( strId) +{ + try { + return( top.bundle.GetStringFromName( strId)); + } catch( ex) { + } + + return( "String Bundle Bad"); +} + function OnLoadImportDialog() { top.bundle = srGetStrBundle("chrome://messenger/locale/importMsgs.properties"); @@ -68,21 +78,21 @@ function SetUpImportType() { case "mail": // top.window.title = top.bundle.GetStringFromName('ImportMailDialogTitle'); - SetDivText('listLabel', top.bundle.GetStringFromName('ImportMailListLabel')); + SetDivText('listLabel', GetBundleString('ImportMailListLabel')); document.getElementById( "mailRadio").checked = true; document.getElementById( "addressbookRadio").checked = false; document.getElementById( "settingsRadio").checked = false; break; case "addressbook": // top.window.title = top.bundle.GetStringFromName('ImportAddressBooksDialogTitle'); - SetDivText('listLabel', top.bundle.GetStringFromName('ImportAddressBooksListLabel')); + SetDivText('listLabel', GetBundleString('ImportAddressBooksListLabel')); document.getElementById( "addressbookRadio").checked = true; document.getElementById( "mailRadio").checked = false; document.getElementById( "settingsRadio").checked = false; break; case "settings": // top.window.title = top.bundle.GetStringFromName('ImportSettingsDialogTitle'); - SetDivText('listLabel', top.bundle.GetStringFromName('ImportSettingsListLabel')); + SetDivText('listLabel', GetBundleString('ImportSettingsListLabel')); document.getElementById( "settingsRadio").checked = true; document.getElementById( "addressbookRadio").checked = false; document.getElementById( "mailRadio").checked = false; @@ -96,16 +106,17 @@ function SetUpImportType() function SetDivText(id, text) { var div = document.getElementById(id); - + if ( div ) { if ( div.childNodes.length == 0 ) - { + { var textNode = document.createTextNode(text); div.appendChild(textNode); } - else if ( div.childNodes.length == 1 ) + else if ( div.childNodes.length == 1 ) { div.childNodes[0].nodeValue = text; + } } } @@ -142,13 +153,13 @@ function ImportDialogOKButton() return( true); } else { - var meterText = top.bundle.GetStringFromName( 'MailProgressMeterText') + " " + name; + var meterText = GetBundleString( 'MailProgressMeterText') + " " + name; // show the progress window... top.window.openDialog( "chrome://messenger/content/importProgress.xul", "", "chrome,modal", - {windowTitle: top.bundle.GetStringFromName( 'MailProgressTitle'), + {windowTitle: GetBundleString( 'MailProgressTitle'), progressTitle: meterText, progressStatus: "", progressInfo: top.progressInfo}); @@ -184,13 +195,13 @@ function ImportDialogOKButton() return( true); } else { - var meterText = top.bundle.GetStringFromName( 'AddrProgressMeterText') + " " + name; + var meterText = GetBundleString( 'AddrProgressMeterText') + " " + name; // show the progress window... top.window.openDialog( "chrome://messenger/content/importProgress.xul", "", "chrome,modal", - {windowTitle: top.bundle.GetStringFromName( 'AddrProgressTitle'), + {windowTitle: GetBundleString( 'AddrProgressTitle'), progressTitle: meterText, progressStatus: "", progressInfo: top.progressInfo}); @@ -215,7 +226,7 @@ function ImportDialogOKButton() { // Show error alert with error // information - alert( top.bundle.GetStringFromName( 'ImportSettingsError') + name + ":\n" + error.value); + alert( GetBundleString( 'ImportSettingsError') + name + ":\n" + error.value); } // the user canceled the operation, shoud we dismiss // this dialog or not? @@ -224,7 +235,7 @@ function ImportDialogOKButton() else { // Alert to show success - alert( top.bundle.GetStringFromName( 'ImportSettingsSuccess') + name); + alert( GetBundleString( 'ImportSettingsSuccess') + name); } break; } @@ -348,7 +359,7 @@ function ShowMailComplete( good) { var str = null; if (good == true) { - str = top.bundle.GetStringFromName( 'ImportMailSuccess'); + str = GetBundleString( 'ImportMailSuccess'); if ((top.selectedModuleName != null) && (top.selectedModuleName.length > 0)) str += " " + top.selectedModuleName; str += "\n"; @@ -358,7 +369,7 @@ function ShowMailComplete( good) } else { if ((top.errorStr.data != null) && (top.errorStr.data.length > 0)) { - str = top.bundle.GetStringFromName( 'ImportMailFailed'); + str = GetBundleString( 'ImportMailFailed'); str += "\n" + top.errorStr.data; } } @@ -372,7 +383,7 @@ function ShowAddressComplete( good) { var str = null; if (good == true) { - str = top.bundle.GetStringFromName( 'ImportAddressSuccess'); + str = GetBundleString( 'ImportAddressSuccess'); if ((top.selectedModuleName != null) && (top.selectedModuleName.length > 0)) str += " " + top.selectedModuleName; str += "\n"; @@ -380,7 +391,7 @@ function ShowAddressComplete( good) } else { if ((top.errorStr.data != null) && (top.errorStr.data.length > 0)) { - str = top.bundle.GetStringFromName( 'ImportAddressFailed'); + str = GetBundleString( 'ImportAddressFailed'); str += "\n" + top.errorStr.data; } } @@ -403,7 +414,7 @@ function ImportSettings( module, newAccount, error) { if (setIntf != null) setIntf = setIntf.QueryInterface( Components.interfaces.nsIImportSettings); if (setIntf == null) { - error.value = top.bundle.GetStringFromName( 'ImportSettingsBadModule'); + error.value = GetBundleString( 'ImportSettingsBadModule'); return( false); } @@ -430,17 +441,17 @@ function ImportSettings( module, newAccount, error) { } } else { - error.value = top.bundle.GetStringFromName( 'ImportSettingsNotFound'); + error.value = GetBundleString( 'ImportSettingsNotFound'); return( false); } } else { - error.value = top.bundle.GetStringFromName( 'ImportSettingsNotFound'); + error.value = GetBundleString( 'ImportSettingsNotFound'); return( false); } } else { - error.value = top.bundle.GetStringFromName( 'ImportSettingsNotFound'); + error.value = GetBundleString( 'ImportSettingsNotFound'); return( false); } } @@ -450,7 +461,7 @@ function ImportSettings( module, newAccount, error) { // that's really only useful for "Upgrade" var result = setIntf.Import( newAccount); if (result == false) { - error.value = top.bundle.GetStringFromName( 'ImportSettingsFailed'); + error.value = GetBundleString( 'ImportSettingsFailed'); } return( result); } @@ -458,7 +469,7 @@ function ImportSettings( module, newAccount, error) { function ImportMail( module, success, error) { if (top.progressInfo.importInterface || top.progressInfo.intervalState) { - error.data = top.bundle.GetStringFromName( 'ImportAlreadyInProgress'); + error.data = GetBundleString( 'ImportAlreadyInProgress'); return( false); } @@ -468,7 +479,7 @@ function ImportMail( module, success, error) { if (mailInterface != null) mailInterface = mailInterface.QueryInterface( Components.interfaces.nsIImportGeneric); if (mailInterface == null) { - error.data = top.bundle.GetStringFromName( 'ImportMailBadModule'); + error.data = GetBundleString( 'ImportMailBadModule'); return( false); } @@ -490,17 +501,17 @@ function ImportMail( module, success, error) { } } else { - error.data = top.bundle.GetStringFromName( 'ImportMailNotFound'); + error.data = GetBundleString( 'ImportMailNotFound'); return( false); } } else { - error.data = top.bundle.GetStringFromName( 'ImportMailNotFound'); + error.data = GetBundleString( 'ImportMailNotFound'); return( false); } } else { - error.data = top.bundle.GetStringFromName( 'ImportMailNotFound'); + error.data = GetBundleString( 'ImportMailNotFound'); return( false); } } @@ -532,7 +543,7 @@ function ImportMail( module, success, error) { // due to field maps... function ImportAddress( module, success, error) { if (top.progressInfo.importInterface || top.progressInfo.intervalState) { - error.data = top.bundle.GetStringFromName( 'ImportAlreadyInProgress'); + error.data = GetBundleString( 'ImportAlreadyInProgress'); return( false); } @@ -542,7 +553,7 @@ function ImportAddress( module, success, error) { if (addInterface != null) addInterface = addInterface.QueryInterface( Components.interfaces.nsIImportGeneric); if (addInterface == null) { - error.data = top.bundle.GetStringFromName( 'ImportAddressBadModule'); + error.data = GetBundleString( 'ImportAddressBadModule'); return( false); } @@ -564,7 +575,7 @@ function ImportAddress( module, success, error) { // as the user for the location or not? if (addInterface.GetStatus( "canUserSetLocation") == 0) { // an autofind address book that could not be found! - error.data = top.bundle.GetStringFromName( 'ImportAddressNotFound'); + error.data = GetBundleString( 'ImportAddressNotFound'); return( false); } @@ -572,12 +583,12 @@ function ImportAddress( module, success, error) { if (filePicker != null) { filePicker = filePicker.QueryInterface( Components.interfaces.nsIFileSpecWithUI); if (filePicker == null) { - error.data = top.bundle.GetStringFromName( 'ImportAddressNotFound'); + error.data = GetBundleString( 'ImportAddressNotFound'); return( false); } } else { - error.data = top.bundle.GetStringFromName( 'ImportAddressNotFound'); + error.data = GetBundleString( 'ImportAddressNotFound'); return( false); }