зеркало из https://github.com/mozilla/pjs.git
bug #367110 Missing Thunderbird integration for copy/paste r1=lilmatt,r2=mvl
This commit is contained in:
Родитель
e48a275eb3
Коммит
7df7bf5277
|
@ -42,6 +42,56 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var CalendarController =
|
||||
{
|
||||
supportsCommand: function ccSC(command) {
|
||||
switch (command) {
|
||||
case "cmd_cut":
|
||||
case "cmd_copy":
|
||||
case "cmd_paste":
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
isCommandEnabled: function ccICE(command) {
|
||||
switch (command) {
|
||||
case "cmd_cut":
|
||||
case "cmd_copy":
|
||||
return currentView().getSelectedItems({}).length != 0;
|
||||
case "cmd_paste":
|
||||
return canPaste();
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
doCommand: function ccDC(command) {
|
||||
// if the user invoked a key short cut then it is possible that we got
|
||||
// here for a command which is really disabled. kick out if the
|
||||
// command should be disabled.
|
||||
if (!this.isCommandEnabled(command)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( command )
|
||||
{
|
||||
case "cmd_cut":
|
||||
cutToClipboard();
|
||||
break;
|
||||
case "cmd_copy":
|
||||
copyToClipboard();
|
||||
break;
|
||||
case "cmd_paste":
|
||||
pasteFromClipboard();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
onEvent: function ccOE(event) {
|
||||
// do nothing here...
|
||||
}
|
||||
};
|
||||
|
||||
function ltnSidebarCalendarSelected(tree)
|
||||
{
|
||||
getCompositeCalendar().defaultCalendar = ltnSelectedCalendar();
|
||||
|
@ -196,6 +246,8 @@ function ltnOnLoad(event)
|
|||
null);
|
||||
}
|
||||
|
||||
top.controllers.insertControllerAt(0, CalendarController);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
<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://lightning/content/imip-bar.js"/>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/clipboard.js"/>
|
||||
<window id="messengerWindow">
|
||||
<commandset id="calendar_commands">
|
||||
<command id="publish_calendar" oncommand="ltnPublishCalendar()"/>
|
||||
|
|
|
@ -46,6 +46,7 @@ calendar.jar:
|
|||
content/calendar/publish.js (/calendar/resources/content/publish.js)
|
||||
content/calendar/publishDialog.js (/calendar/resources/content/publishDialog.js)
|
||||
content/calendar/publishDialog.xul (/calendar/resources/content/publishDialog.xul)
|
||||
content/calendar/clipboard.js (/calendar/resources/content/clipboard.js)
|
||||
content/calendar/sun-calendar-event-dialog.css (/calendar/prototypes/wcap/sun-calendar-event-dialog.css)
|
||||
content/calendar/sun-calendar-event-dialog.js (/calendar/prototypes/wcap/sun-calendar-event-dialog.js)
|
||||
content/calendar/sun-calendar-event-dialog.xul (/calendar/prototypes/wcap/sun-calendar-event-dialog.xul)
|
||||
|
|
|
@ -264,38 +264,6 @@ function getSelectedCalendarOrNull()
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called from the unifinder's delete command
|
||||
*
|
||||
*/
|
||||
function deleteItems( SelectedItems, DoNotConfirm )
|
||||
{
|
||||
if (!SelectedItems)
|
||||
return;
|
||||
|
||||
startBatchTransaction();
|
||||
for (i in SelectedItems) {
|
||||
var aOccurrence = SelectedItems[i];
|
||||
if (aOccurrence.parentItem != aOccurrence) {
|
||||
var event = aOccurrence.parentItem.clone();
|
||||
event.recurrenceInfo.removeOccurrenceAt(aOccurrence.recurrenceId);
|
||||
doTransaction('modify', event, event.calendar, aOccurrence.parentItem, null);
|
||||
} else {
|
||||
doTransaction('delete', aOccurrence, aOccurrence.calendar, null, null);
|
||||
}
|
||||
}
|
||||
endBatchTransaction();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete the current selected items with focus from the unifinder list
|
||||
*/
|
||||
function deleteEventCommand( DoNotConfirm )
|
||||
{
|
||||
var SelectedItems = currentView().getSelectedItems({});
|
||||
deleteItems( SelectedItems, DoNotConfirm );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -251,8 +251,9 @@ function pasteFromClipboard()
|
|||
if (!earliestDate || date.compare(earliestDate) < 0)
|
||||
earliestDate = date;
|
||||
}
|
||||
var destCal = getDefaultCalendar();
|
||||
var firstDate = document.getElementById("view-deck").selectedPanel.selectedDay;
|
||||
var destCal = ("ltnSelectedCalendar" in window) ?
|
||||
ltnSelectedCalendar() : getDefaultCalendar();
|
||||
var firstDate = currentView().selectedDay;
|
||||
if (!firstDate.isMutable) {
|
||||
firstDate = firstDate.clone();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче