Fix bug 388405 - Unify calendar list between lightning and sunbird. r=mickey

This commit is contained in:
mozilla%kewis.ch 2007-08-14 17:27:00 +00:00
Родитель e1c9ac7194
Коммит b886400446
28 изменённых файлов: 1250 добавлений и 1570 удалений

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

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Calendar code.
-
- The Initial Developer of the Original Code is
- Philipp Kewisch <mozilla@kewis.ch>
- Portions created by the Initial Developer are Copyright (C) 2007
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://calendar/skin/calendar-management.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "chrome://calendar/locale/calendar.dtd">
<overlay id="calendar-list-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<popupset id="calendar-popupset">
<popup id="list-calendars-context-menu"
onpopupshowing="return calendarListTreeView.setupContextMenu(event);">
<menuitem id="list-calendars-context-new"
label="&calendar.context.newserver.label;"
accesskey="&calendar.context.newserver.accesskey;"
observes="calendar_new_calendar_command"/>
<menuitem id="list-calendars-context-delete"
label="&calendar.context.deleteserver.label;"
accesskey="&calendar.context.deleteserver.accesskey;"
observes="calendar_delete_calendar_command"/>
<menuseparator/>
<menuitem id="list-calendars-context-export"
label="&calendar.context.export.label;"
accesskey="&calendar.context.export.accesskey;"
oncommand="exportEntireCalendar(calendarListTreeView.getCalendarFromEvent(event));"/>
<menuitem id="list-calendars-context-publish"
label="&calendar.context.publish.label;"
accesskey="&calendar.context.publish.accesskey;"
observes="calendar_publish_calendar"/>
<menuseparator/>
<menuitem id="list-calendars-context-reload"
label="&calendar.context.reloadserver.label;"
accesskey="&calendar.context.reloadserver.accesskey;"
observes="calendar_reload_remote_calendars"/>
<menuseparator/>
<menuitem id="list-calendars-context-edit"
label="&calendar.context.properties.label;"
accesskey="&calendar.context.properties.accesskey;"
observes="calendar_edit_calendar_command"/>
</popup>
</popupset>
<tree id="calendar-list-tree"
hidecolumnpicker="true"
seltype="single"
onkeypress="calendarListTreeView.onKeyPress(event);"
ondblclick="calendarListTreeView.onDoubleClick(event);"
onselect="calendarListTreeView.onSelect(event);"
context="list-calendars-context-menu">
<treecols>
<treecol id="calendar-list-tree-checkbox"
cycler="true"
type="checkbox"
width="16"/>
<treecol id="calendar-list-tree-color" width="16"/>
<treecol id="calendar-list-tree-calendar"
label="&calendar.unifinder.tree.calendarname.label;"
flex="1"/>
</treecols>
<treechildren/>
</tree>
</overlay>

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

@ -102,12 +102,7 @@ function createEventWithDialog(calendar, startDate, endDate, summary, event)
}
event.endDate = endDate.clone();
if (calendar) {
event.calendar = calendar;
} else if ("getSelectedCalendarOrNull" in window) {
// Sunbird specific code
event.calendar = getSelectedCalendarOrNull();
}
event.calendar = calendar || getSelectedCalendar();
if (summary)
event.title = summary;
@ -138,12 +133,7 @@ function createTodoWithDialog(calendar, dueDate, summary, todo)
todo = createTodo();
if (calendar) {
todo.calendar = calendar;
} else if ("getSelectedCalendarOrNull" in window) {
// Sunbird specific code
todo.calendar = getSelectedCalendarOrNull();
}
todo.calendar = calendar || getSelectedCalendar();
if (summary)
todo.title = summary;

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

@ -0,0 +1,640 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Calendar code.
*
* The Initial Developer of the Original Code is
* Philipp Kewisch <mozilla@kewis.ch>
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Michiel van Leeuwen <mvl@exedo.nl>
* Joey Minta <jminta@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
* Calendar specific utility functions
*/
var gCompositeCalendar = null;
function getCompositeCalendar() {
if (!gCompositeCalendar) {
gCompositeCalendar =
Cc["@mozilla.org/calendar/calendar;1?type=composite"]
.createInstance(Ci.calICompositeCalendar);
gCompositeCalendar.prefPrefix = 'calendar-main';
}
return gCompositeCalendar;
}
function getSelectedCalendar() {
var tree = document.getElementById("calendar-list-tree");
return (tree.currentIndex > -1) &&
calendarListTreeView.mCalendarList[tree.currentIndex];
}
function promptDeleteCalendar(aCalendar) {
var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Ci.nsIPromptService);
var ok = promptService.confirm(
window,
calGetString("calendar", "unsubscribeCalendarTitle"),
calGetString("calendar",
"unsubscribeCalendarMessage",
[aCalendar.name]),
{});
if (ok) {
var calMgr = getCalendarManager();
calMgr.unregisterCalendar(aCalendar);
calMgr.deleteCalendar(aCalendar);
}
}
function ensureCalendarVisible(aCalendar) {
var composite = getCompositeCalendar();
if (!composite.getCalendar(aCalendar.uri)) {
composite.addCalendar(aCalendar);
}
}
/**
* Calendar manager load/unload functions
*/
function loadCalendarManager() {
var calMgr = getCalendarManager();
var composite = getCompositeCalendar();
var calendars = calMgr.getCalendars({});
var prefService = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService);
var branch = prefService.getBranch("").QueryInterface(Ci.nsIPrefBranch2);
calendarListInitColors();
// Set up the tree view
var tree = document.getElementById("calendar-list-tree");
calendarListTreeView.tree = tree;
tree.view = calendarListTreeView;
calMgr.addObserver(calendarManagerObserver);
composite.addObserver(calendarManagerObserver);
branch.addObserver("calendar.", calendarManagerObserver, false);
if (calendars.length == 0) {
var url = makeURL("moz-profile-calendar://");
var homeCalendar = calMgr.createCalendar("storage", url);
calMgr.registerCalendar(homeCalendar);
var name = calGetString("calendar", "homeCalendarName");
homeCalendar.name = name;
composite.addCalendar(homeCalendar);
// Wrapping this in a try/catch block, as if any of the migration code
// fails, the app may not load.
try {
gDataMigrator.checkAndMigrate();
} catch (e) {
Components.utils.reportError("Migrator error: " + e);
}
}
// The calendar manager will not notify for existing calendars. Go through
// them all and fire our observers manually.
for each (var calendar in calendars) {
calendarManagerObserver.onCalendarRegistered(calendar);
}
}
function unloadCalendarManager() {
var calMgr = getCalendarManager();
var composite = getCompositeCalendar();
var prefService = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService);
var branch = prefService.getBranch("").QueryInterface(Ci.nsIPrefBranch2);
branch.removeObserver("calendar.", calendarManagerObserver);
composite.removeObserver(calendarManagerObserver);
calMgr.removeObserver(calendarManagerObserver);
}
/**
* Color specific functions
*/
var gCachedStyleSheet;
function calendarListInitColors() {
var calendars = getCalendarManager().getCalendars({});
if (!gCachedStyleSheet) {
var cssUri = "chrome://calendar/content/calendar-view-bindings.css";
gCachedStyleSheet = getStyleSheet(cssUri);
}
// Update All Calendars
for each (var calendar in calendars) {
updateStyleSheetForObject(calendar, gCachedStyleSheet);
calendarListUpdateColor(calendar);
}
var prefService = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService);
var categoryPrefBranch = prefService.getBranch("calendar.category.color.");
var categories = categoryPrefBranch.getChildList("", {});
// Update all categories
for each (var category in categories) {
updateStyleSheetForObject(category, gCachedStyleSheet);
}
}
function calendarListUpdateColor(aCalendar) {
var selectorPrefix = "treechildren::-moz-tree-cell";
var color = getCalendarManager().getCalendarPref(aCalendar, "color");
if (!color) {
return;
}
var selector = selectorPrefix + "color-" + color.substr(1);
for (var i = 0; i < gCachedStyleSheet.cssRules.length; i++) {
var thisrule = gCachedStyleSheet.cssRules[i];
if (thisrule.selectorText && thisrule.selectorText == selector) {
return;
}
}
var ruleString = selectorPrefix + "(color-" + color.substr(1) + ") { }";
var rule = gCachedStyleSheet
.insertRule(ruleString, gCachedStyleSheet.cssRules.length);
gCachedStyleSheet.cssRules[rule].style.backgroundColor = color;
return;
}
/**
* Calendar Tree View
*/
var calendarListTreeView = {
mCalendarList: [],
tree: null,
treebox: null,
mContextElement: null,
/**
* High-level calendar tree manipulation
*/
findIndex: function cLTV_findIndex(aCalendar) {
for (var i = 0; i < this.mCalendarList.length; i++) {
if (this.mCalendarList[i].id == aCalendar.id) {
return i;
}
}
return -1;
},
addCalendar: function cLTV_addCalendar(aCalendar) {
this.mCalendarList.push(aCalendar);
calendarListUpdateColor(aCalendar);
this.treebox.rowCountChanged(this.mCalendarList.length - 1, 1);
this.tree.view.selection.select(Math.max(0, this.tree.currentIndex));
},
removeCalendar: function cLTV_removeCalendar(aCalendar) {
var index = this.findIndex(aCalendar);
if (index < 0) {
return;
}
this.mCalendarList.splice(index, 1);
this.treebox.rowCountChanged(index, -1);
if (index == this.rowCount) {
index--;
}
this.tree.view.selection.select(index);
},
updateCalendar: function cLTV_updateCalendar(aCalendar) {
var index = this.findIndex(aCalendar);
this.treebox.invalidateRow(index);
},
getCalendarFromEvent: function cLTV_getCalendarFromEvent(event,
aCol,
aRow) {
if (event.clientX && event.clientY) {
// If we have a client point, get the row directly from the client
// point.
aRow = aRow || {};
this.treebox.getCellAt(event.clientX,
event.clientY,
aRow,
aCol || {},
{});
} else {
// The event is probably coming from a context menu oncommand
// handler. We saved the row and column where the context menu
// showed up in setupContextMenu().
aCol = { value: this.mContextElement.column };
aRow = { value: this.mContextElement.row };
}
return aRow && aRow.value > -1 && this.mCalendarList[aRow.value];
},
/**
* nsITreeView methods and properties
*/
get rowCount() {
return this.mCalendarList.length;
},
getCellProperties: function cLTV_getCellProperties(aRow, aCol, aProps) {
var calendar = this.mCalendarList[aRow];
var composite = getCompositeCalendar();
switch (aCol.id) {
case "calendar-list-tree-checkbox":
if (composite.getCalendar(calendar.uri)) {
aProps.AppendElement(getAtomFromService("checked"));
} else {
aProps.AppendElement(getAtomFromService("unchecked"));
}
break;
case "calendar-list-tree-color":
var color = getCalendarManager().getCalendarPref(calendar,
"color");
color = "color-" + (color ? color.substr(1) : "default");
aProps.AppendElement(getAtomFromService(color));
break;
}
},
cycleCell: function cLTV_cycleCell(aRow, aCol) {
var calendar = this.mCalendarList[aRow];
var composite = getCompositeCalendar();
if (composite.getCalendar(calendar.uri)) {
composite.removeCalendar(calendar.uri);
} else {
composite.addCalendar(calendar);
}
this.treebox.invalidateRow(aRow);
},
getCellValue: function cLTV_getCellValue(aRow, aCol) {
var calendar = this.mCalendarList[aRow];
var composite = getCompositeCalendar();
switch (aCol.id) {
case "calendar-list-tree-checkbox":
return composite.getCalendar(calendar.uri) ? "true" : "false";
}
return null;
},
setCellValue: function cLTV_setCellValue(aRow, aCol, aValue) {
var calendar = this.mCalendarList[aRow];
var composite = getCompositeCalendar();
switch (aCol.id) {
case "calendar-list-tree-checkbox":
if (aValue == "true") {
composite.addCalendar(calendar);
} else {
composite.removeCalendar(calendar);
}
return aValue;
}
return null;
},
getCellText: function cLTV_getCellText(aRow, aCol) {
var calendar = this.mCalendarList[aRow];
var composite = getCompositeCalendar();
switch (aCol.id) {
case "calendar-list-tree-calendar":
return this.mCalendarList[aRow].name;
}
return "";
},
getImageSrc: function cLTV_getImageSrc(aRow, aCol) {
return null;
},
isEditable: function cLTV_isEditable(aRow, aCol) {
return false;
},
setTree: function cLTV_setTree(aTreeBox) {
this.treebox = aTreeBox;
},
isContainer: function cLTV_isContainer(aRow) {
return false;
},
isSeparator: function cLTV_isSeparator(aRow) {
return false;
},
isSorted: function cLTV_isSorted(aRow) {
return false;
},
isSeparator: function cLTV_isSeparator(aRow) {
return false;
},
getLevel: function cLTV_getLevel(aRow) {
return 0;
},
getRowProperties: function cLTV_getRowProperties(aRow, aProps) {},
getColumnProperties: function cLTV_getColumnProperties(aCol, aProps) {},
cycleHeader: function cLTV_cycleHeader(aCol) { },
/**
* Calendar Tree Events
*/
onKeyPress: function cLTV_onKeyPress(event) {
const kKE = Ci.nsIDOMKeyEvent;
switch (event.keyCode || event.which) {
case kKE.DOM_VK_DELETE:
promptDeleteCalendar(getSelectedCalendar());
break;
case kKE.DOM_VK_SPACE:
if (this.tree.currentIndex > -1 ) {
var cbCol =
this.treebox.columns
.getNamedColumn("list-calendarsr-tree-checkbox");
this.cycleCell(this.tree.currentIndex, cbCol);
}
break;
}
},
onDoubleClick: function cLTV_onDoubleClick(event) {
var col = {};
var calendar = this.getCalendarFromEvent(event, col);
if (event.button != 0 ||
(col.value && col.value.id == "calendar-list-tree-checkbox")) {
// Only left clicks that are not on the checkbox column
return;
}
if (calendar) {
openCalendarProperties(calendar, null);
} else {
openCalendarWizard();
}
},
onSelect: function cLTV_onSelect(event) {
// The select event should only fire when an item is actually selected,
// therefore we can assume that getSelectedCalendar() returns a
// calendar.
var composite = getCompositeCalendar();
composite.defaultCalendar = getSelectedCalendar();
},
setupContextMenu: function cLTV_setupContextMenu(event) {
var col = {};
var row = {};
var calendar;
if (document.popupNode.localName == "tree") {
// Using VK_APPS to open the context menu will target the tree
// itself. In that case we won't have a client point even for
// opening the context menu. The "target" element should then be the
// selected element.
row.value = this.tree.currentIndex;
col.value = this.treebox.columns
.getNamedColumn("calendar-list-tree-calendar");
calendar = this.mCalendarList[row.value];
} else {
// Using the mouse, the context menu will open on the treechildren
// element. Here we can use client points.
calendar = this.getCalendarFromEvent(event, col, row);
}
if (col.value && col.value.id == "calendar-list-tree-checkbox") {
// Don't show the context menu if the checkbox was clicked.
return false;
}
// We need to save the row to return the correct calendar in
// getCalendarFromEvent()
this.mContextElement = {
row: row && row.value,
column: col && col.value
};
if (calendar) {
document.getElementById("list-calendars-context-edit")
.removeAttribute("disabled");
document.getElementById("list-calendars-context-delete")
.removeAttribute("disabled");
document.getElementById("list-calendars-context-publish")
.removeAttribute("disabled");
} else {
document.getElementById("list-calendars-context-edit")
.setAttribute("disabled", "true");
document.getElementById("list-calendars-context-delete")
.setAttribute("disabled", "true");
document.getElementById("list-calendars-context-publish")
.setAttribute("disabled", "true");
}
return true;
}
};
var calendarManagerObserver = {
mDefaultCalendarItem: null,
QueryInterface: function cMO_QueryInterface(aIID) {
if (!aIID.equals(Ci.calICalendarManagerObserver) &&
!aIID.equals(Ci.calICompositeObserver) &&
!aIID.equals(Ci.calIObserver) &&
!aIID.equals(Ci.nsIObserver) &&
!aIID.equals(Ci.nsISupports)) {
throw Cr.NS_ERROR_NO_INTERFACE;
}
return this;
},
// calICalendarManagerObserver
onCalendarRegistered: function cMO_onCalendarRegistered(aCalendar) {
// Enable new calendars by default
calendarListTreeView.addCalendar(aCalendar);
getCompositeCalendar().addCalendar(aCalendar);
// Watch the calendar for changes, to ensure its visibility when adding
// or changing items.
aCalendar.addObserver(this);
document.getElementById("calendar_new_event_command")
.removeAttribute("disabled");
document.getElementById("calendar_new_todo_command")
.removeAttribute("disabled");
document.getElementById("calendar_delete_calendar_command")
.removeAttribute("disabled");
if (aCalendar.canRefresh) {
document.getElementById("calendar_reload_remote_calendars")
.removeAttribute("disabled");
}
},
onCalendarUnregistering: function cMO_onCalendarUnregistering(aCalendar) {
var calendars = getCalendarManager().getCalendars({});
calendarListTreeView.removeCalendar(aCalendar);
aCalendar.removeObserver(this);
// Since the calendar hasn't been removed yet, <= 1 is correct.
if (calendars.length <= 1) {
// If there are no calendars, you can't create events/tasks or
// delete calendars
document.getElementById("calendar_new_event_command")
.setAttribute("disabled", true);
document.getElementById("calendar_new_todo_command")
.setAttribute("disabled", true);
document.getElementById("calendar_delete_calendar_command")
.setAttribute("disabled", true);
}
if (aCalendar.canRefresh) {
// This may be the last refreshable calendar. In that case, disable
// the possibility to reload remote calendars.
function calCanRefresh(cal) {
return (cal.canRefresh && !cal.uri.equals(aCalendar.uri));
}
if (!calendars.some(calCanRefresh)) {
document.getElementById("calendar_reload_remote_calendars")
.setAttribute("disabled", true);
}
}
},
onCalendarDeleting: function cMO_onCalendarDeleting(aCalendar) {
// Make sure the calendar is removed from the composite calendar
getCompositeCalendar().removeCalendar(aCalendar.uri);
},
onCalendarPrefSet: function cMO_onCalendarPrefSet(aCalendar,
aName,
aValue) {
switch (aName) {
case "color":
updateStyleSheetForObject(aCalendar, gCachedStyleSheet);
calendarListUpdateColor(aCalendar);
// Fall through, update item in any case
case "name":
calendarListTreeView.updateCalendar(aCalendar);
break;
}
},
onCalendarPrefDeleting: function cMO_onCalendarPrefDeleting(aCalendar,
aName) {
this.onCalendarPrefSet(aCalendar, aName, null);
},
// calICompositeObserver
onCalendarAdded: function cMO_onCalendarAdded(aCalendar) {
// Make sure the checkbox state is updated
var index = calendarListTreeView.findIndex(aCalendar);
calendarListTreeView.treebox.invalidateRow(index);
},
onCalendarRemoved: function cMO_onCalendarRemoved(aCalendar) {
// Make sure the checkbox state is updated
var index = calendarListTreeView.findIndex(aCalendar);
calendarListTreeView.treebox.invalidateRow(index);
},
onDefaultCalendarChanged: function cMO_onDefaultCalendarChanged(aCalendar) {
},
// calIObserver. Note that each registered calendar uses this observer, not
// only the composite calendar.
onStartBatch: function cMO_onStartBatch() { },
onEndBatch: function cMO_onEndBatch() { },
onLoad: function cMO_onLoad() { },
onAddItem: function cMO_onAddItem(aItem) {
ensureCalendarVisible(aItem.calendar);
},
onModifyItem: function cMO_onModifyItem(aNewItem, aOldItem) {
ensureCalendarVisible(aNewItem.calendar);
},
onDeleteItem: function cMO_onDeleteItem(aDeletedItem) { },
onError: function cMO_onError(aErrNo, aMessage) { },
// nsIObserver
observe: function cMO_observe(aSubject, aTopic, aPrefName) {
switch (aPrefName) {
case "calendar.week.start":
getMinimonth().refreshDisplay(true);
break;
case "calendar.date.format":
var currentView = currentView();
currentView.goToDay(currentView.selectedDay);
refreshEventTree();
toDoUnifinderRefresh();
break;
case "calendar.timezone.local":
var subject = aSubject.QueryInterface(Ci.nsIPrefBranch2);
gDefaultTimezone = subject.getCharPref(aPrefName);
var currentView = currentView();
currentView.goToDay(currentView.selectedDay);
refreshEventTree();
toDoUnifinderRefresh();
break;
default :
break;
}
// Since we want to take care of all categories, this must be done
// extra.
if (aPrefName.substring(0, 24) == "calendar.category.color.") {
var categoryName = aPrefName.substring(24);
updateStyleSheetForObject(categoryName, gCachedStyleSheet);
}
}
};

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

@ -51,16 +51,7 @@ var calendarViewController = {
},
createNewEvent: function (aCalendar, aStartTime, aEndTime) {
// XXX If we're adding an item from the view, let's make sure that
// XXX the calendar in question is visible!
// XXX unify these
if (!aCalendar) {
if ("ltnSelectedCalendar" in window) {
aCalendar = ltnSelectedCalendar();
} else {
aCalendar = getSelectedCalendarOrNull();
}
}
aCalendar = aCalendar || getSelectedCalendar();
// if we're given both times, skip the dialog
if (aStartTime && aEndTime && !aStartTime.isDate && !aEndTime.isDate) {

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

@ -8,6 +8,7 @@ calendar.jar:
content/calendar/calendar-alarm-widget.css (content/calendar-alarm-widget.css)
content/calendar/calendar-alarm-widget.xml (content/calendar-alarm-widget.xml)
content/calendar/calendar-attendee-list.xml (content/calendar-attendee-list.xml)
content/calendar/calendar-calendars-list.xul (content/calendar-calendars-list.xul)
content/calendar/calendar-decorated-base.xml (content/calendar-decorated-base.xml)
content/calendar/calendar-decorated-multiday-base-view.xml (content/calendar-decorated-multiday-base-view.xml)
content/calendar/calendar-decorated-day-view.xml (content/calendar-decorated-day-view.xml)
@ -25,6 +26,7 @@ calendar.jar:
content/calendar/calendar-multiday-view.xml (content/calendar-multiday-view.xml)
* content/calendar/today-pane.xul (content/today-pane.xul)
content/calendar/today-pane.js (content/today-pane.js)
content/calendar/calendar-management.js (content/calendar-management.js)
content/calendar/calendar-minimonth-busy.js (content/calendar-minimonth-busy.js)
content/calendar/calendar-recurrence-dialog.js (content/calendar-recurrence-dialog.js)
content/calendar/calendar-recurrence-dialog.xul (content/calendar-recurrence-dialog.xul)
@ -78,6 +80,7 @@ calendar.jar:
#expand skin/classic/calendar/toolbar-large.png (themes/__THEME__/toolbar-large.png)
#expand skin/classic/calendar/toolbar-small.png (themes/__THEME__/toolbar-small.png)
#expand skin/classic/calendar/mode-switch-icons.png (themes/__THEME__/mode-switch-icons.png)
#expand skin/classic/calendar/calendar-management.css (themes/__THEME__/calendar-management.css)
skin/classic/calendar/event-grippy-bottom.png (themes/common/event-grippy-bottom.png)
skin/classic/calendar/event-grippy-left.png (themes/common/event-grippy-left.png)
skin/classic/calendar/event-grippy-right.png (themes/common/event-grippy-right.png)

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

@ -19,6 +19,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Philipp Kewisch <mozilla@kewis.ch>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -1060,6 +1061,12 @@ function hasPositiveIntegerValue(elementId)
return false;
}
function getAtomFromService(aStr) {
var atomService = Cc["@mozilla.org/atom-service;1"]
.getService(Ci.nsIAtomService);
return atomService.getAtom(aStr);
}
function calListenerBag(iid) {
this.mIid = iid;
this.mListeners = [];

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

@ -0,0 +1,59 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Calendar Management code.
*
* The Initial Developer of the Original Code is
* Philipp Kewisch <mozilla@kewis.ch>
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
treechildren::-moz-tree-image(calendar-list-tree-checkbox) {
list-style-image: url(chrome://calendar/skin/unifinder/checkbox_unchecked.png);
}
treechildren::-moz-tree-image(calendar-list-tree-checkbox, checked) {
list-style-image: url(chrome://calendar/skin/unifinder/checkbox_checked.png);
}
treechildren::-moz-tree-cell(color-default) {
background-color: #a8c2e1;
}
treechildren::-moz-tree-cell(calendar-list-tree-checkbox) {
padding: 0;
}
treechildren::-moz-tree-cell(calendar-list-tree-color) {
margin: 1px;
}
treechildren::-moz-tree-cell(calendar-list-tree-calendar) {
margin-left: 1px;
}

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

@ -0,0 +1,66 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Calendar Management code.
*
* The Initial Developer of the Original Code is
* Philipp Kewisch <mozilla@kewis.ch>
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
treechildren::-moz-tree-cell(calendar-list-tree-checkbox) {
-moz-appearance: checkbox;
-moz-box-align: center;
border: 2px solid;
-moz-border-top-colors: ThreeDShadow ThreeDDarkShadow;
-moz-border-right-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-left-colors: ThreeDShadow ThreeDDarkShadow;
min-width: 13px;
min-height: 13px;
background: -moz-Field no-repeat 50% 50%;
margin: 1px 1px 2px 1px;
padding: 0;
}
treechildren::-moz-tree-image(calendar-list-tree-checkbox, checked) {
list-style-image: url(chrome://global/skin/checkbox/cbox-check.gif);
}
treechildren::-moz-tree-cell(color-default) {
background-color: #a8c2e1;
}
treechildren::-moz-tree-cell(calendar-list-tree-color) {
margin: 1px;
}
treechildren::-moz-tree-cell(calendar-list-tree-calendar) {
margin-left: 1px;
}

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

@ -28,6 +28,7 @@
* richard@duif.net
* Matthew Willis <mattwillis@gmail.com>
* Markus Adrario <MarkusAdrario@web.de>
* Philipp Kewisch <mozilla@kewis.ch>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -330,7 +331,7 @@ function agendaDoubleClick(event)
// Find the row clicked on, and the corresponding event
var tree = document.getElementById("agenda-tree");
var row = tree.treeBoxObject.getRowAt(event.clientX, event.clientY);
var calendar = ltnSelectedCalendar();
var calendar = getSelectedCalendar();
var calEvent = this.events[row];
if (!calEvent) { // Clicked in empty space, just create a new event

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

@ -1,411 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Lightning code.
*
* The Initial Developer of the Original Code is Oracle Corporation
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mike Shaver <shaver@mozilla.org>
* Vladimir Vukicevic <vladimir@pobox.com>
* Stuart Parmenter <stuart.parmenter@oracle.com>
* Dan Mosedale <dmose@mozilla.org>
* Joey Minta <jminta@gmail.com>
* Stefan Sitter <ssitter@googlemail.com>
* Stefan Schaefer <stephan.schaefer@sun.com>
* Michael Buettner <michael.buettner@sun.com>
* gekacheka@yahoo.com
* Daniel Boelzle <daniel.boelzle@sun.com>
* Robin Edrenius <robin.edrenius@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//
// calendar-management.js
//
var gCalendars = [];
var gCachedStyleSheet;
function addCalendarToTree(aCalendar)
{
gCalendars.push(aCalendar);
if (!gCachedStyleSheet) {
gCachedStyleSheet = getStyleSheet("chrome://calendar/content/calendar-view-bindings.css");
}
updateStyleSheetForObject(aCalendar, gCachedStyleSheet);
updateLtnStyleSheet(aCalendar);
var boxobj = document.getElementById("calendarTree").treeBoxObject;
boxobj.rowCountChanged(gCalendars.length-1, 1);
}
function removeCalendarFromTree(aCalendar)
{
var index = getIndexForCalendar(aCalendar);
if (index == -1) {
return;
}
gCalendars.splice(index, 1);
var calTree = document.getElementById("calendarTree");
calTree.boxObject.rowCountChanged(index, -1);
// Just select the new last row, if we removed the last listed calendar
if (index == calTree.view.rowCount) {
index--;
}
calTree.view.selection.select(index);
}
var ltnCalendarManagerObserver = {
QueryInterface: function(aIID) {
if (!aIID.equals(Components.interfaces.calICalendarManagerObserver) &&
!aIID.equals(Components.interfaces.nsISupports)) {
throw Components.results.NS_ERROR_NO_INTERFACE;
}
return this;
},
onCalendarRegistered: function(aCalendar) {
addCalendarToTree(aCalendar);
getCompositeCalendar().addCalendar(aCalendar);
},
onCalendarUnregistering: function(aCalendar) {
removeCalendarFromTree(aCalendar);
getCompositeCalendar().removeCalendar(aCalendar.uri);
},
onCalendarDeleting: function(aCalendar) {
removeCalendarFromTree(aCalendar); // XXX what else?
getCompositeCalendar().removeCalendar(aCalendar.uri);
},
onCalendarPrefSet: function(aCalendar, aName, aValue) {
if (!gCachedStyleSheet) {
gCachedStyleSheet = getStyleSheet("chrome://calendar/content/calendar-view-bindings.css");
}
updateStyleSheetForObject(aCalendar, gCachedStyleSheet);
updateTreeView(aCalendar);
},
onCalendarPrefDeleting: function(aCalendar, aName) {
}
};
var ltnCompositeCalendarObserver = {
QueryInterface: function(aIID) {
// I almost wish that calICompositeObserver did not inherit from calIObserver,
// and that the composite calendar maintined its own observer list
if (!aIID.equals(Components.interfaces.calIObserver) &&
!aIID.equals(Components.interfaces.calICompositeObserver) &&
!aIID.equals(Components.interfaces.nsISupports)) {
throw Components.results.NS_ERROR_NO_INTERFACE;
}
return this;
},
// calICompositeObserver
onCalendarAdded: function (aCalendar) {
document.getElementById("calendarTree").boxObject.invalidate();
},
onCalendarRemoved: function (aCalendar) {
document.getElementById("calendarTree").boxObject.invalidate();
},
onDefaultCalendarChanged: function (aNewDefaultCalendar) {
// make the calendar bold in the tree
},
// calIObserver
onStartBatch: function() { },
onEndBatch: function() { },
onLoad: function(aCalendar) { },
onAddItem: function(aItem) { },
onModifyItem: function(aNewItem, aOldItem) { },
onDeleteItem: function(aDeletedItem) { },
onError: function(aErrNo, aMessage) { }
};
var activeCompositeCalendar = null;
function getCompositeCalendar()
{
if (activeCompositeCalendar == null) {
activeCompositeCalendar =
ltnCreateInstance("@mozilla.org/calendar/calendar;1?type=composite",
"calICompositeCalendar");
activeCompositeCalendar.prefPrefix = "lightning-main";
activeCompositeCalendar.addObserver(ltnCompositeCalendarObserver, 0);
}
return activeCompositeCalendar;
}
var activeCalendarManager;
function getCalendarManager()
{
if (!activeCalendarManager) {
activeCalendarManager = ltnGetService("@mozilla.org/calendar/manager;1",
"calICalendarManager");
activeCalendarManager.addObserver(ltnCalendarManagerObserver);
}
if (activeCalendarManager.getCalendars({}).length == 0) {
var homeCalendar = activeCalendarManager.createCalendar("storage",
makeURL("moz-profile-calendar://"));
activeCalendarManager.registerCalendar(homeCalendar);
homeCalendar.name = calGetString("calendar", "homeCalendarName");
var composite = getCompositeCalendar();
composite.addCalendar(homeCalendar);
// XXX this doesn't make it selected, but you do add to it
}
return activeCalendarManager;
}
/**
* Provides the gCalendars list for callers outside of this file.
*/
function getCalendars()
{
return gCalendars;
}
function ltnNewCalendar()
{
openCalendarWizard();
}
function ltnRemoveCalendar(cal)
{
// XXX in the future, we should ask the user if they want to delete the
// XXX files associated with this calendar or not!
getCalendarManager().unregisterCalendar(cal);
getCalendarManager().deleteCalendar(cal);
}
function ltnEditCalendarProperties(cal)
{
return openCalendarProperties(cal, function() { });
}
var ltnCalendarTreeView = {
get rowCount()
{
try {
return gCalendars.length;
} catch (e) {
return 0;
}
},
getCellProperties: function (row, col, properties)
{
var cal = gCalendars[row];
if (col.id == "col-calendar-Checkbox") {
// We key off this to set the images for the checkboxes
if (getCompositeCalendar().getCalendar(cal.uri)) {
properties.AppendElement(ltnGetAtom("checked"));
}
else {
properties.AppendElement(ltnGetAtom("unchecked"));
}
} else if (col.id == "col-calendar-Color") {
var color = getCalendarManager().getCalendarPref(cal, "color");
properties.AppendElement(ltnGetAtom(getColorPropertyName(color)));
}
},
cycleCell: function (row, col)
{
var cal = gCalendars[row];
if (getCompositeCalendar().getCalendar(cal.uri)) {
// need to remove it
getCompositeCalendar().removeCalendar(cal.uri);
} else {
// need to add it
getCompositeCalendar().addCalendar(cal);
}
document.getElementById("calendarTree").boxObject.invalidateRow(row);
},
getCellValue: function (row, col)
{
if (col.id == "col-calendar-Checkbox") {
var cal = gCalendars[row];
if (getCompositeCalendar().getCalendar(cal.uri))
return "true";
return "false";
}
dump ("*** Bad getCellValue (row: " + row + " col id: " + col.id + ")\n");
return null;
},
setCellValue: function (row, col, value)
{
if (col.id == "col-calendar-Checkbox") {
var cal = getCellValue()[row];
if (value == "true") {
getCompositeCalendar().addCalendar(cal);
} else {
getCompositeCalendar().removeCalendar(cal.uri);
}
return;
}
dump ("*** Bad setCellText (row: " + row + " col id: " + col.id + " val: " + value + ")\n");
},
getCellText: function (row, col)
{
if (col.id == "col-calendar-Checkbox" ||
col.id == "col-calendar-Color") {
return ""; // tooltip
}
if (col.id == "col-calendar-Calendar") {
try {
return gCalendars[row].name;
} catch (e) {
return "<Unknown " + row + ">";
}
}
dump ("*** Bad getCellText (row: " + row + " col id: " + col.id + ")\n");
return null;
},
isEditable: function(row, col) { return false; },
setTree: function(treebox) { this.treebox = treebox; },
isContainer: function(row) { return false; },
isSeparator: function(row) { return false; },
isSorted: function(row) { return false; },
getLevel: function(row) { return 0; },
getImageSrc: function(row, col) { return null; },
getRowProperties: function(row, props) { },
getColumnProperties: function(colid, col, props) { },
cycleHeader: function() { },
onDoubleClick: function(event)
{
// We only care about left-clicks
if (event.button != 0)
return;
// Find the row clicked on
var tree = document.getElementById("calendarTree");
var row = tree.treeBoxObject.getRowAt(event.clientX, event.clientY);
// If we clicked on a calendar, edit it, otherwise create a new one
var cal = gCalendars[row];
if (!cal) {
ltnNewCalendar();
} else {
ltnEditCalendarProperties(cal);
}
}
};
function ltnSetTreeView()
{
gCalendars = getCalendarManager().getCalendars({});
for each (var cal in gCalendars) {
updateLtnStyleSheet(cal);
}
document.getElementById("calendarTree").view = ltnCalendarTreeView;
// Ensure that a calendar is selected in calendar tree after startup.
if (document.getElementById("calendarTree").currentIndex == -1) {
var index = getIndexForCalendar(getCompositeCalendar().defaultCalendar);
var indexToSelect = (index != - 1) ? index : 0;
document.getElementById("calendarTree").view.selection.select(indexToSelect);
}
}
function getIndexForCalendar(aCalendar) {
for (var i = 0; i < gCalendars.length; ++i) {
if (gCalendars[i].id == aCalendar.id) {
return i;
}
}
return -1;
}
function getColorPropertyName(color) {
// strip hash (#) from color string
return "color-" + (color ? color.substr(1) : "default");
}
var gLtnStyleSheet;
function updateLtnStyleSheet(aCalendar) {
// check if rule already exists in style sheet
if (!gLtnStyleSheet) {
gLtnStyleSheet = getStyleSheet("chrome://lightning/skin/lightning.css");
}
var selectorPrefix = "treechildren::-moz-tree-cell";
var color = getCalendarManager().getCalendarPref(aCalendar, "color");
if (!color) {
return;
}
var propertyName = getColorPropertyName(color);
var selectorText = selectorPrefix + propertyName;
for (var i = 0; i < gLtnStyleSheet.cssRules.length; i++) {
if (gLtnStyleSheet.cssRules[i].selectorText == selectorText) {
return;
}
}
// add rule to style sheet
var ruleString = selectorPrefix + "(" + propertyName + ") { }";
gLtnStyleSheet.insertRule(ruleString, gLtnStyleSheet.cssRules.length);
var rule = gLtnStyleSheet.cssRules[gLtnStyleSheet.cssRules.length-1];
rule.style.backgroundColor = color;
rule.style.margin = "1px";
}
function updateColorCell(aCalendar) {
var row = getIndexForCalendar(aCalendar);
var treeBoxObject = document.getElementById("calendarTree").treeBoxObject;
var column = treeBoxObject.columns["col-calendar-Color"];
treeBoxObject.invalidateCell(row, column);
}
function updateTreeView(aCalendar) {
updateLtnStyleSheet(aCalendar);
updateColorCell(aCalendar);
}
window.addEventListener("load", ltnSetTreeView, false);
// Wire up the calendar observers.
window.addEventListener("load", getCalendarManager, false);

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

@ -179,48 +179,6 @@ var CalendarController =
}
};
function ltnSidebarCalendarSelected(tree)
{
var selectedCalendar = ltnSelectedCalendar();
if (!selectedCalendar) {
return;
}
var compositeCalendar = getCompositeCalendar();
if (!compositeCalendar.getCalendar(selectedCalendar.uri)) {
compositeCalendar.addCalendar(selectedCalendar);
}
compositeCalendar.defaultCalendar = selectedCalendar;
}
function ltnSelectedCalendar()
{
var index = document.getElementById("calendarTree").currentIndex;
return getCalendars()[index];
}
function ltnDeleteSelectedCalendar()
{
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
var result = {};
var calendarBundle = document.getElementById("bundle_calendar");
var calendar = ltnSelectedCalendar();
var ok = promptService.confirm(
window,
calendarBundle.getString("unsubscribeCalendarTitle"),
calendarBundle.getFormattedString("unsubscribeCalendarMessage",[calendar.name]),
result);
if (ok) {
ltnRemoveCalendar(calendar);
}
}
function ltnEditSelectedCalendar()
{
ltnEditCalendarProperties(ltnSelectedCalendar());
}
function today()
{
var d = Components.classes['@mozilla.org/calendar/datetime;1'].createInstance(Components.interfaces.calIDateTime);
@ -293,6 +251,9 @@ function ltnGoToDate()
function ltnOnLoad(event)
{
// Load the Calendar Manager
loadCalendarManager();
// take the existing folderPaneBox (that's what thunderbird displays
// at the left side of the application window) and stuff that inside
// of the deck we're introducing with the contentPanel. this essentially
@ -409,23 +370,13 @@ function ltnOnLoad(event)
// Hide the calendar view so it doesn't push the status-bar offscreen
collapseElement(document.getElementById("calendar-view-box"));
// Start observing preferences
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
var rootPrefBranch = prefService.getBranch("");
ltnPrefObserver.rootPrefBranch = rootPrefBranch;
var pb2 = rootPrefBranch.QueryInterface(
Components.interfaces.nsIPrefBranch2);
pb2.addObserver("calendar.", ltnPrefObserver, false);
ltnPrefObserver.observe(null, null, "");
// fire up the alarm service
var alarmSvc = Components.classes["@mozilla.org/calendar/alarm-service;1"]
.getService(Components.interfaces.calIAlarmService);
alarmSvc.timezone = calendarDefaultTimezone();
alarmSvc.startup();
// Add an unload function to the window so we don't leak the pref observer
// Add an unload function to the window so we don't leak any listeners
document.getElementById("messengerWindow")
.addEventListener("unload", ltnFinish, false);
@ -622,23 +573,10 @@ function LtnObserveDisplayDeckChange(event)
}
}
function ltnPublishCalendar()
{
publishEntireCalendar(ltnSelectedCalendar());
}
function ltnFinish() {
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
// Remove the pref observer
var pb2 = prefService.getBranch("");
pb2 = pb2.QueryInterface(Components.interfaces.nsIPrefBranch2);
pb2.removeObserver("calendar.", ltnPrefObserver);
getCompositeCalendar().removeObserver(agendaTreeView.calendarObserver);
getCompositeCalendar().removeObserver(ltnCompositeCalendarObserver);
getCalendarManager().removeObserver(ltnCalendarManagerObserver);
return;
unloadCalendarManager();
}
function ltnEditSelectedItem() {
@ -656,19 +594,6 @@ function ltnDeleteSelectedItem() {
false);
}
function ltnCreateEvent() {
calendarViewController.createNewEvent(ltnSelectedCalendar());
}
// Preference observer, watches for changes to any 'calendar.' pref
var ltnPrefObserver =
{
rootPrefBranch: null,
observe: function(aSubject, aTopic, aPrefName)
{
}
}
// After 1.5 was released, the search box was moved into an optional toolbar
// item, with a different ID. This function keeps us compatible with both.
function findMailSearchBox() {

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

@ -59,6 +59,8 @@
<?xml-stylesheet href="chrome://calendar/content/datetimepickers/minimonth.css" type="text/css"?>
<?xml-stylesheet href="chrome://calendar/content/datetimepickers/datetimepickers.css" type="text/css"?>
<?xul-overlay href="chrome://calendar/content/calendar-calendars-list.xul"?>
<overlay id="ltnSidebarOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
@ -73,7 +75,7 @@
<script type="application/x-javascript" src="chrome://calendar/content/import-export.js"/>
<script type="application/x-javascript" src="chrome://calendar/content/publish.js"/>
<script type="application/x-javascript" src="chrome://lightning/content/lightning-utils.js"/>
<script type="application/x-javascript" src="chrome://lightning/content/calendar-management.js"/>
<script type="application/x-javascript" src="chrome://calendar/content/calendar-management.js"/>
<script type="application/x-javascript" src="chrome://lightning/content/messenger-overlay-sidebar.js"/>
<script type="application/x-javascript" src="chrome://calendar/content/calendar-views.js"/>
<script type="application/x-javascript" src="chrome://calendar/content/calendar-minimonth-busy.js"/>
@ -83,11 +85,11 @@
<menupopup id="menu_NewPopup">
<menuseparator />
<menuitem id="ltnNewEvent" label="&lightning.menupopup.new.event.label;"
oncommand="createEventWithDialog(ltnSelectedCalendar());"/>
observes="calendar_new_event_command"/>
<menuitem id="ltnNewTask" label="&lightning.menupopup.new.task.label;"
oncommand="createTodoWithDialog(ltnSelectedCalendar());"/>
observes="calendar_new_todo_command"/>
<menuitem id="ltnNewCalendar" label="&lightning.menupopup.new.calendar.label;"
oncommand="ltnNewCalendar();"/>
observes="calendar_new_calendar_command"/>
</menupopup>
<menubar id="mail-menubar">
@ -98,11 +100,11 @@
<menuitem id="ltnEditSelectedCalendar"
label="&lightning.toolbar.edit.calendar.label;"
accesskey="&lightning.toolbar.edit.calendar.accesskey;"
oncommand="ltnEditSelectedCalendar();"/>
observes="calendar_edit_calendar_command"/>
<menuitem id="ltnDeleteSelectedCalendar"
label="&lightning.toolbar.delete.calendar.label;"
accesskey="&lightning.toolbar.delete.calendar.accesskey;"
oncommand="ltnDeleteSelectedCalendar();"/>
observes="calendar_delete_calendar_command"/>
<menuseparator/>
<menuitem id="ltnChangeViewDay"
label="&lightning.toolbar.day.label;"
@ -171,11 +173,16 @@
<window id="messengerWindow">
<commandset id="calendar_commands">
<command id="calendar_new_event_command" oncommand="createEventWithDialog(getSelectedCalendar());"/>
<command id="calendar_new_todo_command" oncommand="createTodoWithDialog(getSelectedCalendar());"/>
<command id="calendar_new_calendar_command" oncommand="openCalendarWizard();"/>
<command id="calendar_edit_calendar_command" oncommand="openCalendarProperties(getSelectedCalendar());"/>
<command id="calendar_delete_calendar_command" oncommand="promptDeleteCalendar(getSelectedCalendar());"/>
<command id="modify_command" oncommand="modifyEventWithDialog(currentView().getSelectedItems({})[0])" disabled="true" disabledwhennoeventsselected="true"/>
<command id="publish_calendar" oncommand="ltnPublishCalendar()" disabled="true" disabledwhennoeventsselected="true"/>
<command id="calendar_publish_calendar" oncommand="publishEntireCalendar(getSelectedCalendar());" disabled="true" disabledwhennoeventsselected="true"/>
<command id="import_command" oncommand="loadEventsFromFile()"/>
<command id="export_command" oncommand="exportEntireCalendar()" disabled="true" disabledwhennoeventsselected="true"/>
<command id="reload_remote_calendars" oncommand="getCompositeCalendar().refresh();"/>
<command id="calendar_reload_remote_calendars" oncommand="getCompositeCalendar().refresh();"/>
<command id="switch2mail" oncommand="ltnSwitch2Mail()"/>
<command id="switch2calendar" oncommand="ltnSwitch2Calendar()"/>
<command id="switch2task" oncommand="ltnSwitch2Task()"/>
@ -192,38 +199,7 @@
<key id="todaypanekey" modifiers="accel" key="D" command="cmd_toggleTodayPane"/>
</keyset>
<popupset>
<!-- Popup for Calendars tab -->
<popup id="calendartree-context-menu" onpopupshowing="return true;">
<menuitem id="calpopup-new"
label="&calendar.context.newserver.label;"
accesskey="&calendar.context.newserver.accesskey;"
oncommand="ltnNewCalendar();"/>
<menuitem id="calpopup-delete"
label="&calendar.context.deleteserver.label;"
accesskey="&calendar.context.deleteserver.accesskey;"
oncommand="ltnDeleteSelectedCalendar();"/>
<menuseparator/>
<menuitem id="calpopup-export"
label="&calendar.context.export.label;"
accesskey="&calendar.context.export.accesskey;"
oncommand="exportEntireCalendar(ltnSelectedCalendar())"/>
<menuitem id="calpopup-publish"
label="&calendar.context.publish.label;"
accesskey="&calendar.context.publish.accesskey;"
observes="publish_calendar"/>
<menuseparator/>
<menuitem id="calpopup-reload"
label="&calendar.context.reloadserver.label;"
accesskey="&calendar.context.reloadserver.accesskey;"
observes="reload_remote_calendars"/>
<menuseparator/>
<menuitem id="calpopup-edit"
label="&calendar.context.properties.label;"
accesskey="&calendar.context.properties.accesskey;"
oncommand="ltnEditSelectedCalendar();"/>
</popup>
<popupset id="calendar-popupset">
<popup id="calendar-view-context-menu" onpopupshowing="return true;">
<!-- These labels are set dynamically, based on the current view -->
<menuitem id="context_previous" label="" oncommand="moveView(-1)"
@ -276,24 +252,11 @@
<datepicker id="ltnDateTextPicker" onchange="ltnMinimonthPick(this)"/>
<spacer flex="1"/>
</hbox>
<separator/>
<vbox id="calendar-panel" flex="1">
<tree id="calendarTree" hidecolumnpicker="true" seltype="single"
onfocus="selectedCalendarPane(event)" flex="1"
onselect="ltnSidebarCalendarSelected(this);"
ondblclick="ltnCalendarTreeView.onDoubleClick(event);"
context="calendartree-context-menu">
<treecols>
<treecol id="col-calendar-Checkbox" cycler="true" fixed="true" width="18" >
<image />
</treecol>
<treecol id="col-calendar-Color" fixed="true" width="18"/>
<treecol id="col-calendar-Calendar" label="&lightning.calendar.label;" flex="1"/>
</treecols>
<treechildren>
</treechildren>
</tree>
</vbox>
<separator/>
<vbox id="calendar-panel" flex="1">
<!-- This will be overlayed by calendar-calendars-list.xul -->
<tree id="calendar-list-tree" flex="1"/>
</vbox>
</vbox>
</deck>
@ -358,5 +321,3 @@
<vbox id="messagepanebox"/>
</overlay>
<!-- -*- Mode: xml; sgml-ident-step: 2; indent-tabs-mode: nil; -*- -->

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

@ -25,6 +25,7 @@
- Vladimir Vukicevic <vladimir@pobox.com>
- Simon Paquet <bugzilla@babylonsounds.com>
- Berend Cornelius <berend.cornelius@sun.com>
- Philipp Kewisch <mozilla@kewis.ch>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@ -73,13 +74,13 @@
class="cal-toolbarbutton-1"
label="&calendar.newevent.button.label;"
tooltiptext="&calendar.newevent.button.tooltip;"
oncommand="createEventWithDialog(ltnSelectedCalendar())"/>
observes="calendar_new_event_command"/>
<toolbarbutton id="calendar-new-task-button"
mode="calendar"
class="cal-toolbarbutton-1"
label="&calendar.newtask.button.label;"
tooltiptext="&calendar.newtask.button.tooltip;"
oncommand="createTodoWithDialog(ltnSelectedCalendar())"/>
observes="calendar_new_todo_command"/>
<toolbarbutton id="calendar-day-view-button"
mode="calendar"
type="radio"
@ -152,13 +153,13 @@
class="cal-toolbarbutton-1"
label="&calendar.publish.button.label;"
tooltiptext="&calendar.publish.button.tooltip;"
observes="publish_calendar"/>
observes="calendar_publish_calendar"/>
<toolbarbutton id="calendar-remote-reload-button"
mode="calendar"
class="cal-toolbarbutton-1"
label="&calendar.remotereload.button.label;"
tooltiptext="&calendar.remotereload.button.tooltip;"
observes="reload_remote_calendars"/>
observes="calendar_reload_remote_calendars"/>
</toolbarpalette>
<toolbox id="mail-toolbox">

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

@ -1,103 +0,0 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Lightning code.
*
* The Initial Developer of the Original Code is Oracle Corporation
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Mike Shaver <shaver@mozilla.org>
* Stefan Sitter <ssitter@googlemail.com>
* Philipp Kewisch <mozilla@kewis.ch>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function eventToTodo(event)
{
try {
return event.originalTarget.selectedItem.todo;
} catch (e) {
return null;
}
}
function editTodoItem(event)
{
var todo = eventToTodo(event);
if (todo)
modifyEventWithDialog(todo);
}
function newTodoItem(event)
{
createTodoWithDialog(ltnSelectedCalendar());
}
function deleteTodoItem(event)
{
var todo = eventToTodo(event);
if (todo)
todo.calendar.deleteItem(todo, null);
}
function initializeTodoList()
{
var todoList = document.getElementById("calendar-todo-list");
todoList.calendar = getCompositeCalendar();
todoList.addEventListener("todo-item-open", editTodoItem, false);
todoList.addEventListener("todo-item-delete", deleteTodoItem, false);
todoList.addEventListener("todo-empty-dblclick", newTodoItem, false);
todoList.showCompleted = document.getElementById("completed-tasks-checkbox").checked;
return;
}
function finishTodoList() {
var todoList = document.getElementById("calendar-todo-list");
todoList.removeEventListener("todo-item-open", editTodoItem, false);
todoList.removeEventListener("todo-item-delete", deleteTodoItem, false);
todoList.removeEventListener("todo-empty-dblclick", newTodoItem, false);
}
function toggleCompletedTasks()
{
document.getElementById("calendar-todo-list").showCompleted =
!document.getElementById("calendar-todo-list").showCompleted;
agendaTreeView.refreshCalendarQuery();
for each (view in getViewDeck().childNodes) {
view.showCompleted = !view.showCompleted;
}
// Refresh the current view
currentView().goToDay(currentView().selectedDay);
return;
}
window.addEventListener("load", initializeTodoList, false);
window.addEventListener("unload", finishTodoList, false);

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

@ -3,7 +3,6 @@ lightning.jar:
* content/lightning/messenger-overlay-sidebar.xul (content/messenger-overlay-sidebar.xul)
content/lightning/messenger-overlay-sidebar.js (content/messenger-overlay-sidebar.js)
content/lightning/messenger-overlay-sidebar.css (content/messenger-overlay-sidebar.css)
content/lightning/calendar-management.js (content/calendar-management.js)
content/lightning/lightning-widgets.css (content/lightning-widgets.css)
content/lightning/agenda-tree-overlay.xul (content/agenda-tree-overlay.xul)
content/lightning/agenda-tree.js (content/agenda-tree.js)
@ -57,8 +56,8 @@ calendar.jar:
#expand skin/classic/calendar/all_day_event.png (/calendar/resources/skin/classic/all_day_event.png)
#expand skin/classic/calendar/all_day_event_down.png (/calendar/resources/skin/classic/all_day_event_down.png)
#expand skin/classic/calendar/all_day_event_hover.png (/calendar/resources/skin/classic/all_day_event_hover.png)
#expand skin/classic/calendar/checkbox_checked.png (/calendar/resources/skin/classic/unifinder/checkbox_checked.png)
#expand skin/classic/calendar/checkbox_unchecked.png (/calendar/resources/skin/classic/unifinder/checkbox_unchecked.png)
#expand skin/classic/calendar/unifinder/checkbox_checked.png (/calendar/resources/skin/classic/unifinder/checkbox_checked.png)
#expand skin/classic/calendar/unifinder/checkbox_unchecked.png (/calendar/resources/skin/classic/unifinder/checkbox_unchecked.png)
#expand skin/classic/calendar/dot.png (/calendar/resources/skin/classic/dot.png)
#expand skin/classic/calendar/dot_selected.png (/calendar/resources/skin/classic/dot_selected.png)
#expand skin/classic/calendar/datetimepickers/datetimepickers.css (/calendar/resources/skin/classic/datetimepickers/datetimepickers.css)

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

@ -22,6 +22,7 @@
* Vladimir Vukicevic <vladimir@pobox.com>
* Joey Minta <jminta@gmail.com>
* Simon Paquet <bugzilla@babylonsounds.com>
* Philipp Kewisch <mozilla@kewis.ch>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -59,21 +60,10 @@ calendar-todo-item[selected="true"] {
color: HighlightText;
}
treechildren::-moz-tree-image(col-calendar-Checkbox, checked) {
list-style-image: url("chrome://calendar/skin/checkbox_checked.png");
}
/* Calendar list rules */
treechildren::-moz-tree-image(col-calendar-Checkbox, unchecked) {
list-style-image: url("chrome://calendar/skin/checkbox_unchecked.png");
}
treechildren::-moz-tree-cell-text(agenda-header) {
font-weight: bold;
}
treechildren::-moz-tree-cell(color-default) {
background-color: #a8c2e1;
margin: 1px;
#calendar-panel {
padding: 0px 5px 5px;
}
/*--------------------------------------------------------------------

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

@ -22,6 +22,7 @@
* Vladimir Vukicevic <vladimir@pobox.com>
* Joey Minta <jminta@gmail.com>
* Simon Paquet <bugzilla@babylonsounds.com>
* Philipp Kewisch <mozilla@kewis.ch>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -59,21 +60,10 @@ calendar-todo-item[selected="true"] {
color: HighlightText;
}
treechildren::-moz-tree-image(col-calendar-Checkbox, checked) {
list-style-image: url("chrome://calendar/skin/checkbox_checked.png");
}
/* Calendar list rules */
treechildren::-moz-tree-image(col-calendar-Checkbox, unchecked) {
list-style-image: url("chrome://calendar/skin/checkbox_unchecked.png");
}
treechildren::-moz-tree-cell-text(agenda-header) {
font-weight: bold;
}
treechildren::-moz-tree-cell(color-default) {
background-color: #a8c2e1;
margin: 1px;
#calendar-panel {
padding: 0px 5px 5px;
}
/*--------------------------------------------------------------------

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

@ -114,14 +114,14 @@ function calendarInit()
updateOrientation();
// set up the unifinder
prepareCalendarUnifinder();
prepareCalendarToDoUnifinder();
scheduleMidnightUpdate(refreshUIBits);
initCalendarManager();
loadCalendarManager();
// fire up the alarm service
var alarmSvc = Components.classes["@mozilla.org/calendar/alarm-service;1"]
@ -226,76 +226,9 @@ function calendarFinish()
finishCalendarToDoUnifinder();
finishCalendarManager();
unloadCalendarManager();
}
function newCalendarDialog()
{
openCalendarWizard();
}
function editCalendarDialog(event)
{
openCalendarProperties(document.popupNode.calendar, null);
}
function calendarListboxDoubleClick(event) {
if(event.target.calendar)
openCalendarProperties(event.target.calendar, null);
else
openCalendarWizard();
}
function checkCalListTarget() {
if(!document.popupNode.calendar) {
document.getElementById("calpopup-edit").setAttribute("disabled", "true");
document.getElementById("calpopup-delete").setAttribute("disabled", "true");
document.getElementById("calpopup-publish").setAttribute("disabled", "true");
}
else {
document.getElementById("calpopup-edit").removeAttribute("disabled");
document.getElementById("calpopup-delete").removeAttribute("disabled");
document.getElementById("calpopup-publish").removeAttribute("disabled");
}
}
function deleteCalendar(event)
{
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
var result = {};
var calendarBundle = document.getElementById("bundle_calendar");
var calendar = document.popupNode.calendar;
var ok = promptService.confirm(
window,
calendarBundle.getString("unsubscribeCalendarTitle"),
calendarBundle.getFormattedString("unsubscribeCalendarMessage",[calendar.name]),
result);
if (ok) {
getCompositeCalendar().removeCalendar(calendar.uri);
var calMgr = getCalendarManager();
calMgr.unregisterCalendar(calendar);
calMgr.deleteCalendar(calendar);
}
}
/**
* Get the default calendar selected in the calendars tab.
* Returns a calICalendar object, or null if none selected.
*/
function getSelectedCalendarOrNull()
{
var selectedCalendarItem = document.getElementById( "list-calendars-listbox" ).selectedItem;
if ( selectedCalendarItem )
return selectedCalendarItem.calendar;
else
return null;
}
/**
* Delete the current selected item with focus from the ToDo unifinder list
*/

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

@ -1,437 +0,0 @@
/* -*- Mode: javascript; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla calendar code.
*
* The Initial Developer of the Original Code is
* Michiel van Leeuwen <mvl@exedo.nl>
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Joey Minta <jminta@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function getListItem(aCalendar) {
var calendarList = document.getElementById("list-calendars-listbox");
for (var item = calendarList.firstChild;
item;
item = item.nextSibling) {
if (item.calendar && item.calendar.uri.equals(aCalendar.uri)) {
return item;
}
}
return false;
}
// For observing changes to the list of calendars
var calCalendarManagerObserver = {
QueryInterface: function(aIID) {
if (!aIID.equals(Components.interfaces.calICalendarManagerObserver) &&
!aIID.equals(Components.interfaces.nsISupports)) {
throw Components.results.NS_ERROR_NO_INTERFACE;
}
return this;
},
onCalendarRegistered: function(aCalendar) {
// Enable new calendars by default
getCompositeCalendar().addCalendar(aCalendar);
setCalendarManagerUI();
document.getElementById("new_command").removeAttribute("disabled");
document.getElementById("new_todo_command").removeAttribute("disabled");
if (aCalendar.canRefresh) {
var remoteCommand = document.getElementById("reload_remote_calendars");
remoteCommand.removeAttribute("disabled");
}
},
onCalendarUnregistering: function(aCalendar) {
var item = getListItem(aCalendar);
if (item) {
var listbox = document.getElementById("list-calendars-listbox");
var oldIndex = listbox.selectedIndex;
if (item == listbox.lastChild) {
oldIndex--;
}
listbox.removeChild(item);
// This is called before the calendar is actually deleted, so ==1 is correct
if (getCalendarManager().getCalendars({}).length <= 1) {
// If there are no calendars, you can't create events/tasks
document.getElementById("new_command").setAttribute("disabled", true);
document.getElementById("new_todo_command").setAttribute("disabled", true);
} else {
listbox.selectedIndex = oldIndex;
}
}
if (aCalendar.canRefresh) {
// We may have just removed our last remote cal. Then we'd need to
// disabled the reload-remote-calendars command
var calendars = getCalendarManager().getCalendars({});
function calCanRefresh(cal) {
return (cal.canRefresh && !cal.uri.equals(aCalendar.uri));
}
if (!calendars.some(calCanRefresh)) {
var remoteCommand = document.getElementById("reload_remote_calendars");
remoteCommand.setAttribute("disabled", true);
}
}
},
onCalendarDeleting: function(aCalendar) {
setCalendarManagerUI();
},
onCalendarPrefSet: function(aCalendar, aName, aValue) {
var item = getListItem(aCalendar);
if (aName == 'color') {
if (item) {
var colorCell = item.childNodes[1];
colorCell.style.background = aValue;
}
updateStyleSheetForObject(aCalendar, gCachedStyleSheet);
} else if (aName == 'name') {
if (item) {
var nameCell = item.childNodes[2];
nameCell.setAttribute("label", aCalendar.name);
}
}
},
onCalendarPrefDeleting: function(aCalendar, aName) {
if (aName != 'color' && aName != 'name') {
return;
}
setCalendarManagerUI();
if (aName == 'color')
updateStyleSheetForObject(aCalendar, gCachedStyleSheet);
}
};
// For observing changes to the list of _active_ calendars
var calCompositeCalendarObserver = {
QueryInterface: function(aIID) {
if (!aIID.equals(Components.interfaces.calIObserver) &&
!aIID.equals(Components.interfaces.calICompositeObserver) &&
!aIID.equals(Components.interfaces.nsISupports)) {
throw Components.results.NS_ERROR_NO_INTERFACE;
}
return this;
},
// calICompositeObserver
onCalendarAdded: function (aCalendar) {
var item = getListItem(aCalendar);
if (item) {
var checkCell = item.firstChild;
checkCell.setAttribute('checked', true);
}
},
onCalendarRemoved: function (aCalendar) {
var item = getListItem(aCalendar);
if (item) {
var checkCell = item.firstChild;
checkCell.setAttribute('checked', false);
}
},
onDefaultCalendarChanged: function (aNewDefaultCalendar) {
// make the calendar bold in the tree
},
// calIObserver
onStartBatch: function() { },
onEndBatch: function() { },
onLoad: function() { },
onAddItem: function(aItem) { },
onModifyItem: function(aNewItem, aOldItem) { },
onDeleteItem: function(aDeletedItem) { },
onError: function(aErrNo, aMessage) { }
};
function onCalendarCheckboxClick(event) {
// This is a HACK.
// It seems to be impossible to add onClick to a listCell.
// Workaround that by checking the coordinates of the click.
var checkElem = event.target.firstChild;
if ((event.clientX < checkElem.boxObject.x + checkElem.boxObject.width) &&
(event.clientX > checkElem.boxObject.x)) {
// clicked the checkbox cell
// XXX Fix for bug #350323, needs improvement.
// If the user clicks with the mouse on a checkbox, the timer which
// adds the selected calendar to the composite calendar is cancelled.
// Otherwise it's not possible for the user to add/remove calendars
// to/from the composite calendar by clicking on the checkbox.
if (gCalendarListSelectTimeout) {
clearTimeout(gCalendarListSelectTimeout);
gCalendarListSelectTimeout = null;
}
var cal = event.target.calendar;
if (checkElem.getAttribute('checked') == "true") {
getCompositeCalendar().removeCalendar(cal.uri);
} else {
getCompositeCalendar().addCalendar(cal);
}
event.preventDefault();
}
}
function setCalendarManagerUI()
{
var calendarList = document.getElementById("list-calendars-listbox");
var oldSelection = calendarList.selectedIndex;
var child;
while ((child = calendarList.lastChild) && (child.tagName == "listitem")) {
calendarList.removeChild(child);
}
var composite = getCompositeCalendar();
var calmgr = getCalendarManager();
var calendars = calmgr.getCalendars({});
var hasRefreshableCal = false;
for each (var calendar in calendars) {
if (calendar.canRefresh) {
hasRefreshableCal = true;
}
var listItem = document.createElement("listitem");
var checkCell = document.createElement("listcell");
checkCell.setAttribute("type", "checkbox");
checkCell.setAttribute("checked",
composite.getCalendar(calendar.uri) ? true : false);
listItem.appendChild(checkCell);
listItem.addEventListener("click", onCalendarCheckboxClick, true);
var colorCell = document.createElement("listcell");
try {
var calColor = calmgr.getCalendarPref(calendar, 'color');
colorCell.style.background = calColor;
} catch(e) {}
listItem.appendChild(colorCell);
var nameCell = document.createElement("listcell");
nameCell.setAttribute("label", calendar.name);
listItem.appendChild(nameCell);
listItem.calendar = calendar;
calendarList.appendChild(listItem);
}
// Ensure that a calendar is selected in calendar list after startup.
if (!oldSelection || oldSelection < 0) {
var defaultCalendar = composite.defaultCalendar;
var item = defaultCalendar ? getListItem(defaultCalendar) : null;
oldSelection = item ? calendarList.getIndexOfItem(item) : 0;
}
if (oldSelection >= calendars.length) {
oldSelection = calendars.length-1;
}
calendarList.selectedIndex = oldSelection;
var remoteCommand = document.getElementById("reload_remote_calendars");
if (!hasRefreshableCal) {
remoteCommand.setAttribute("disabled", true);
} else {
remoteCommand.removeAttribute("disabled");
}
}
var gCalendarListSelectTimeout;
function onCalendarListSelect() {
// XXX Fix for bug #350323, needs improvement.
// Set up a timer, which schedules adding the selected calendar to the
// composite calendar.
gCalendarListSelectTimeout = setTimeout(calendarListSelectHandler, 400);
}
function calendarListSelectHandler() {
var selectedCalendar = getSelectedCalendarOrNull();
if (!selectedCalendar) {
return;
}
var compositeCalendar = getCompositeCalendar();
if (!compositeCalendar.getCalendar(selectedCalendar.uri)) {
compositeCalendar.addCalendar(selectedCalendar);
}
compositeCalendar.defaultCalendar = selectedCalendar;
}
function initCalendarManager()
{
var calMgr = getCalendarManager();
var composite = getCompositeCalendar();
if (calMgr.getCalendars({}).length == 0) {
var homeCalendar = calMgr.createCalendar("storage", makeURL("moz-profile-calendar://"));
calMgr.registerCalendar(homeCalendar);
var name = calGetString("calendar", "homeCalendarName");
homeCalendar.name = name;
composite.addCalendar(homeCalendar);
// Wrapping this in a try/catch block, as if any of the migration code
// fails, the app may not load.
try {
gDataMigrator.checkAndMigrate();
} catch (e) {
Components.utils.reportError("Migrator error: " + e);
}
}
calMgr.addObserver(calCalendarManagerObserver);
composite.addObserver(calCompositeCalendarObserver);
setCalendarManagerUI();
initColors();
var calendarList = document.getElementById("list-calendars-listbox");
calendarList.addEventListener("select", onCalendarListSelect, true);
// Set up a pref listener so the proper UI bits can be refreshed when prefs
// are changed.
var prefService = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService);
var pb2 = prefService.getBranch("").QueryInterface(Ci.nsIPrefBranch2);
pb2.addObserver("calendar.", calPrefObserver, false);
}
function finishCalendarManager() {
// Remove the category color pref observer
var prefService = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService);
var pbi = prefService.getBranch("");
pbi = pbi.QueryInterface(Components.interfaces.nsIPrefBranch2);
pbi.removeObserver("calendar.category.color.", categoryPrefObserver);
pbi.removeObserver("calendar.", calPrefObserver);
var calendarList = document.getElementById("list-calendars-listbox");
calendarList.removeEventListener("select", onCalendarListSelect, true);
getCalendarManager().removeObserver(calCalendarManagerObserver);
}
function getDefaultCalendar()
{
var calendarList = document.getElementById("list-calendars-listbox");
try {
var selectedCalendar = calendarList.selectedItem.calendar;
return selectedCalendar;
} catch(e) {
newCalendarDialog();
selectedCalendar = calendarList.selectedItem.calendar;
return selectedCalendar;
}
return false;
}
function reloadCalendars()
{
getCompositeCalendar().refresh();
}
var gCachedStyleSheet;
function initColors() {
var calendars = getCalendarManager().getCalendars({});
gCachedStyleSheet = getStyleSheet("chrome://calendar/content/calendar-view-bindings.css");
for (var j in calendars)
updateStyleSheetForObject(calendars[j], gCachedStyleSheet);
var prefService = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService);
var categoryPrefBranch = prefService.getBranch("calendar.category.color.");
var prefArray = categoryPrefBranch.getChildList("", {});
for (var i = 0; i < prefArray.length; i++)
updateStyleSheetForObject(prefArray[i], gCachedStyleSheet);
// Setup css classes for category colors
var catergoryPrefBranch = prefService.getBranch("");
var pbi = catergoryPrefBranch.QueryInterface(
Components.interfaces.nsIPrefBranch2);
pbi.addObserver("calendar.category.color.", categoryPrefObserver, false);
categoryPrefObserver.observe(null, null, "");
}
var categoryPrefObserver =
{
observe: function(aSubject, aTopic, aPrefName)
{
var name = aPrefName;
// We only want the actual category name. 24 is the length of the
// leading 'calendar.category.color.' term
name = name.substr(24, aPrefName.length - 24);
updateStyleSheetForObject(name, gCachedStyleSheet);
}
}
var gCompositeCalendar = null;
function getCompositeCalendar()
{
if (!gCompositeCalendar) {
gCompositeCalendar = Components.classes["@mozilla.org/calendar/calendar;1?type=composite"]
.createInstance(Components.interfaces.calICompositeCalendar);
gCompositeCalendar.prefPrefix = 'calendar-main';
}
return gCompositeCalendar;
}
var calPrefObserver =
{
observe: function(aSubject, aTopic, aPrefName)
{
subject = aSubject.QueryInterface(Components.interfaces.nsIPrefBranch2);
switch (aPrefName) {
case "calendar.week.start":
document.getElementById("lefthandcalendar").refreshDisplay(true);
break;
case "calendar.date.format":
var currentView = document.getElementById("view-deck").selectedPanel;
currentView.goToDay(currentView.selectedDay);
refreshEventTree();
toDoUnifinderRefresh();
break;
case "calendar.timezone.local":
gDefaultTimezone = subject.getCharPref(aPrefName);
var currentView = document.getElementById("view-deck").selectedPanel;
currentView.goToDay(currentView.selectedDay);
refreshEventTree();
toDoUnifinderRefresh();
break;
default :
break;
}
}
}

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

@ -20,6 +20,7 @@
*
* Contributor(s): ArentJan Banck <ajbanck@planet.nl>
* Joey Minta <jminta@gmail.com>
* Philipp Kewisch <mozilla@kewis.ch>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -251,8 +252,10 @@ function pasteFromClipboard()
if (!earliestDate || date.compare(earliestDate) < 0)
earliestDate = date;
}
var destCal = ("ltnSelectedCalendar" in window) ?
ltnSelectedCalendar() : getDefaultCalendar();
var destCal = getSelectedCalendar();
if (!destCal) {
return;
}
var firstDate = currentView().selectedDay;
if (!firstDate.isMutable) {
firstDate = firstDate.clone();

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

@ -4,7 +4,6 @@ calendar.jar:
% content calendar %content/calendar/
content/calendar/attachFile.js (content/attachFile.js)
* content/calendar/calendar.js (content/calendar.js)
content/calendar/calendarManagement.js (content/calendarManagement.js)
content/calendar/calendarWindow.js (content/calendarWindow.js)
content/calendar/calendarCreation.xul (content/calendarCreation.xul)
content/calendar/calendarCreation.js (content/calendarCreation.js)

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

@ -55,12 +55,12 @@
key="new_event_key"
label="&event.new.event;"
accesskey="&event.new.event.accesskey;"
observes="new_command"/>
observes="calendar_new_event_command"/>
<menuitem id="calendar-new-todo-menu"
key="new_todo_key"
label="&event.new.todo;"
accesskey="&event.new.todo.accesskey;"
observes="new_todo_command"/>
observes="calendar_new_todo_command"/>
<!-- XXX lilmatt: Finish this!
<menuitem key="new_journal_key"
id="calendar-new-journal-menu"
@ -71,7 +71,7 @@
key="new_calendar_key"
label="&calendar.new.server.label;"
accesskey="&calendar.new.server.accesskey;"
observes="new_calendar_command"/>
observes="calendar_new_calendar_command"/>
<menuitem id="calendar-open-calendar-menu"
key="open_calendar_key"
label="&calendar.open.file.label;"
@ -80,7 +80,7 @@
<menuitem id="calendar-addserver-menu"
label="&calendar.subscribe.label;"
accesskey="&calendar.subscribe.accesskey;"
observes="new_calendar_command"/>
observes="calendar_new_calendar_command"/>
<menuseparator id="calendar-new-sep"/>
<!-- import: pulling data into existing files -->
@ -113,7 +113,7 @@
key="reload_server_key"
label="&calendar.reloadserver.label;"
accesskey="&calendar.reloadserver.accesskey;"
observes="reload_remote_calendars"/>
observes="calendar_reload_remote_calendars"/>
<menuseparator id="calendar-reload-sep"/>
<menuitem id="calendar-page-setup-menu"

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

@ -55,7 +55,7 @@
#endif
<!-- NEEDED FOR MULTIPLE CALENDAR SUPPORT -->
<script type="application/x-javascript" src="chrome://calendar/content/calendarManagement.js"/>
<script type="application/x-javascript" src="chrome://calendar/content/calendar-management.js"/>
<!-- NEEDED FOR CLIPBOARD SUPPORT -->
<script type="application/x-javascript" src="chrome://calendar/content/clipboard.js"/>

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

@ -29,6 +29,7 @@
# Matthew Willis <mattwillis@gmail.com>
# Stefan Sitter <ssitter@googlemail.com>
# Dan Mosedale <dan.mosedale@oracle.com>
# Philipp Kewisch <mozilla@kewis.ch>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -49,7 +50,7 @@
</broadcasterset>
<commandset id="calendar_commands">
<command id="new_command" oncommand="createEventWithDialog()"/>
<command id="calendar_new_event_command" oncommand="createEventWithDialog(getSelectedCalendar());"/>
<command id="delete_command" oncommand="deleteEventCommand( )" disabled="true" disabledwhennoeventsselected="true"/>
<command id="delete_command_no_confirm" oncommand="deleteEventCommand( true )" disabled="true" disabledwhennoeventsselected="true"/>
<command id="modify_command" oncommand="modifyEventWithDialog(currentView().getSelectedItems({})[0])" disabled="true" disabledwhennoeventsselected="true"/>
@ -63,14 +64,14 @@
<command id="paste_command" oncommand="pasteFromClipboard()"/>
<command id="select_all_command" oncommand="selectAllEvents()"/>
<command id="new_todo_command" oncommand="createTodoWithDialog()"/>
<command id="calendar_new_todo_command" oncommand="createTodoWithDialog(getSelectedCalendar());"/>
<command id="modify_todo_command" oncommand="editToDo()"/>
<command id="delete_todo_command" oncommand="deleteToDoCommand()" disabled="true"/>
<command id="new_calendar_command" oncommand="newCalendarDialog()"/>
<command id="calendar_new_calendar_command" oncommand="openCalendarWizard();"/>
<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="calendar_edit_calendar_command" oncommand="openCalendarProperties(getSelectedCalendar(), null);"/>
<command id="calendar_delete_calendar_command" oncommand="promptDeleteCalendar(getSelectedCalendar());"/>
<command id="find_new_calendar_command" oncommand="goFindNewCalendars()"/>
<command id="next_command" oncommand="moveView(1)"/>
@ -87,8 +88,8 @@
<command id="export_command" oncommand="saveEventsToFile(currentView().getSelectedItems({}))" disabled="true" disabledwhennoeventsselected="true"/>
<command id="ask_and_export_calendar" oncommand="exportEntireCalendar()"/>
<command id="reload_remote_calendars" oncommand="reloadCalendars()"/>
<command id="publish_calendar" oncommand="publishEntireCalendar(getDefaultCalendar())"/>
<command id="calendar_reload_remote_calendars" oncommand="getCompositeCalendar().refresh()"/>
<command id="calendar_publish_calendar" oncommand="publishEntireCalendar(getSelectedCalendar())"/>
<command id="ask_and_publish_calendar" oncommand="publishEntireCalendar()"/>
<command id="publish_events_command" oncommand="publishCalendarData()" disabled="true" disabledwhennoeventsselected="true"/>
@ -117,13 +118,13 @@
</commandset>
<keyset>
<key id="new_event_key" key="&event.new.event.key;" observes="new_command" modifiers="accel"/>
<key id="new_todo_key" key="&event.new.todo.key;" observes="new_todo_command" modifiers="accel"/>
<key id="new_event_key" key="&event.new.event.key;" observes="calendar_new_event_command" modifiers="accel"/>
<key id="new_todo_key" key="&event.new.todo.key;" observes="calendar_new_todo_command" modifiers="accel"/>
#XXX lilmatt: Finish this!
<key id="new_journal_key" key="&calendar.new.journal.key;" modifiers="accel"/>
<key id="modify_event_key" key="&event.edit.event.key;" observes="modify_command" modifiers="accel"/>
<key id="new_calendar_key" key="&calendar.new.server.key;" observes="new_calendar_command" modifiers="accel"/>
<key id="new_calendar_key" key="&calendar.new.server.key;" observes="calendar_new_calendar_command" modifiers="accel"/>
<key id="open_calendar_key" key="&calendar.open.file.key;" observes="open_local_calendar_command" modifiers="accel"/>
<key id="key_close" key="&calendar.menu.options.close.key;" observes="close_calendar_command" modifiers="accel"/>
<key id="print_key" key="&calendar.print.key;" observes="print_command" modifiers="accel"/>
@ -149,7 +150,7 @@
<key id="go_to_date_key" keycode="VK_UP" observes="go_date_command" modifiers="accel"/>
<key id="import_key" key="&calendar.import.key;" observes="import_command" modifiers="accel"/>
<key id="reload_server_key" key="&calendar.reloadserver.key;" observes="reload_remote_calendars" modifiers="accel"/>
<key id="reload_server_key" key="&calendar.reloadserver.key;" observes="calendar_reload_remote_calendars" modifiers="accel"/>
<key id="find_key"
key="&calendar.find.key;"

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

@ -28,6 +28,7 @@
- ArentJan Banck <ajbanck@planet.nl>
- Eric Belhaire <belhaire@ief.u-psud.fr>
- Stefan Sitter <ssitter@googlemail.com>
- Philipp Kewisch <mozilla@kewis.ch>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
@ -56,6 +57,7 @@
<!-- Overlays -->
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://calendar/content/calendar-calendars-list.xul"?>
<!-- All DTD information is stored in a separate file so that it can be shared by
hiddenWindow.xul. -->
@ -83,186 +85,188 @@
#include calendar-scripts.inc
<!-- GENERAL CONTEXT MENU -->
<popup id="context-menu"
onpopupshowing="document.getElementById('is_editable').hidden = (document.popupNode.getAttribute('id') == 'lefthandcalendar')">
<popupset id="calendar-popupset">
<popup id="context-menu"
onpopupshowing="document.getElementById('is_editable').hidden = (document.popupNode.getAttribute('id') == 'lefthandcalendar')">
<menuitem label="&calendar.context.newevent.label;"
accesskey="&calendar.context.newevent.accesskey;"
id="general-context-menu-newevent"
observes="new_command"/>
<menuitem label="&calendar.context.newtodo.label;"
accesskey="&calendar.context.newtodo.accesskey;"
id="general-context-menu-newtodo"
observes="new_todo_command"/>
<menuitem label="&calendar.context.modifyevent.label;"
accesskey="&calendar.context.modifyevent.accesskey;"
id="general-context-menu-modify"
observes="modify_command" />
<menuitem label="&calendar.context.deleteevent.label;"
accesskey="&calendar.context.deleteevent.accesskey;"
id="general-context-menu-delete"
observes="delete_command"/>
<menuitem label="&calendar.context.newevent.label;"
accesskey="&calendar.context.newevent.accesskey;"
id="general-context-menu-newevent"
observes="new_command"/>
<menuitem label="&calendar.context.newtodo.label;"
accesskey="&calendar.context.newtodo.accesskey;"
id="general-context-menu-newtodo"
observes="new_todo_command"/>
<menuitem label="&calendar.context.modifyevent.label;"
accesskey="&calendar.context.modifyevent.accesskey;"
id="general-context-menu-modify"
observes="modify_command" />
<menuitem label="&calendar.context.deleteevent.label;"
accesskey="&calendar.context.deleteevent.accesskey;"
id="general-context-menu-delete"
observes="delete_command"/>
<menuseparator/>
<menuitem label="&calendar.context.cutevent.label;"
accesskey="&calendar.context.cutevent.accesskey;"
id="general-context-menu-cut"
observes="cut_command">
<observes element="is_editable" attribute="hidden"/>
</menuitem>
<menuitem label="&calendar.context.copyevent.label;"
accesskey="&calendar.context.copyevent.accesskey;"
id="general-context-menu-copy"
observes="copy_command">
<observes element="is_editable" attribute="hidden"/>
</menuitem>
<menuitem label="&calendar.context.pasteevent.label;"
accesskey="&calendar.context.pasteevent.accesskey;"
id="general-context-menu-paste"
observes="paste_command">
<observes element="is_editable" attribute="hidden"/>
</menuitem>
<menuseparator>
<observes element="is_editable" attribute="hidden"/>
</menuseparator>
<menuitem label="&calendar.context.selectall.label;"
accesskey="&calendar.context.selectall.accesskey;"
id="general-context-menu-selectall"
observes="select_all_command">
<observes element="is_editable" attribute="hidden"/>
</menuitem>
<menuseparator>
<observes element="is_editable" attribute="hidden"/>
</menuseparator>
<menuitem label="&calendar.context.gototoday.label;"
accesskey="&calendar.context.gototoday.accesskey;"
id="general-context-menu-gototoday"
observes="go_today_command"/>
<menuseparator/>
<menuitem id="only-workday-checkbox-2"
type="checkbox"
label="&calendar.onlyworkday.checkbox.label;"
accesskey="&calendar.onlyworkday.checkbox.accesskey;"
observes="toggle_workdays_only"/>
<menuitem id="display-todo-inview-checkbox-2"
type="checkbox"
label="&calendar.displaytodos.checkbox.label;"
accesskey="&calendar.displaytodos.checkbox.accesskey;"
observes="toggle_tasks_in_view"/>
</popup>
<menuseparator/>
<menuitem label="&calendar.context.cutevent.label;"
accesskey="&calendar.context.cutevent.accesskey;"
id="general-context-menu-cut"
observes="cut_command">
<observes element="is_editable" attribute="hidden"/>
</menuitem>
<menuitem label="&calendar.context.copyevent.label;"
accesskey="&calendar.context.copyevent.accesskey;"
id="general-context-menu-copy"
observes="copy_command">
<observes element="is_editable" attribute="hidden"/>
</menuitem>
<menuitem label="&calendar.context.pasteevent.label;"
accesskey="&calendar.context.pasteevent.accesskey;"
id="general-context-menu-paste"
observes="paste_command">
<observes element="is_editable" attribute="hidden"/>
</menuitem>
<menuseparator>
<observes element="is_editable" attribute="hidden"/>
</menuseparator>
<menuitem label="&calendar.context.selectall.label;"
accesskey="&calendar.context.selectall.accesskey;"
id="general-context-menu-selectall"
observes="select_all_command">
<observes element="is_editable" attribute="hidden"/>
</menuitem>
<menuseparator>
<observes element="is_editable" attribute="hidden"/>
</menuseparator>
<menuitem label="&calendar.context.gototoday.label;"
accesskey="&calendar.context.gototoday.accesskey;"
id="general-context-menu-gototoday"
observes="go_today_command"/>
<menuseparator/>
<menuitem id="only-workday-checkbox-2"
type="checkbox"
label="&calendar.onlyworkday.checkbox.label;"
accesskey="&calendar.onlyworkday.checkbox.accesskey;"
observes="toggle_workdays_only"/>
<menuitem id="display-todo-inview-checkbox-2"
type="checkbox"
label="&calendar.displaytodos.checkbox.label;"
accesskey="&calendar.displaytodos.checkbox.accesskey;"
observes="toggle_tasks_in_view"/>
</popup>
<!-- TASK ITEM CONTEXT MENU -->
<popup id="taskitem-context-menu" onpopupshowing="changeContextMenuForToDo( event );">
<menuitem label="&calendar.context.newtodo.label;"
accesskey="&calendar.context.newtodo.accesskey;"
id="task-context-menu-new"
observes="new_todo_command"/>
<menuitem id="task-context-menu-modify"
label="&calendar.context.modifytask.label;"
accesskey="&calendar.context.modifytask.accesskey;"
oncommand="modifyTaskFromContext()"/>
<menuitem label="&calendar.context.deletetask.label;"
accesskey="&calendar.context.deletetask.accesskey;"
id="task-context-menu-delete"
observes="delete_todo_command"/>
<menu label="&calendar.context.progress.label;"
accesskey="&calendar.context.progress.accesskey;"
id="task-context-menu-progress"
observes="is_editable">
<menupopup>
<menuitem type="checkbox"
id="percent-0-menuitem"
label="&progress.level.0;"
accesskey="&progress.level.0.accesskey;"
oncommand="contextChangeProgress( event, 0 );"/>
<menuitem type="checkbox"
id="percent-25-menuitem"
label="&progress.level.25;"
accesskey="&progress.level.25.accesskey;"
oncommand="contextChangeProgress( event, 25 );"/>
<menuitem type="checkbox"
id="percent-50-menuitem"
label="&progress.level.50;"
accesskey="&progress.level.50.accesskey;"
oncommand="contextChangeProgress( event, 50 );"/>
<menuitem type="checkbox"
id="percent-75-menuitem"
label="&progress.level.75;"
accesskey="&progress.level.75.accesskey;"
oncommand="contextChangeProgress( event, 75 );"/>
<menuitem type="checkbox"
id="percent-100-menuitem"
label="&progress.level.100;"
accesskey="&progress.level.100.accesskey;"
oncommand="contextChangeProgress( event, 100 );"/>
</menupopup>
</menu>
<menu label="&calendar.context.priority.label;"
accesskey="&calendar.context.priority.accesskey;"
id="task-context-menu-priority"
observes="is_editable">
<menupopup>
<menuitem type="checkbox"
id="priority-0-menuitem"
label="&priority.level.none;"
accesskey="&priority.level.none.accesskey;"
oncommand="contextChangePriority( event, 0 );"/>
<menuitem type="checkbox"
id="priority-9-menuitem"
label="&priority.level.low;"
accesskey="&priority.level.low.accesskey;"
oncommand="contextChangePriority( event, 9 );"/>
<menuitem type="checkbox"
id="priority-5-menuitem"
label="&priority.level.medium;"
accesskey="&priority.level.medium.accesskey;"
oncommand="contextChangePriority( event, 5 );"/>
<menuitem type="checkbox"
id="priority-1-menuitem"
label="&priority.level.high;"
accesskey="&priority.level.high.accesskey;"
oncommand="contextChangePriority( event, 1 );"/>
</menupopup>
</menu>
</popup>
<!-- TASK ITEM CONTEXT MENU -->
<popup id="taskitem-context-menu" onpopupshowing="changeContextMenuForToDo( event );">
<menuitem label="&calendar.context.newtodo.label;"
accesskey="&calendar.context.newtodo.accesskey;"
id="task-context-menu-new"
observes="new_todo_command"/>
<menuitem id="task-context-menu-modify"
label="&calendar.context.modifytask.label;"
accesskey="&calendar.context.modifytask.accesskey;"
oncommand="modifyTaskFromContext()"/>
<menuitem label="&calendar.context.deletetask.label;"
accesskey="&calendar.context.deletetask.accesskey;"
id="task-context-menu-delete"
observes="delete_todo_command"/>
<menu label="&calendar.context.progress.label;"
accesskey="&calendar.context.progress.accesskey;"
id="task-context-menu-progress"
observes="is_editable">
<menupopup>
<menuitem type="checkbox"
id="percent-0-menuitem"
label="&progress.level.0;"
accesskey="&progress.level.0.accesskey;"
oncommand="contextChangeProgress( event, 0 );"/>
<menuitem type="checkbox"
id="percent-25-menuitem"
label="&progress.level.25;"
accesskey="&progress.level.25.accesskey;"
oncommand="contextChangeProgress( event, 25 );"/>
<menuitem type="checkbox"
id="percent-50-menuitem"
label="&progress.level.50;"
accesskey="&progress.level.50.accesskey;"
oncommand="contextChangeProgress( event, 50 );"/>
<menuitem type="checkbox"
id="percent-75-menuitem"
label="&progress.level.75;"
accesskey="&progress.level.75.accesskey;"
oncommand="contextChangeProgress( event, 75 );"/>
<menuitem type="checkbox"
id="percent-100-menuitem"
label="&progress.level.100;"
accesskey="&progress.level.100.accesskey;"
oncommand="contextChangeProgress( event, 100 );"/>
</menupopup>
</menu>
<menu label="&calendar.context.priority.label;"
accesskey="&calendar.context.priority.accesskey;"
id="task-context-menu-priority"
observes="is_editable">
<menupopup>
<menuitem type="checkbox"
id="priority-0-menuitem"
label="&priority.level.none;"
accesskey="&priority.level.none.accesskey;"
oncommand="contextChangePriority( event, 0 );"/>
<menuitem type="checkbox"
id="priority-9-menuitem"
label="&priority.level.low;"
accesskey="&priority.level.low.accesskey;"
oncommand="contextChangePriority( event, 9 );"/>
<menuitem type="checkbox"
id="priority-5-menuitem"
label="&priority.level.medium;"
accesskey="&priority.level.medium.accesskey;"
oncommand="contextChangePriority( event, 5 );"/>
<menuitem type="checkbox"
id="priority-1-menuitem"
label="&priority.level.high;"
accesskey="&priority.level.high.accesskey;"
oncommand="contextChangePriority( event, 1 );"/>
</menupopup>
</menu>
</popup>
<!-- CALENDAR LIST CONTEXT MENU -->
<popup id="calendarlist-context-menu" onpopupshowing="checkCalListTarget()">
<menuitem label="&calendar.context.newserver.label;"
id="calpopup-new"
accesskey="&calendar.context.newserver.accesskey;"
observes="new_calendar_command"/>
<menuitem label="&calendar.context.deleteserver.label;"
id="calpopup-delete"
accesskey="&calendar.context.deleteserver.accesskey;"
observes="delete_calendar_command"/>
<menuseparator/>
<menuitem label="&calendar.context.export.label;"
id="calpopup-export"
accesskey="&calendar.context.export.accesskey;"
oncommand="exportEntireCalendar(getSelectedCalendarOrNull())"/>
<menuitem label="&calendar.context.publish.label;"
id="calpopup-publish"
accesskey="&calendar.context.publish.accesskey;"
observes="publish_calendar"/>
<menuseparator/>
<menuitem label="&calendar.context.reloadserver.label;"
id="calpopup-reload"
accesskey="&calendar.context.reloadserver.accesskey;"
observes="reload_remote_calendars"/>
<menuseparator/>
<menuitem label="&calendar.context.properties.label;"
id="calpopup-edit"
accesskey="&calendar.context.properties.accesskey;"
observes="edit_calendar_command"/>
</popup>
<!-- CALENDAR LIST CONTEXT MENU -->
<popup id="calendarlist-context-menu" onpopupshowing="checkCalListTarget()">
<menuitem label="&calendar.context.newserver.label;"
id="calpopup-new"
accesskey="&calendar.context.newserver.accesskey;"
observes="new_calendar_command"/>
<menuitem label="&calendar.context.deleteserver.label;"
id="calpopup-delete"
accesskey="&calendar.context.deleteserver.accesskey;"
observes="delete_calendar_command"/>
<menuseparator/>
<menuitem label="&calendar.context.export.label;"
id="calpopup-export"
accesskey="&calendar.context.export.accesskey;"
oncommand="exportEntireCalendar(getSelectedCalendarOrNull())"/>
<menuitem label="&calendar.context.publish.label;"
id="calpopup-publish"
accesskey="&calendar.context.publish.accesskey;"
observes="publish_calendar"/>
<menuseparator/>
<menuitem label="&calendar.context.reloadserver.label;"
id="calpopup-reload"
accesskey="&calendar.context.reloadserver.accesskey;"
observes="reload_remote_calendars"/>
<menuseparator/>
<menuitem label="&calendar.context.properties.label;"
id="calpopup-edit"
accesskey="&calendar.context.properties.accesskey;"
observes="edit_calendar_command"/>
</popup>
<popup id="toolbar-context-menu">
<menuitem command="cmd_CustomizeToolbars"
id="toolbar-context-menu-customize"
label="&calendar.context.customize.label;"
accesskey="&calendar.context.customize.accesskey;"/>
</popup>
<popup id="toolbar-context-menu">
<menuitem command="cmd_CustomizeToolbars"
id="toolbar-context-menu-customize"
label="&calendar.context.customize.label;"
accesskey="&calendar.context.customize.accesskey;"/>
</popup>
</popupset>
<commandset id="commands"/>
@ -284,7 +288,7 @@
id="calendar-new-event-button"
label="&calendar.newevent.button.label;"
tooltiptext="&calendar.newevent.button.tooltip;"
observes="new_command"/>
observes="calendar_new_event_command"/>
<toolbarbutton class="toolbarbutton-1"
id="calendar-edit-event-button"
label="&calendar.edit.button.label;"
@ -358,7 +362,7 @@
id="calendar-subscribe-button"
label="&calendar.subscribe.button.label;"
tooltiptext="&calendar.subscribe.button.tooltip;"
observes="new_calendar_command"/>
observes="calendar_new_calendar_command"/>
<toolbarbutton class="toolbarbutton-1"
id="calendar-publish-button"
@ -376,7 +380,7 @@
id="calendar-new-task-button"
label="&calendar.newtask.button.label;"
tooltiptext="&calendar.newtask.button.tooltip;"
observes="new_todo_command"/>
observes="calendar_new_todo_command"/>
<toolbarbutton class="toolbarbutton-1"
id="calendar-go-to-today-button"
@ -400,7 +404,7 @@
id="calendar-remote-reload-button"
label="&calendar.remotereload.button.label;"
tooltiptext="&calendar.remotereload.button.tooltip;"
observes="reload_remote_calendars"/>
observes="calendar_reload_remote_calendars"/>
<toolbaritem id="throbber-box" align="center" pack="center">
<button id="navigator-throbber"
@ -465,16 +469,9 @@
</vbox>
</tabpanel>
<tabpanel>
<listbox id="list-calendars-listbox" class="unifinder-tree-class" flex="1"
contextmenu="calendarlist-context-menu"
ondblclick="calendarListboxDoubleClick(event)">
<listcols>
<listcol/>
<listcol/>
<listcol flex="1"/>
</listcols>
</listbox>
<tabpanel id="tablist-calendarlist">
<!-- This will be overlayed by calendar-calendars-list.xul -->
<tree id="calendar-list-tree" flex="1"/>
</tabpanel>
</tabpanels>
</tabbox>

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

@ -21,6 +21,7 @@
*
* Contributor(s): Don Crandall (macdoc@interx.net)
* Matthew Willis (mattwillis@gmail.com)
* Philipp Kewisch <mozilla@kewis.ch>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -37,31 +38,50 @@
* ***** END LICENSE BLOCK ***** */
#ifdef XP_MACOSX
function hiddenWindowStartup()
{
// focus the hidden window
window.focus();
function hiddenWindowStartup() {
// focus the hidden window
window.focus();
// Disable menus which are not appropriate
var disabledItems = ['new_command', 'new_todo_command', 'new_calendar_command',
'modify_command', 'close_calendar_command',
'print_command', 'cut_command', 'copy_command', 'paste_command',
'delete_command', 'delete_todo_command', 'select_all_command',
'day_view_command', 'week_view_command', 'multiweek_view_command',
'month_view_command', 'cmd_CustomizeToolbars', 'go_today_command',
'go_date_command', 'previous_command', 'next_command',
'wizard_command', 'import_command', 'export_command',
'publish_events_command', 'modify_todo_command',
'edit_calendar_command',
'delete_calendar_command', 'find_new_calendar_command',
'reload_remote_calendars', 'publish_calendar',
'minimizeWindowCmd', 'zoomWindowCmd'];
for (var id in disabledItems)
{
var broadcaster = document.getElementById(disabledItems[id]);
if (broadcaster)
broadcaster.setAttribute("disabled", "true");
}
// Disable menus which are not appropriate
var disabledItems = ['calendar_new_event_command',
'calendar_new_todo_command',
'calendar_new_calendar_command',
'modify_command',
'close_calendar_command',
'print_command',
'cut_command',
'copy_command',
'paste_command',
'delete_command',
'delete_todo_command',
'select_all_command',
'day_view_command',
'week_view_command',
'multiweek_view_command',
'month_view_command',
'cmd_CustomizeToolbars',
'go_today_command',
'go_date_command',
'previous_command',
'next_command',
'wizard_command',
'import_command',
'export_command',
'publish_events_command',
'modify_todo_command',
'edit_calendar_command',
'calendar_delete_calendar_command',
'find_new_calendar_command',
'calendar_reload_remote_calendars',
'calendar_publish_calendar',
'minimizeWindowCmd',
'zoomWindowCmd'];
for each (var id in disabledItems) {
var broadcaster = document.getElementById(id);
if (broadcaster) {
broadcaster.setAttribute("disabled", "true");
}
}
}
// Mac OS X "Window" menu functions

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

@ -30,6 +30,7 @@
# Christopher Cook <tangent@intraplanar.net>
# Kevin Gerich <webmail@kmgerich.com>
# Matthew Willis <mattwillis@gmail.com>
# Philipp Kewisch <mozilla@kewis.ch>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -624,101 +625,79 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
/* TO DO ITEMS */
treechildren::-moz-tree-cell-text(inprogress)
{
color : green;
#unifinder-todo-tree > treechildren::-moz-tree-cell-text(inprogress) {
color: green;
}
treechildren::-moz-tree-row(inprogress,selected)
{
background-color : green;
#unifinder-todo-tree > treechildren::-moz-tree-row(inprogress,selected) {
background-color: green;
}
treechildren::-moz-tree-cell-text(overdue)
{
color : red;
#unifinder-todo-tree > treechildren::-moz-tree-cell-text(overdue) {
color: red;
}
treechildren::-moz-tree-row(overdue,selected)
{
background-color : red;
#unifinder-todo-tree > treechildren::-moz-tree-row(overdue,selected) {
background-color: red;
}
treechildren::-moz-tree-row
{
border-bottom : 1px dotted #AAA;
#unifinder-todo-tree > treechildren::-moz-tree-row {
border-bottom: 1px dotted #AAA;
}
treechildren::-moz-tree-cell-text(duetoday)
{
color : blue;
#unifinder-todo-tree > treechildren::-moz-tree-cell-text(duetoday) {
color: blue;
}
treechildren::-moz-tree-row(duetoday,selected)
{
background-color : blue;
#unifinder-todo-tree > treechildren::-moz-tree-row(duetoday,selected) {
background-color: blue;
}
treechildren::-moz-tree-cell-text(future)
{
color : gray;
#unifinder-todo-tree > treechildren::-moz-tree-cell-text(future) {
color: gray;
}
treechildren::-moz-tree-row(future,selected)
{
background-color : gray;
#unifinder-todo-tree > treechildren::-moz-tree-row(future,selected) {
background-color: gray;
}
treechildren::-moz-tree-cell-text(completed)
{
text-decoration : line-through;
color : black;
#unifinder-todo-tree > treechildren::-moz-tree-cell-text(completed) {
text-decoration: line-through;
color: black;
}
/* TO DO LIST IMAGES */
treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, completed),
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, completed),
#unifinder-todo-tree-col-completed {
list-style-image : url("chrome://calendar/skin/unifinder/checkbox_checked.png");
list-style-image: url("chrome://calendar/skin/unifinder/checkbox_checked.png");
}
treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, duetoday),
treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, overdue),
treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, future),
treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, inprogress) {
list-style-image : url("chrome://calendar/skin/unifinder/checkbox_unchecked.png");
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, duetoday),
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, overdue),
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, future),
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, inprogress) {
list-style-image: url("chrome://calendar/skin/unifinder/checkbox_unchecked.png");
}
#unifinder-todo-tree-col-priority {
list-style-image : url( "chrome://calendar/skin/unifinder/priority_header.png" )
list-style-image: url( "chrome://calendar/skin/unifinder/priority_header.png" )
}
treechildren::-moz-tree-image(unifinder-todo-tree-col-priority, mediumpriority) {
list-style-image : url( "chrome://calendar/skin/unifinder/priority_header.png" )
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-priority, mediumpriority) {
list-style-image: url( "chrome://calendar/skin/unifinder/priority_header.png" )
}
treechildren::-moz-tree-image(unifinder-todo-tree-col-priority, highpriority) {
list-style-image : url( "chrome://calendar/skin/unifinder/priority_high.png" )
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-priority, highpriority) {
list-style-image: url( "chrome://calendar/skin/unifinder/priority_high.png" )
}
treechildren::-moz-tree-image(unifinder-todo-tree-col-priority, lowpriority) {
list-style-image : url( "chrome://calendar/skin/unifinder/priority_low.png" )
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-priority, lowpriority) {
list-style-image: url( "chrome://calendar/skin/unifinder/priority_low.png" )
}
treechildren::-moz-tree-cell-text(selected) {
color : HighlightText;
}
.calendar-list-item-class[synching="true"]
{
list-style-image : url( "chrome://calendar/skin/synch_animated.gif" );
}
listitem[selected="true"] > .calendar-list-item-class
{
background-color : White;
color : Black;
#unifinder-todo-tree > treechildren::-moz-tree-cell-text(selected) {
color: HighlightText;
}
.todo-due-image-class

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

@ -30,6 +30,7 @@
# Christopher Cook <tangent@intraplanar.net>
# Kevin Gerich <webmail@kmgerich.com>
# Matthew Willis <mattwillis@gmail.com>
# Philipp Kewisch <mozilla@kewis.ch>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -768,101 +769,79 @@ toolbar[iconsize="small"] #navigator-throbber[busy="true"] {
/* TO DO ITEMS */
treechildren::-moz-tree-cell-text(inprogress)
{
color : green;
#unifinder-todo-tree > treechildren::-moz-tree-cell-text(inprogress) {
color: green;
}
treechildren::-moz-tree-row(inprogress,selected)
{
background-color : green;
#unifinder-todo-tree > treechildren::-moz-tree-row(inprogress,selected) {
background-color: green;
}
treechildren::-moz-tree-cell-text(overdue)
{
color : red;
#unifinder-todo-tree > treechildren::-moz-tree-cell-text(overdue) {
color: red;
}
treechildren::-moz-tree-row(overdue,selected)
{
background-color : red;
#unifinder-todo-tree > treechildren::-moz-tree-row(overdue,selected) {
background-color: red;
}
treechildren::-moz-tree-row
{
border-bottom : 1px dotted #AAA;
#unifinder-todo-tree > treechildren::-moz-tree-row {
border-bottom: 1px dotted #AAA;
}
treechildren::-moz-tree-cell-text(duetoday)
{
color : blue;
#unifinder-todo-tree > treechildren::-moz-tree-cell-text(duetoday) {
color: blue;
}
treechildren::-moz-tree-row(duetoday,selected)
{
background-color : blue;
#unifinder-todo-tree > treechildren::-moz-tree-row(duetoday,selected) {
background-color: blue;
}
treechildren::-moz-tree-cell-text(future)
{
color : gray;
#unifinder-todo-tree > treechildren::-moz-tree-cell-text(future) {
color: gray;
}
treechildren::-moz-tree-row(future,selected)
{
background-color : gray;
#unifinder-todo-tree > treechildren::-moz-tree-row(future,selected) {
background-color: gray;
}
treechildren::-moz-tree-cell-text(completed)
{
text-decoration : line-through;
color : black;
#unifinder-todo-tree > treechildren::-moz-tree-cell-text(completed) {
text-decoration: line-through;
color: black;
}
/* TO DO LIST IMAGES */
treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, completed),
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, completed),
#unifinder-todo-tree-col-completed {
list-style-image : url("chrome://calendar/skin/unifinder/checkbox_checked.png");
}
treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, duetoday),
treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, overdue),
treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, future),
treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, inprogress) {
list-style-image : url("chrome://calendar/skin/unifinder/checkbox_unchecked.png");
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, duetoday),
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, overdue),
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, future),
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-completed, inprogress) {
list-style-image: url("chrome://calendar/skin/unifinder/checkbox_unchecked.png");
}
#unifinder-todo-tree-col-priority {
list-style-image : url( "chrome://calendar/skin/unifinder/priority_header.png" )
list-style-image: url( "chrome://calendar/skin/unifinder/priority_header.png" )
}
treechildren::-moz-tree-image(unifinder-todo-tree-col-priority, mediumpriority) {
list-style-image : url( "chrome://calendar/skin/unifinder/priority_header.png" )
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-priority, mediumpriority) {
list-style-image: url( "chrome://calendar/skin/unifinder/priority_header.png" )
}
treechildren::-moz-tree-image(unifinder-todo-tree-col-priority, highpriority) {
list-style-image : url( "chrome://calendar/skin/unifinder/priority_high.png" )
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-priority, highpriority) {
list-style-image: url( "chrome://calendar/skin/unifinder/priority_high.png" )
}
treechildren::-moz-tree-image(unifinder-todo-tree-col-priority, lowpriority) {
list-style-image : url( "chrome://calendar/skin/unifinder/priority_low.png" )
#unifinder-todo-tree > treechildren::-moz-tree-image(unifinder-todo-tree-col-priority, lowpriority) {
list-style-image: url( "chrome://calendar/skin/unifinder/priority_low.png" )
}
treechildren::-moz-tree-cell-text(selected) {
color : HighlightText;
}
.calendar-list-item-class[synching="true"]
{
list-style-image : url( "chrome://calendar/skin/synch_animated.gif" );
}
listitem[selected="true"] > .calendar-list-item-class
{
background-color : White;
color : Black;
#unifinder-todo-tree > treechildren::-moz-tree-cell-text(selected) {
color: HighlightText;
}
.todo-due-image-class