41,127 → 41,135 |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
showDialog: function(aParent, params) |
showDialog: function(showModal, aParent, params, args) |
{ |
// parent interfaces |
var parentRequestor = aParent.QueryInterface(Components.interfaces.nsIInterfaceRequestor); |
var parentDocShell = parentRequestor.getInterface(Components.interfaces.nsIWebNavigation) |
.QueryInterface(Components.interfaces.nsIDocShell); |
var parentInt = parentRequestor.getInterface(Components.interfaces.nsIDOMWindowInternal); |
var parentDom = parentRequestor.getInterface(Components.interfaces.nsIDOMWindow); |
var mainWin = this.windowMediator.getMostRecentWindow("navigator:browser"); |
var tabBrowser = mainWin.gBrowser; |
// params |
if(!args) { |
if(!params.dialogTitle && params.dialogTitleKey) { |
params.dialogTitle = this.commonBundle.GetStringFromName(params.dialogTitleKey); |
} |
|
var parentTab; |
for(var i = 0, l = tabBrowser.browsers.length; i < l; ++i) { |
var b = tabBrowser.getBrowserAtIndex(i); |
if(b.contentWindow == aParent) { |
parentTab = tabBrowser.tabContainer.childNodes[i]; |
} |
args = Components.classes["@mozilla.org/embedcomp/dialogparam;1"] |
.createInstance(Components.interfaces.nsIDialogParamBlock); |
|
args.SetString(0, params.text); |
args.SetString(1, params.checkboxMsg); |
args.SetString(2, params.iconClass); |
args.SetString(3, params.titleMessage); |
args.SetString(4, params.editfield1Msg); |
args.SetString(5, params.editfield2Msg); |
args.SetString(6, params.editfield1Value); |
args.SetString(7, params.editfield2Value); |
args.SetString(8, params.button0Text); |
args.SetString(9, params.button1Text); |
args.SetString(10, params.button2Text); |
args.SetString(11, params.button3Text); |
args.SetString(12, params.dialogTitle); |
args.SetString(13, params.openingSound); |
args.SetInt (1, params.checkboxState); |
args.SetInt (2, params.numberButtons); |
args.SetInt (3, params.numberEditfields); |
args.SetInt (4, params.editField1Password); |
args.SetInt (5, params.defaultButton); |
args.SetInt (6, params.delayButtonEnable); |
args.SetInt (7, params.soundEventId); |
} |
|
// disable all dynamics in the window |
var jsAllowed = parentDocShell.allowJavascript; |
parentDocShell.allowJavascript = false; |
parentDocShell.suspendRefreshURIs(); |
if(!showModal) { |
// parent interfaces |
var parentRequestor = aParent.QueryInterface(Components.interfaces.nsIInterfaceRequestor); |
var parentDocShell = parentRequestor.getInterface(Components.interfaces.nsIWebNavigation) |
.QueryInterface(Components.interfaces.nsIDocShell); |
var parentInt = parentRequestor.getInterface(Components.interfaces.nsIDOMWindowInternal); |
var parentDom = parentRequestor.getInterface(Components.interfaces.nsIDOMWindow); |
var mainWin = this.windowMediator.getMostRecentWindow("navigator:browser"); |
var tabBrowser = mainWin.gBrowser; |
|
// params |
if(!params.dialogTitle) { |
params.dialogTitle = this.commonBundle.GetStringFromName(params.dialogTitleKey); |
var parentTab; |
for(var i = 0, l = tabBrowser.browsers.length; i < l; ++i) { |
var b = tabBrowser.getBrowserAtIndex(i); |
if(b.contentWindow == aParent) { |
parentTab = tabBrowser.tabContainer.childNodes[i]; |
} |
} |
|
// disable all dynamics in the window |
var jsAllowed = parentDocShell.allowJavascript; |
parentDocShell.allowJavascript = false; |
parentDocShell.suspendRefreshURIs(); |
} |
|
var args = Components.classes["@mozilla.org/embedcomp/dialogparam;1"] |
.createInstance(Components.interfaces.nsIDialogParamBlock); |
args.SetString(0, params.text); |
args.SetString(1, params.checkboxMsg); |
args.SetString(2, params.iconClass); |
args.SetString(3, params.titleMessage); |
args.SetString(4, params.editfield1Msg); |
args.SetString(5, params.editfield2Msg); |
args.SetString(6, params.editfield1Value); |
args.SetString(7, params.editfield2Value); |
args.SetString(8, params.button0Text); |
args.SetString(9, params.button1Text); |
args.SetString(10, params.button2Text); |
args.SetString(11, params.button3Text); |
args.SetString(12, params.dialogTitle); |
args.SetString(13, params.openingSound); |
args.SetInt (1, params.checkboxState); |
args.SetInt (2, params.numberButtons); |
args.SetInt (3, params.numberEditfields); |
args.SetInt (4, params.editField1Password); |
args.SetInt (5, params.defaultButton); |
args.SetInt (6, params.delayButtonEnable); |
args.SetInt (7, params.soundEventId); |
|
// show the dialog |
var win = this.windowWatcher.openWindow(aParent, "chrome://global/content/commonDialog.xul", |
"_blank", "centerscreen,chrome,titlebar" /*,dependent*/, args); |
win.openInProgress = true; |
var win = this.windowWatcher.openWindow(aParent, params.url, |
"_blank", "centerscreen,chrome,titlebar" + (showModal ? ",modal" : ""), args); |
|
var winRequestor = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor); |
var winDocShell = winRequestor.getInterface(Components.interfaces.nsIWebNavigation) |
.QueryInterface(Components.interfaces.nsIDocShell); |
var winInt = winRequestor.getInterface(Components.interfaces.nsIDOMWindowInternal); |
if(!showModal) { |
win.openInProgress = true; |
|
var winXul; |
var xulEnum = this.windowMediator.getXULWindowEnumerator(null); |
while(xulEnum.hasMoreElements()) { |
var xulWindow = xulEnum.getNext(); |
xulWindow.QueryInterface(Components.interfaces.nsIXULWindow); |
if(xulWindow.docShell == winDocShell) { |
winXul = xulWindow; |
var winRequestor = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor); |
var winDocShell = winRequestor.getInterface(Components.interfaces.nsIWebNavigation) |
.QueryInterface(Components.interfaces.nsIDocShell); |
var winInt = winRequestor.getInterface(Components.interfaces.nsIDOMWindowInternal); |
|
var winXul; |
var xulEnum = this.windowMediator.getXULWindowEnumerator(null); |
while(xulEnum.hasMoreElements()) { |
var xulWindow = xulEnum.getNext(); |
xulWindow.QueryInterface(Components.interfaces.nsIXULWindow); |
if(xulWindow.docShell == winDocShell) { |
winXul = xulWindow; |
} |
} |
} |
winXul.zLevel = Components.interfaces.nsIXULWindow.raisedZ; |
winXul.zLevel = Components.interfaces.nsIXULWindow.raisedZ; |
|
// listeners |
var parentClick = function(aEvent) { |
if(win) { |
win.focus(); |
} |
}; |
var parentUnload = function(aEvent) { |
if(win) { |
win.close(); |
} |
}; |
var winFocus = function(aEvent) { |
if(aEvent.target == win) { |
if(win.openInProgress) { |
win.openInProgress = false; |
// listeners |
var parentClick = function(aEvent) { |
if(win) { |
win.focus(); |
} |
else if(win.focusInProgress) { |
win.focusInProgress = false; |
}; |
var parentUnload = function(aEvent) { |
if(win) { |
win.close(); |
} |
else { |
tabBrowser.selectedTab = parentTab; |
mainWin.focus(); |
}; |
var winFocus = function(aEvent) { |
if(aEvent.target == win) { |
if(win.openInProgress) { |
win.openInProgress = false; |
} |
else if(win.focusInProgress) { |
win.focusInProgress = false; |
} |
else { |
tabBrowser.selectedTab = parentTab; |
mainWin.focus(); |
win.focusInProgress = true; |
win.focus(); |
} |
} |
}; |
var parentTabSelect = function(aEvent) { |
if(tabBrowser.selectedTab == parentTab) { |
winXul.zLevel = Components.interfaces.nsIXULWindow.raisedZ; |
win.focusInProgress = true; |
win.focus(); |
} |
} |
}; |
var parentTabSelect = function(aEvent) { |
if(tabBrowser.selectedTab == parentTab) { |
winXul.zLevel = Components.interfaces.nsIXULWindow.raisedZ; |
win.focusInProgress = true; |
win.focus(); |
} |
else { |
winXul.zLevel = Components.interfaces.nsIXULWindow.loweredZ; |
} |
}; |
else { |
winXul.zLevel = Components.interfaces.nsIXULWindow.loweredZ; |
} |
}; |
|
aParent.addEventListener('click', parentClick, true); |
aParent.addEventListener('unload', parentUnload, true); |
win.addEventListener('focus', winFocus, false); |
tabBrowser.tabContainer.addEventListener('TabSelect', parentTabSelect, false); |
aParent.addEventListener('click', parentClick, true); |
aParent.addEventListener('unload', parentUnload, true); |
win.addEventListener('focus', winFocus, false); |
tabBrowser.tabContainer.addEventListener('TabSelect', parentTabSelect, false); |
|
// wait until the dialog is closed |
while(!winInt.closed && this.threadManager.currentThread.processNextEvent(true)); |
// wait until the dialog is closed |
while(!winInt.closed && this.threadManager.currentThread.processNextEvent(true)); |
} |
|
if(!parentInt.closed) { |
if(!showModal && !parentInt.closed) { |
// restore |
aParent.removeEventListener('click', parentClick, true); |
aParent.removeEventListener('unload', parentUnload, true); |
169,18 → 177,13 |
|
parentDocShell.resumeRefreshURIs(); |
parentDocShell.allowJavascript = jsAllowed; |
} |
|
// eval the answer |
params.buttonPressed = args.GetInt(0); |
params.checkboxState = args.GetInt(1); |
params.editfield1Value = args.GetString(6); |
params.editfield2Value = args.GetString(7); |
|
return true; |
} |
else { |
return false; |
} |
// eval the answer |
params.buttonPressed = args.GetInt(0); |
params.checkboxState = args.GetInt(1); |
params.editfield1Value = args.GetString(6); |
params.editfield2Value = args.GetString(7); |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
187,24 → 190,7 |
// interface nsIPromptService |
alert: function(aParent, aDialogTitle, aText) |
{ |
if(this.isEnabled(aParent, 'alert')) { |
var params = { |
dialogTitleKey: "Alert", |
dialogTitle: aDialogTitle, |
text: aText, |
numberButtons: 1, |
numberEditfields: 0, |
iconClass: "alert-icon", |
openingSound: "_moz_alertdialog", |
soundEventId: 1, |
url: "chrome://global/content/commonDialog.xul", |
}; |
|
this.showDialog(aParent, params); |
} |
else { |
NoModal_Prompt.origin.alert(aParent, aDialogTitle, aText); |
} |
this.alertCheck(aParent, aDialogTitle, aText, null, null); |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
211,7 → 197,31 |
// interface nsIPromptService |
alertCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) |
{ |
return NoModal_Prompt.origin.alertCheck(aParent, aDialogTitle, aText, aCheckMsg, aCheckState); |
var params = { |
dialogTitleKey: "Alert", |
dialogTitle: aDialogTitle, |
text: aText, |
numberButtons: 1, |
numberEditfields: 0, |
iconClass: "alert-icon", |
openingSound: "_moz_alertdialog", |
soundEventId: 1, |
url: "chrome://global/content/commonDialog.xul", |
}; |
|
if(aCheckMsg && aCheckState) { |
params.checkboxMsg = aCheckMsg; |
params.checkboxState = (aCheckState.value ? 1 : 0); |
} |
|
this.showDialog(!this.isEnabled(aParent, 'alert'), aParent, params); |
|
var res = (params.buttonPressed == 0); |
if(res) { |
if(aCheckState) { |
aCheckState.value = (params.checkboxState == 1); |
} |
} |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
218,26 → 228,23 |
// interface nsIPromptService |
confirm: function(aParent, aDialogTitle, aText) |
{ |
if(this.isEnabled(aParent, 'confirm')) { |
var params = { |
dialogTitleKey: "Confirm", |
dialogTitle: aDialogTitle, |
text: aText, |
numberButtons: 2, |
numberEditfields: 0, |
iconClass: "question-icon", |
openingSound: "_moz_confirmdialog", |
soundEventId: 2, |
url: "chrome://global/content/commonDialog.xul", |
}; |
var params = { |
dialogTitleKey: "Confirm", |
dialogTitle: aDialogTitle, |
text: aText, |
numberButtons: 2, |
numberEditfields: 0, |
iconClass: "question-icon", |
openingSound: "_moz_confirmdialog", |
soundEventId: 2, |
url: "chrome://global/content/commonDialog.xul", |
}; |
|
this.showDialog(aParent, params); |
this.showDialog(!this.isEnabled(aParent, 'confirm'), aParent, params); |
|
return (params.buttonPressed == 0); |
} |
else { |
return NoModal_Prompt.origin.confirm(aParent, aDialogTitle, aText); |
} |
var res = (params.buttonPressed == 0); |
|
return res; |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
244,7 → 251,33 |
// interface nsIPromptService |
confirmCheck: function(aParent, aDialogTitle, aText, aCheckMsg, aCheckState) |
{ |
return NoModal_Prompt.origin.confirmCheck(aParent, aDialogTitle, aText, aCheckMsg, aCheckState); |
var params = { |
dialogTitleKey: "ConfirmCheck", |
dialogTitle: aDialogTitle, |
text: aText, |
numberButtons: 2, |
numberEditfields: 0, |
iconClass: "question-icon", |
openingSound: "_moz_confirmdialog", |
soundEventId: 2, |
url: "chrome://global/content/commonDialog.xul", |
}; |
|
if(aCheckMsg && aCheckState) { |
params.checkboxMsg = aCheckMsg; |
params.checkboxState = (aCheckState.value ? 1 : 0); |
} |
|
this.showDialog(!this.isEnabled(aParent, 'confirm'), aParent, params); |
|
var res = (params.buttonPressed == 0); |
if(res) { |
if(aCheckState) { |
aCheckState.value = (params.checkboxState == 1); |
} |
} |
|
return res; |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
252,8 → 285,75 |
confirmEx: function(aParent, aDialogTitle, aText, aButtonFlags, aButton0Title, aButton1Title, aButton2Title, |
aCheckMsg, aCheckState) |
{ |
return NoModal_Prompt.origin.confirmEx(aParent, aDialogTitle, aText, aButtonFlags, aButton0Title, |
aButton1Title, aButton2Title, aCheckMsg, aCheckState); |
var params = { |
dialogTitleKey: "Confirm", |
dialogTitle: aDialogTitle, |
text: aText, |
numberButtons: 0, |
numberEditfields: 0, |
iconClass: "question-icon", |
openingSound: "_moz_confirmdialog", |
soundEventId: 2, |
url: "chrome://global/content/commonDialog.xul", |
}; |
|
var buttonIds = [ 'button0Text', 'button1Text', 'button2Text' ]; |
var buttonStrings = [ aButton0Title, aButton1Title, aButton2Title ]; |
|
params.defaultButton = ((aButtonFlags & 0x03000000) >> 24); |
params.delayButtonEnable = (aButtonFlags & Components.interfaces.nsIPromptService.BUTTON_DELAY_ENABLE); |
|
for(var i = 0; i < 3; i++) { |
var buttonText; |
switch(aButtonFlags & 0xff) { |
case Components.interfaces.nsIPromptService.BUTTON_TITLE_OK: |
buttonText = this.commonBundle.GetStringFromName("OK"); |
break; |
case Components.interfaces.nsIPromptService.BUTTON_TITLE_CANCEL: |
buttonText = this.commonBundle.GetStringFromName("Cancel"); |
break; |
case Components.interfaces.nsIPromptService.BUTTON_TITLE_YES: |
buttonText = this.commonBundle.GetStringFromName("Yes"); |
break; |
case Components.interfaces.nsIPromptService.BUTTON_TITLE_NO: |
buttonText = this.commonBundle.GetStringFromName("No"); |
break; |
case Components.interfaces.nsIPromptService.BUTTON_TITLE_SAVE: |
buttonText = this.commonBundle.GetStringFromName("Save"); |
break; |
case Components.interfaces.nsIPromptService.BUTTON_TITLE_DONT_SAVE: |
buttonText = this.commonBundle.GetStringFromName("DontSave"); |
break; |
case Components.interfaces.nsIPromptService.BUTTON_TITLE_REVERT: |
buttonText = this.commonBundle.GetStringFromName("Revert"); |
break; |
case Components.interfaces.nsIPromptService.BUTTON_TITLE_IS_STRING: |
buttonText = buttonStrings[i]; |
break; |
} |
|
if(buttonText) { |
params[buttonIds[i]] = buttonText; |
++params.numberButtons; |
} |
aButtonFlags >>= 8; |
} |
|
if(aCheckMsg && aCheckState) { |
params.checkboxMsg = aCheckMsg; |
params.checkboxState = (aCheckState.value ? 1 : 0); |
} |
|
this.showDialog(!this.isEnabled(aParent, 'confirm'), aParent, params); |
|
var res = (params.buttonPressed == 0); |
if(res) { |
if(aCheckState) { |
aCheckState.value = (params.checkboxState == 1); |
} |
} |
|
return res; |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
260,41 → 360,36 |
// interface nsIPromptService |
prompt: function(aParent, aDialogTitle, aText, aValue, aCheckMsg, aCheckState) |
{ |
if(this.isEnabled(aParent, 'confirm')) { |
var params = { |
dialogTitleKey: "Prompt", |
dialogTitle: aDialogTitle, |
text: aText, |
numberButtons: 2, |
numberEditfields: 1, |
iconClass: "question-icon", |
openingSound: "_moz_promptdialog", |
soundEventId: 3, |
url: "chrome://global/content/commonDialog.xul", |
editfield1Value: aValue.value, |
}; |
var params = { |
dialogTitleKey: "Prompt", |
dialogTitle: aDialogTitle, |
text: aText, |
numberButtons: 2, |
numberEditfields: 1, |
iconClass: "question-icon", |
openingSound: "_moz_promptdialog", |
soundEventId: 3, |
url: "chrome://global/content/commonDialog.xul", |
editfield1Value: aValue.value, |
}; |
|
if(aCheckMsg && aCheckState) { |
params.checkboxMsg = aCheckMsg; |
params.checkboxState = (aCheckState.value ? 1 : 0); |
} |
if(aCheckMsg && aCheckState) { |
params.checkboxMsg = aCheckMsg; |
params.checkboxState = (aCheckState.value ? 1 : 0); |
} |
|
this.showDialog(aParent, params); |
this.showDialog(!this.isEnabled(aParent, 'prompt'), aParent, params); |
|
var res = (params.buttonPressed == 0); |
if(res) { |
aValue.value = params.editfield1Value; |
var res = (params.buttonPressed == 0); |
if(res) { |
aValue.value = params.editfield1Value; |
|
if(aCheckState) { |
aCheckState.value = (params.checkboxState == 1); |
} |
if(aCheckState) { |
aCheckState.value = (params.checkboxState == 1); |
} |
} |
|
return res; |
} |
else { |
return NoModal_Prompt.origin.prompt(aParent, aDialogTitle, aText, aValue, aCheckMsg, aCheckState); |
} |
return res; |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
301,44 → 396,38 |
// interface nsIPromptService |
promptUsernameAndPassword: function(aParent, aDialogTitle, aText, aUsername, aPassword, aCheckMsg, aCheckState) |
{ |
if(this.isEnabled(aParent, 'promptUsernameAndPassword')) { |
var params = { |
dialogTitleKey: "PromptUsernameAndPassword2", |
dialogTitle: aDialogTitle, |
text: aText, |
numberButtons: 2, |
numberEditfields: 2, |
iconClass: "authentication-icon question-icon", |
openingSound: "_moz_promptdialog", |
soundEventId: 3, |
url: "chrome://global/content/commonDialog.xul", |
editfield1Value: aUsername.value, |
editfield2Value: aPassword.value, |
}; |
var params = { |
dialogTitleKey: "PromptUsernameAndPassword2", |
dialogTitle: aDialogTitle, |
text: aText, |
numberButtons: 2, |
numberEditfields: 2, |
iconClass: "authentication-icon question-icon", |
openingSound: "_moz_promptdialog", |
soundEventId: 3, |
url: "chrome://global/content/commonDialog.xul", |
editfield1Value: aUsername.value, |
editfield2Value: aPassword.value, |
}; |
|
if(aCheckMsg && aCheckState) { |
params.checkboxMsg = aCheckMsg; |
params.checkboxState = (aCheckState.value ? 1 : 0); |
} |
if(aCheckMsg && aCheckState) { |
params.checkboxMsg = aCheckMsg; |
params.checkboxState = (aCheckState.value ? 1 : 0); |
} |
|
this.showDialog(aParent, params); |
this.showDialog(!this.isEnabled(aParent, 'promptUsernameAndPassword'), aParent, params); |
|
var res = (params.buttonPressed == 0); |
if(res) { |
aUsername.value = params.editfield1Value; |
aPassword.value = params.editfield2Value; |
var res = (params.buttonPressed == 0); |
if(res) { |
aUsername.value = params.editfield1Value; |
aPassword.value = params.editfield2Value; |
|
if(aCheckState) { |
aCheckState.value = (params.checkboxState == 1); |
} |
if(aCheckState) { |
aCheckState.value = (params.checkboxState == 1); |
} |
} |
|
return res; |
} |
else { |
return NoModal_Prompt.origin.promptUsernameAndPassword(aParent, aDialogTitle, aText, aUsername, aPassword, |
aCheckMsg, aCheckState); |
} |
return res; |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
345,42 → 434,37 |
// interface nsIPromptService |
promptPassword: function(aParent, aDialogTitle, aText, aPassword, aCheckMsg, aCheckState) |
{ |
if(this.isEnabled(aParent, 'promptPassword')) { |
var params = { |
dialogTitleKey: "PromptPassword2", |
dialogTitle: aDialogTitle, |
text: aText, |
numberButtons: 2, |
numberEditfields: 1, |
editField1Password: 1, |
iconClass: "authentication-icon question-icon", |
openingSound: "_moz_promptdialog", |
soundEventId: 3, |
url: "chrome://global/content/commonDialog.xul", |
editfield1Value: aPassword.value, |
}; |
var params = { |
dialogTitleKey: "PromptPassword2", |
dialogTitle: aDialogTitle, |
text: aText, |
numberButtons: 2, |
numberEditfields: 1, |
editField1Password: 1, |
iconClass: "authentication-icon question-icon", |
openingSound: "_moz_promptdialog", |
soundEventId: 3, |
url: "chrome://global/content/commonDialog.xul", |
editfield1Value: aPassword.value, |
}; |
|
if(aCheckMsg && aCheckState) { |
params.checkboxMsg = aCheckMsg; |
params.checkboxState = (aCheckState.value ? 1 : 0); |
} |
if(aCheckMsg && aCheckState) { |
params.checkboxMsg = aCheckMsg; |
params.checkboxState = (aCheckState.value ? 1 : 0); |
} |
|
this.showDialog(aParent, params); |
this.showDialog(!this.isEnabled(aParent, 'promptPassword'), aParent, params); |
|
var res = (params.buttonPressed == 0); |
if(res) { |
aPassword.value = params.editfield1Value; |
var res = (params.buttonPressed == 0); |
if(res) { |
aPassword.value = params.editfield1Value; |
|
if(aCheckState) { |
aCheckState.value = (params.checkboxState == 1); |
} |
if(aCheckState) { |
aCheckState.value = (params.checkboxState == 1); |
} |
} |
|
return res; |
} |
else { |
return NoModal_Prompt.origin.promptPassword(aParent, aDialogTitle, aText, aPassword, aCheckMsg, aCheckState); |
} |
return res; |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
387,7 → 471,32 |
// interface nsIPromptService |
select: function(aParent, aDialogTitle, aText, aCount, aSelectList, aOutSelection) |
{ |
return NoModal_Prompt.origin.select(aParent, aDialogTitle, aText, aCount, aSelectList, aOutSelection); |
// note: the selectDialog.xul uses another params numbering |
if(!aDialogTitle) { |
aDialogTitle = this.commonBundle.GetStringFromName("Select"); |
} |
|
var args = Components.classes["@mozilla.org/embedcomp/dialogparam;1"] |
.createInstance(Components.interfaces.nsIDialogParamBlock); |
args.SetNumberStrings(aCount+2); |
|
args.SetString(0, aDialogTitle); |
args.SetString(1, aText); |
args.SetInt(2, aCount); |
for(var i = 0; i < aCount; ++i) { |
args.SetString(i+2, aSelectList[i]); |
} |
|
var params = { |
url: "chrome://global/content/selectDialog.xul", |
}; |
|
this.showDialog(!this.isEnabled(aParent, 'select'), aParent, params); |
|
aOutSelection.value = args.GetInt(2); |
var res = (params.buttonPressed == 0); |
|
return res; |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
394,12 → 503,7 |
// interface nsIPromptService2 |
promptAuth: function(aParent, aChannel, level, authInfo, checkboxLabel, checkValue) |
{ |
if(this.isEnabled(aParent, 'promptAuth')) { |
return this.promptPasswordAdapter(aParent, aChannel, level, authInfo, checkboxLabel, checkValue); |
} |
else { |
return NoModal_Prompt.origin.promptAuth(aParent, aChannel, level, authInfo, checkboxLabel, checkValue); |
} |
return this.promptPasswordAdapter(aParent, aChannel, level, authInfo, checkboxLabel, checkValue); |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
406,7 → 510,7 |
// interface nsIPromptService2 |
asyncPromptAuth: function(aParent, aChannel, aCallback, aContext, level, authInfo, checkboxLabel, checkValue) |
{ |
return NoModal_Prompt.origin.asyncPromptAuth(aParent, aChannel, level, authInfo, checkboxLabel, checkValue); |
return null; // NS_ERROR_NOT_IMPLEMENTED |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
500,9 → 604,5 |
// ===================================================================================================================== |
function NSGetModule(compMgr, fileSpec) |
{ |
NoModal_Prompt.origin = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] |
.getService(Components.interfaces.nsIPromptService); |
NoModal_Prompt.origin.QueryInterface(Components.interfaces.nsIPromptService2); |
|
return XPCOMUtils.generateModule([NoModal_Prompt]); |
} |