From 8f92e961eb1a35c54e4be69a5ad60538b0131eb6 Mon Sep 17 00:00:00 2001 From: "kyle.yuan%sun.com" Date: Tue, 2 Nov 2004 02:32:46 +0000 Subject: [PATCH] Bug 256826 Mozilla should not permit to import empty address book r=neil.parkwaycc.co.uk, sr=dmose, patch=brian.lu@sun.com --- mailnews/import/resources/content/importDialog.js | 7 +++++++ .../import/resources/locale/en-us/importMsgs.properties | 1 + 2 files changed, 8 insertions(+) diff --git a/mailnews/import/resources/content/importDialog.js b/mailnews/import/resources/content/importDialog.js index b9c4c4231e74..3f8d4a462698 100644 --- a/mailnews/import/resources/content/importDialog.js +++ b/mailnews/import/resources/content/importDialog.js @@ -865,6 +865,13 @@ function ImportAddress( module, success, error) { return( false); } + if (file.fileSize == 0) { + var errorText = gImportMsgsBundle.getFormattedString('ImportEmptyAddressBook', [path]); + var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService); + + promptService.alert(window, document.title, errorText); + return false; + } addInterface.SetData("addressLocation", file); } diff --git a/mailnews/import/resources/locale/en-us/importMsgs.properties b/mailnews/import/resources/locale/en-us/importMsgs.properties index 23e7fc16ba28..92fc2ad74ec7 100644 --- a/mailnews/import/resources/locale/en-us/importMsgs.properties +++ b/mailnews/import/resources/locale/en-us/importMsgs.properties @@ -298,6 +298,7 @@ ImportMailSuccess=Mail was successfully imported from %S # Error string for address import ImportAddressBadModule=Unable to load address book import module. ImportAddressNotFound=Unable to find any address books to import. Check to make sure the selected application or format is correctly installed on this machine. +ImportEmptyAddressBook=Can't import empty address book %S. # LOCALIZATION NOTE : Do not translate the word "%S" below. ImportAddressFailed=An error occurred importing addresses from %S. # LOCALIZATION NOTE : Do not translate the word "%S" below.