зеркало из https://github.com/mozilla/gecko-dev.git
Bug 306692 'Open calendar file' does nothing. patch by robin.edrenius@gmail.com r=jminta
This commit is contained in:
Родитель
2575a92058
Коммит
3ef3a07744
|
@ -899,3 +899,35 @@ calTransaction.prototype = {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function openLocalCalendar() {
|
||||
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
|
||||
fp.init(window, gCalendarBundle.getString("Open"), nsIFilePicker.modeOpen);
|
||||
fp.appendFilter(gCalendarBundle.getString("filterCalendar"), "*.ics");
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
|
||||
if (fp.show() != nsIFilePicker.returnOK) {
|
||||
return;
|
||||
}
|
||||
|
||||
var url = fp.fileURL.spec;
|
||||
var calMgr = getCalendarManager();
|
||||
var composite = getDisplayComposite();
|
||||
var openCalendar = calMgr.createCalendar("ics", makeURL(url));
|
||||
calMgr.registerCalendar(openCalendar);
|
||||
|
||||
// Strip ".ics" from filename for use as calendar name, taken from calendarCreation.js
|
||||
var fullPathRegex = new RegExp("([^/:]+)[.]ics$");
|
||||
var prettyName = url.match(fullPathRegex);
|
||||
var name;
|
||||
|
||||
if (prettyName && prettyName.length >= 1) {
|
||||
name = prettyName[1];
|
||||
} else {
|
||||
name = gCalendarBundle.getString("untitledCalendarName");
|
||||
}
|
||||
|
||||
openCalendar.name = name;
|
||||
}
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
<command id="delete_todo_command" oncommand="deleteToDoCommand()" disabled="true"/>
|
||||
|
||||
<command id="new_calendar_command" oncommand="newCalendarDialog()"/>
|
||||
<command id="open_local_calendar_command" oncommand="openLocalCalendar()"/>
|
||||
<command id="edit_calendar_command" oncommand="editCalendarDialog(event)"/>
|
||||
<command id="delete_calendar_command" oncommand="deleteCalendar(event)"/>
|
||||
|
||||
|
|
|
@ -43,6 +43,9 @@ PrintPreviewWindowTitle=Print Preview of %1$S
|
|||
# The name of the calendar provided with the application by default
|
||||
homeCalendarName=Home
|
||||
|
||||
# The name given to a calendar if an opened calendar has an empty filename
|
||||
untitledCalendarName=Untitled Calendar
|
||||
|
||||
# Event status: Tentative, Confirmed, Cancelled
|
||||
# ToDo task status: NeedsAction, InProcess, Completed, Cancelled
|
||||
statusTentative =Tentative
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
<command id="delete_todo_command" oncommand="deleteToDoCommand()" disabled="true"/>
|
||||
|
||||
<command id="new_calendar_command" oncommand="newCalendarDialog()"/>
|
||||
<command id="open_local_calendar_command" oncommand="openLocalCalendar()"/>
|
||||
<command id="edit_calendar_command" oncommand="editCalendarDialog(event)"/>
|
||||
<command id="delete_calendar_command" oncommand="deleteCalendar(event)"/>
|
||||
<command id="find_new_calendar_command" oncommand="goFindNewCalendars()"/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче