Context menu and test function to make call.

This commit is contained in:
mgalli%geckonnection.com 2005-08-12 02:09:16 +00:00
parent 4ba955beb7
commit 9a7ef6502e
2 changed files with 37 additions and 5 deletions

View File

@ -338,3 +338,26 @@ function BrowserResetZoomMinus() {
getBrowser().selectedBrowser.markupDocumentViewer.textZoom-= .25;
}
/*
Testing the SMS and Call Services
*/
function BrowserTestSendCall(toCall) {
var phoneInterface= Components.classes["@mozilla.org/phone/support;1"].createInstance(Components.interfaces.nsIPhoneSupport);
phoneInterface.makeCall(toCall,"");
}
/*
We want to intercept before it shows,
to evaluate when the selected content area is a phone number,
thus mutate the popup menu to the right make call item
*/
function BrowserPopupShowing () {
var selectedRange=getBrowser().selectedBrowser.contentDocument.getSelection();
var intSelected=parseInt(selectedRange.toString());
if(intSelected) {
document.getElementById("item_call").label="Call "+intSelected;
document.getElementById("item_call").setAttribute("oncommand","BrowserTestSendCall("+selectedRange.toString()+")");
}
}

View File

@ -77,10 +77,6 @@
<menubar class="chromeclass-menubar">
<menu id="menu-button" > <!-- hack has to fix -->
<menupopup id="menu_FilePopup">
<menuitem id="menu_close"/>
<menuitem id="menu_closeWindow" command="cmd_closeWindow"
key="key_closeWindow" label="about"/>
<menuitem id="command_BrowserOpenTab" command="cmd_BrowserOpenTab" label="new Tab" />
<menu id="menu-zoom" label="Text zoom">
<menupopup >
@ -107,7 +103,7 @@
<hbox flex="1" >
<hbox id="appcontent" flex="100%">
<hbox id="browser" context="context" flex="1">
<tabbrowser context="context" type="content-primary" id="content" src="about:blank" flex="1" onclick="tabbrowserAreaClick(event)" onnewtab="BrowserOpenTab()"/>
<tabbrowser contentcontextmenu="contentAreaContextMenu" context="context" type="content-primary" id="content" src="about:blank" flex="1" onclick="tabbrowserAreaClick(event)" onnewtab="BrowserOpenTab()"/>
</hbox>
</hbox>
</hbox>
@ -116,5 +112,18 @@
<statusbarpanel id="statusbar-text" label="Minimo" flex="1" crop="right"/>
<statusbarpanel id="security" label="" style="display: none"/>
</statusbar>
<!-- place holder for our app popups and hook to the overlay -->
<popupset>
<popup id="contentAreaContextMenu" onpopupshowing="BrowserPopupShowing()">
<menuitem id="item_call" insertbefore="context-sep-view" label="" oncommand=""/>
<menuitem id="item_test" label="Context Menu" oncommand=""/>
</popup>
<popup id="menu_FilePopup">
<menuitem id="menu_close"/>
<menuitem id="menu_closeWindow" command="cmd_closeWindow" key="key_closeWindow" label="about" />
</popup>
</popupset>
</window>