Bug 1126198 - Part 1: Define 'presentationType' in nsIStkSelectItemCmd instead of nsIStkSetUpMenuCmd. r=echen

This commit is contained in:
Bevis Tseng 2015-01-27 18:47:12 +08:00
Родитель ca660ce616
Коммит aa3666273e
3 изменённых файлов: 42 добавлений и 65 удалений

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

@ -312,7 +312,7 @@ function StkSetupEventListMessage(aStkSetupEventListCmd) {
}
StkSetupEventListMessage.prototype = Object.create(StkCommandMessage.prototype);
function StkMenuCmd(aCommandDetails) {
function StkSetUpMenuCmd(aCommandDetails) {
// Call |StkProactiveCommand| constructor.
StkProactiveCommand.call(this, aCommandDetails);
@ -340,10 +340,10 @@ function StkMenuCmd(aCommandDetails) {
this.isHelpAvailable = !!(options.isHelpAvailable);
}
StkMenuCmd.prototype = Object.create(StkProactiveCommand.prototype, {
StkSetUpMenuCmd.prototype = Object.create(StkProactiveCommand.prototype, {
QueryInterface: {
value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
Ci.nsIStkMenuCmd])
Ci.nsIStkSetUpMenuCmd])
},
// Cache items for getItems()
@ -352,7 +352,7 @@ StkMenuCmd.prototype = Object.create(StkProactiveCommand.prototype, {
// Cache items for getNextActionList()
nextActionList: { value: null, writable: true },
// nsIStkMenuCmd
// nsIStkSetUpMenuCmd
title: { value: null, writable: true },
getItems: {
@ -393,12 +393,12 @@ StkMenuCmd.prototype = Object.create(StkProactiveCommand.prototype, {
isHelpAvailable: { value: false, writable: true }
});
function StkMenuMessage(aStkMenuCmd) {
function StkSetUpMenuMessage(aStkSetUpMenuCmd) {
// Call |StkCommandMessage| constructor.
StkCommandMessage.call(this, aStkMenuCmd);
StkCommandMessage.call(this, aStkSetUpMenuCmd);
this.options = {
items: aStkMenuCmd.getItems().map(function(aStkItem) {
items: aStkSetUpMenuCmd.getItems().map(function(aStkItem) {
if (!aStkItem) {
return null;
}
@ -414,70 +414,50 @@ function StkMenuMessage(aStkMenuCmd) {
return item;
}),
isHelpAvailable: aStkMenuCmd.isHelpAvailable
isHelpAvailable: aStkSetUpMenuCmd.isHelpAvailable
};
if (aStkMenuCmd.title) {
this.options.title = aStkMenuCmd.title;
if (aStkSetUpMenuCmd.title) {
this.options.title = aStkSetUpMenuCmd.title;
}
let nextActionList = aStkMenuCmd.getNextActionList();
let nextActionList = aStkSetUpMenuCmd.getNextActionList();
if (nextActionList && nextActionList.length > 0) {
this.options.nextActionList = nextActionList;
}
if (aStkMenuCmd.iconInfo) {
appendIconInfo(this.options, aStkMenuCmd.iconInfo);
if (aStkSetUpMenuCmd.iconInfo) {
appendIconInfo(this.options, aStkSetUpMenuCmd.iconInfo);
}
}
StkMenuMessage.prototype = Object.create(StkCommandMessage.prototype);
StkSetUpMenuMessage.prototype = Object.create(StkCommandMessage.prototype);
function StkSetUpMenuCmd(aCommandDetails) {
// Call |StkMenuCmd| constructor.
StkMenuCmd.call(this, aCommandDetails);
function StkSelectItemCmd(aCommandDetails) {
// Call |StkSetUpMenuCmd| constructor.
StkSetUpMenuCmd.call(this, aCommandDetails);
let options = aCommandDetails.options;
this.presentationType = options.presentationType;
}
StkSetUpMenuCmd.prototype = Object.create(StkMenuCmd.prototype, {
QueryInterface: {
value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
Ci.nsIStkMenuCmd,
Ci.nsIStkSetUpMenuCmd])
},
// nsIStkSetUpMenuCmd
presentationType: { value: 0, writable: true }
});
function StkSetUpMenuMessage(aStkSetUpMenuCmd) {
// Call |StkMenuMessage| constructor.
StkMenuMessage.call(this, aStkSetUpMenuCmd);
this.options.presentationType = aStkSetUpMenuCmd.presentationType;
}
StkSetUpMenuMessage.prototype = Object.create(StkMenuMessage.prototype);
function StkSelectItemCmd(aCommandDetails) {
// Call |StkMenuCmd| constructor.
StkMenuCmd.call(this, aCommandDetails);
let options = aCommandDetails.options;
if (options.defaultItem !== undefined &&
options.defaultItem !== null) {
this.defaultItem = options.defaultItem;
}
}
StkSelectItemCmd.prototype = Object.create(StkMenuCmd.prototype, {
StkSelectItemCmd.prototype = Object.create(StkSetUpMenuCmd.prototype, {
QueryInterface: {
value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
Ci.nsIStkMenuCmd,
Ci.nsIStkSetUpMenuCmd,
Ci.nsIStkSelectItemCmd])
},
// nsIStkSelectItemCmd
presentationType: {
value: 0,
writable: true
},
defaultItem: {
value: Ci.nsIStkSelectItemCmd.DEFAULT_ITEM_INVALID,
writable: true
@ -485,14 +465,16 @@ StkSelectItemCmd.prototype = Object.create(StkMenuCmd.prototype, {
});
function StkSelectItemMessage(aStkSelectItemCmd) {
// Call |StkMenuMessage| constructor.
StkMenuMessage.call(this, aStkSelectItemCmd);
// Call |StkSetUpMenuMessage| constructor.
StkSetUpMenuMessage.call(this, aStkSelectItemCmd);
this.options.presentationType = aStkSelectItemCmd.presentationType;
if (aStkSelectItemCmd.defaultItem !== Ci.nsIStkSelectItemCmd.DEFAULT_ITEM_INVALID) {
this.options.defaultItem = aStkSelectItemCmd.defaultItem;
}
}
StkSelectItemMessage.prototype = Object.create(StkMenuMessage.prototype);
StkSelectItemMessage.prototype = Object.create(StkSetUpMenuMessage.prototype);
function StkTextMessageCmd(aCommandDetails) {
// Call |StkProactiveCommand| constructor.

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

@ -240,10 +240,10 @@ interface nsIStkSetupEventListCmd : nsIStkProactiveCmd
};
/**
* The base interface of nsIStkSetUpMenuCmd and nsIStkSelectItemCmd.
* This interface is to be applied by STK_CMD_SET_UP_MENU.
*/
[scriptable, uuid(298bf414-6a1f-11e4-9045-3b3fd28e7f6a)]
interface nsIStkMenuCmd : nsIStkProactiveCmd
[scriptable, uuid(d7a66664-a602-11e4-9cc7-c7ce5fdade7d)]
interface nsIStkSetUpMenuCmd : nsIStkProactiveCmd
{
/**
* (Optional for STK_CMD_SELECT_ITEM)
@ -304,29 +304,22 @@ interface nsIStkMenuCmd : nsIStkProactiveCmd
};
/**
* This interface is to be applied by STK_CMD_SET_UP_MENU.
* This interface is to be applied by STK_CMD_SELECT_ITEM.
*/
[scriptable, uuid(d3ddb1f0-631c-11e4-aac3-4beb03196b7b)]
interface nsIStkSetUpMenuCmd : nsIStkMenuCmd
[scriptable, uuid(eb71f0fa-a602-11e4-926f-a3814461d218)]
interface nsIStkSelectItemCmd : nsIStkSetUpMenuCmd
{
/**
* Presentation type, one of PRESENTATION_TYPE_*.
*
* @See TS 11.14, clause 12.6, Command Qualifier: Select Item
*/
const short PRESENTATION_TYPE_NOT_SPECIFIED = 0x00;
const short PRESENTATION_TYPE_DATA_VALUES = 0x01;
const short PRESENTATION_TYPE_NAVIGATION_OPTIONS = 0x03;
const unsigned short PRESENTATION_TYPE_NOT_SPECIFIED = 0x00;
const unsigned short PRESENTATION_TYPE_DATA_VALUES = 0x01;
const unsigned short PRESENTATION_TYPE_NAVIGATION_OPTIONS = 0x03;
readonly attribute unsigned short presentationType;
};
/**
* This interface is to be applied by STK_CMD_SELECT_ITEM.
*/
[scriptable, uuid(816dc186-631b-11e4-864f-b37f7b54a1b8)]
interface nsIStkSelectItemCmd : nsIStkMenuCmd
{
const unsigned short DEFAULT_ITEM_INVALID = 0xFFFF;
/**

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

@ -10963,8 +10963,10 @@ StkCommandParamsFactoryObject.prototype = {
menu.defaultItem = ctlv.value.identifier - 1;
}
// The 1st bit and 2nd bit determines the presentation type.
menu.presentationType = cmdDetails.commandQualifier & 0x03;
if (cmdDetails.typeOfCommand == STK_CMD_SELECT_ITEM) {
// The 1st bit and 2nd bit determines the presentation type.
menu.presentationType = cmdDetails.commandQualifier & 0x03;
}
// Help information available.
if (cmdDetails.commandQualifier & 0x80) {