Bug 1533967 - Convert calendar item toolbar buttons from type="menu-button" to type="menu". r=philipp, ui-r=aleca

This commit is contained in:
Geoff Lankow 2019-03-09 15:56:54 +13:00
Родитель 59c4fb0931
Коммит 960e87a50f
5 изменённых файлов: 17 добавлений и 94 удалений

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

@ -3,9 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* exported onLoadLightningItemPanel, onAccept, onCancel, onCommandSave,
* onCommandDeleteItem, editAttendees, rotatePrivacy, editPrivacy,
* rotatePriority, editPriority, rotateStatus, editStatus,
* rotateShowTimeAs, editShowTimeAs, updateShowTimeAs, editToDoStatus,
* onCommandDeleteItem, editAttendees, editPrivacy, editPriority,
* editStatus, editShowTimeAs, updateShowTimeAs, editToDoStatus,
* postponeTask, toggleTimezoneLinks, toggleLink, attachURL,
* onCommandViewToolbar, onCommandCustomize, attachFileByAccountKey,
* onUnloadLightningItemPanel, openNewEvent, openNewTask,
@ -500,17 +499,6 @@ function editConfigState(aArg) {
sendMessage({ command: "editConfigState", argument: aArg });
}
/**
* Rotates the Privacy of an item to the next value
* following the sequence -> PUBLIC -> CONFIDENTIAL -> PRIVATE ->.
*/
function rotatePrivacy() {
const states = ["PUBLIC", "CONFIDENTIAL", "PRIVATE"];
let oldPrivacy = gConfig.privacy;
let newPrivacy = states[(states.indexOf(oldPrivacy) + 1) % states.length];
editConfigState({ privacy: newPrivacy });
}
/**
* Handler for changing privacy. aEvent is used for the popup menu
* event-privacy-menupopup in the Privacy toolbar button.
@ -638,25 +626,6 @@ function updatePrivacy(aArg) {
}
}
/**
* Rotates the Priority of an item to the next value
* following the sequence -> Not specified -> Low -> Normal -> High ->.
*/
function rotatePriority() {
let now = gConfig.priority;
let next;
if (now <= 0 || now > 9) { // not specified -> low
next = 9;
} else if (now >= 1 && now <= 4) { // high -> not specified
next = 0;
} else if (now == 5) { // normal -> high
next = 1;
} else if (now >= 6 && now <= 9) { // low -> normal
next = 5;
}
editConfigState({ priority: next });
}
/**
* Handler to change the priority.
*
@ -730,26 +699,6 @@ function updatePriority(aArg) {
}
}
/**
* Rotate the Status of an item to the next value following
* the sequence -> NONE -> TENTATIVE -> CONFIRMED -> CANCELLED ->.
*/
function rotateStatus() {
let oldStatus = gConfig.status;
let noneCommand = document.getElementById("cmd_status_none");
let noneCommandIsVisible = !noneCommand.hasAttribute("hidden");
let states = ["TENTATIVE", "CONFIRMED", "CANCELLED"];
// If control for status "NONE" ("cmd_status_none") is visible,
// allow rotating to it.
if (gConfig.isEvent && noneCommandIsVisible) {
states.unshift("NONE");
}
let newStatus = states[(states.indexOf(oldStatus) + 1) % states.length];
editConfigState({ status: newStatus });
}
/**
* Handler for changing the status.
*
@ -801,17 +750,6 @@ function updateStatus(aArg) {
}
}
/**
* Toggles the transparency ("Show Time As" property) of an item
* from BUSY (Opaque) to FREE (Transparent).
*/
function rotateShowTimeAs() {
const states = ["OPAQUE", "TRANSPARENT"];
let oldValue = gConfig.showTimeAs;
let newValue = states[(states.indexOf(oldValue) + 1) % states.length];
editConfigState({ showTimeAs: newValue });
}
/**
* Handler for changing the transparency.
*

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

@ -40,11 +40,10 @@
<toolbarbutton id="button-privacy"
mode="dialog"
class="cal-event-toolbarbutton toolbarbutton-1"
type="menu-button"
type="menu"
disable-on-readonly="true"
label="&event.toolbar.privacy.label;"
tooltiptext="&event.toolbar.privacy.tooltip;"
oncommand="rotatePrivacy()">
tooltiptext="&event.toolbar.privacy.tooltip;">
<menupopup id="event-privacy-menupopup">
<menuitem id="event-privacy-public-menuitem"
name="event-privacy-group"
@ -67,19 +66,12 @@
</menupopup>
</toolbarbutton>
<toolbarbutton id="button-url"
type="menu-button"
mode="dialog"
class="cal-event-toolbarbutton toolbarbutton-1"
label="&event.attachments.menubutton.label;"
tooltiptext="&event.toolbar.attachments.tooltip;"
command="cmd_attach_url"
disable-on-readonly="true">
<menupopup id="button-attach-menupopup">
<menuitem id="button-attach-url"
label="&event.attachments.url.label;"
command="cmd_attach_url"/>
</menupopup>
</toolbarbutton>
disable-on-readonly="true"/>
<toolbarbutton id="button-delete"
mode="dialog"
class="cal-event-toolbarbutton toolbarbutton-1"
@ -90,11 +82,10 @@
<toolbarbutton id="button-priority"
mode="dialog"
class="cal-event-toolbarbutton toolbarbutton-1"
type="menu-button"
type="menu"
disable-on-readonly="true"
label="&event.menu.options.priority2.label;"
tooltiptext="&event.toolbar.priority.tooltip;"
oncommand="rotatePriority()">
tooltiptext="&event.toolbar.priority.tooltip;">
<menupopup id="event-priority-menupopup">
<menuitem id="event-priority-none-menuitem"
name="event-priority-group"
@ -121,11 +112,10 @@
<toolbarbutton id="button-status"
mode="dialog"
class="cal-event-toolbarbutton toolbarbutton-1 event-only"
type="menu-button"
type="menu"
disable-on-readonly="true"
label="&newevent.status.label;"
tooltiptext="&event.toolbar.status.tooltip;"
oncommand="rotateStatus()">
tooltiptext="&event.toolbar.status.tooltip;">
<menupopup id="event-status-menupopup">
<menuitem id="event-status-none-menuitem"
name="event-status-group"
@ -152,11 +142,10 @@
<toolbarbutton id="button-freebusy"
mode="dialog"
class="cal-event-toolbarbutton toolbarbutton-1 event-only"
type="menu-button"
type="menu"
disable-on-readonly="true"
label="&event.menu.options.show.time.label;"
tooltiptext="&event.toolbar.freebusy.tooltip;"
oncommand="rotateShowTimeAs()">
tooltiptext="&event.toolbar.freebusy.tooltip;">
<menupopup id="event-freebusy-menupopup">
<menuitem id="event-freebusy-busy-menuitem"
name="event-freebusy-group"

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

@ -218,8 +218,7 @@ function testEventDialog() {
}
}
}
// testEventDialog.EXCLUDED_PLATFORMS = ["darwin"];
testEventDialog.__force_skip__ = true;
testEventDialog.EXCLUDED_PLATFORMS = ["darwin"];
function checkTooltip(row, col, startTime, endTime) {
let item = lookupEventBox("month", null, row, col, null, EVENTPATH);

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

@ -142,8 +142,7 @@ function testEventDialogModificationPrompt() {
controller.waitForElementNotPresent(eventbox);
}
}
// testEventDialogModificationPrompt.EXCLUDED_PLATFORMS = ["darwin"];
testEventDialogModificationPrompt.__force_skip__ = true;
testEventDialogModificationPrompt.EXCLUDED_PLATFORMS = ["darwin"];
function teardownTest(module) {
deleteCalendars(controller, CALENDARNAME);

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

@ -327,12 +327,10 @@ function setData(dialog, iframe, data) {
// privacy
if (data.privacy != undefined) {
let toolbarbutton = eid("button-privacy");
let rect = toolbarbutton.getNode().getBoundingClientRect();
dialog.click(toolbarbutton, rect.width - 5, 5);
dialog.mainMenu.click(`#options-privacy-${data.privacy}-menuitem`);
// For some reason, the dialog does not close by itself.
dialog.click(toolbarbutton, rect.width - 5, 5);
dialog.click(eid("button-privacy"));
let menu = dialog.getMenu("#event-privacy-menupopup");
menu.click(`#event-privacy-${data.privacy}-menuitem`);
menu.close();
}
// status