Make errorstring localizable. use promptservice.

bug 247636, r=mostafah
This commit is contained in:
mvl%exedo.nl 2004-06-20 10:03:02 +00:00
Родитель 1c039e3f8d
Коммит ba8cad137e
2 изменённых файлов: 16 добавлений и 3 удалений

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

@ -666,6 +666,10 @@ calendarManager.prototype.getRemoteCalendarText = function calMan_getRemoteCalen
{
window.setCursor( "default" );
var calendarStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
var retval = false;
if( typeof( result ) != "string" ) //for 1.7 compatibility
result = String.fromCharCode.apply(this, result);
@ -676,18 +680,21 @@ calendarManager.prototype.getRemoteCalendarText = function calMan_getRemoteCalen
} catch(e) {
}
if (ch && !ch.requestSucceeded) {
alert("Getting the calendar file failed.\nStatus code: "+ch.responseStatus+": "+ch.responseStatusText);
promptService.alert(null, calendarStringBundle.GetStringFromName('errorTitle'),
calendarStringBundle.formatStringFromName('httpError',[ch.responseStatus, ch.responseStatusText],2));
}
else if (!Components.isSuccessCode(loader.request.status)) {
// XXX this should be made human-readable.
alert("Getting the calendar file failed.\nStatus code: 0x"+loader.request.status.toString(16));
promptService.alert(null, calendarStringBundle.GetStringFromName('errorTitle'),
calendarStringBundle.formatStringFromName('otherError',[cloader.request.status.toString(16)],1));
}
//check to make sure its actually a calendar file, if not return.
else if( result.indexOf( "BEGIN:VCALENDAR" ) == -1 )
{
alert( "This doesn't appear to be a valid file. Here's what I got back from\n"+Channel.URI.spec+":\nResult:"+result );
promptService.alert(null, calendarStringBundle.GetStringFromName('errorTitle'),
calendarStringBundle.formatStringFromName('contentError',[Channel.URI.spec, result],2));
} else {
onResponse( result );
retval = true;

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

@ -143,3 +143,9 @@ filterHtml=HTML Files
filterCsv=Comma Separated
filterOutlookCsv=Outlook Comma Separated
filterRdf=iCalendar RDF
# Remote calendar errors
errorTitle=Error getting calendar
httpError=Getting the calendar file failed.\nStatus code: %1$S: %2$S
otherError=Getting the calendar file failed.\nStatus code: 0x%1$S
contentError=This doesn't appear to be a valid file. Here's what I got back from\n%1$S:\nResult: %2$S