41,135 → 41,127 |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
showDialog: function(showModal, aParent, params, args) |
showDialog: function(aParent, params) |
{ |
// params |
if(!args) { |
if(!params.dialogTitle && params.dialogTitleKey) { |
params.dialogTitle = this.commonBundle.GetStringFromName(params.dialogTitleKey); |
// 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; |
|
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); |
// disable all dynamics in the window |
var jsAllowed = parentDocShell.allowJavascript; |
parentDocShell.allowJavascript = false; |
parentDocShell.suspendRefreshURIs(); |
|
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); |
// params |
if(!params.dialogTitle) { |
params.dialogTitle = this.commonBundle.GetStringFromName(params.dialogTitleKey); |
} |
|
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; |
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); |
|
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(); |
} |
|
// show the dialog |
var win = this.windowWatcher.openWindow(aParent, params.url, |
"_blank", "centerscreen,chrome,titlebar" + (showModal ? ",modal" : ""), args); |
var win = this.windowWatcher.openWindow(aParent, "chrome://global/content/commonDialog.xul", |
"_blank", "centerscreen,chrome,titlebar" /*,dependent*/, args); |
win.openInProgress = true; |
|
if(!showModal) { |
win.openInProgress = true; |
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 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; |
|
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; |
} |
// listeners |
var parentClick = function(aEvent) { |
if(win) { |
win.focus(); |
} |
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; |
} |
}; |
var parentUnload = function(aEvent) { |
if(win) { |
win.close(); |
else if(win.focusInProgress) { |
win.focusInProgress = false; |
} |
}; |
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; |
else { |
tabBrowser.selectedTab = parentTab; |
mainWin.focus(); |
win.focusInProgress = true; |
win.focus(); |
} |
else { |
winXul.zLevel = Components.interfaces.nsIXULWindow.loweredZ; |
} |
}; |
} |
}; |
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; |
} |
}; |
|
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(!showModal && !parentInt.closed) { |
if(!parentInt.closed) { |
// restore |
aParent.removeEventListener('click', parentClick, true); |
aParent.removeEventListener('unload', parentUnload, true); |
177,13 → 169,18 |
|
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; |
} |
|
// eval the answer |
params.buttonPressed = args.GetInt(0); |
params.checkboxState = args.GetInt(1); |
params.editfield1Value = args.GetString(6); |
params.editfield2Value = args.GetString(7); |
else { |
return false; |
} |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
190,7 → 187,24 |
// interface nsIPromptService |
alert: function(aParent, aDialogTitle, aText) |
{ |
this.alertCheck(aParent, aDialogTitle, aText, null, null); |
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); |
} |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
197,31 → 211,7 |
// interface nsIPromptService |
alertCheck: function(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); |
} |
} |
return NoModal_Prompt.origin.alertCheck(aParent, aDialogTitle, aText, aCheckMsg, aCheckState); |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
228,23 → 218,26 |
// interface nsIPromptService |
confirm: function(aParent, aDialogTitle, aText) |
{ |
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", |
}; |
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", |
}; |
|
this.showDialog(!this.isEnabled(aParent, 'confirm'), aParent, params); |
this.showDialog(aParent, params); |
|
var res = (params.buttonPressed == 0); |
|
return res; |
return (params.buttonPressed == 0); |
} |
else { |
return NoModal_Prompt.origin.confirm(aParent, aDialogTitle, aText); |
} |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
251,33 → 244,7 |
// interface nsIPromptService |
confirmCheck: function(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; |
return NoModal_Prompt.origin.confirmCheck(aParent, aDialogTitle, aText, aCheckMsg, aCheckState); |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
285,75 → 252,8 |
confirmEx: function(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; |
return NoModal_Prompt.origin.confirmEx(aParent, aDialogTitle, aText, aButtonFlags, aButton0Title, |
aButton1Title, aButton2Title, aCheckMsg, aCheckState); |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
360,36 → 260,41 |
// interface nsIPromptService |
prompt: function(aParent, aDialogTitle, aText, aValue, aCheckMsg, aCheckState) |
{ |
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(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, |
}; |
|
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(!this.isEnabled(aParent, 'prompt'), aParent, params); |
this.showDialog(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; |
} |
|
return res; |
else { |
return NoModal_Prompt.origin.prompt(aParent, aDialogTitle, aText, aValue, aCheckMsg, aCheckState); |
} |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
396,38 → 301,44 |
// interface nsIPromptService |
promptUsernameAndPassword: function(aParent, aDialogTitle, aText, aUsername, aPassword, aCheckMsg, aCheckState) |
{ |
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(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, |
}; |
|
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(!this.isEnabled(aParent, 'promptUsernameAndPassword'), aParent, params); |
this.showDialog(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; |
} |
|
return res; |
else { |
return NoModal_Prompt.origin.promptUsernameAndPassword(aParent, aDialogTitle, aText, aUsername, aPassword, |
aCheckMsg, aCheckState); |
} |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
434,37 → 345,42 |
// interface nsIPromptService |
promptPassword: function(aParent, aDialogTitle, aText, aPassword, aCheckMsg, aCheckState) |
{ |
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(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, |
}; |
|
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(!this.isEnabled(aParent, 'promptPassword'), aParent, params); |
this.showDialog(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; |
} |
|
return res; |
else { |
return NoModal_Prompt.origin.promptPassword(aParent, aDialogTitle, aText, aPassword, aCheckMsg, aCheckState); |
} |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
471,32 → 387,7 |
// interface nsIPromptService |
select: function(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; |
return NoModal_Prompt.origin.select(aParent, aDialogTitle, aText, aCount, aSelectList, aOutSelection); |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
503,7 → 394,12 |
// interface nsIPromptService2 |
promptAuth: function(aParent, aChannel, level, authInfo, checkboxLabel, checkValue) |
{ |
return this.promptPasswordAdapter(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); |
} |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
510,7 → 406,7 |
// interface nsIPromptService2 |
asyncPromptAuth: function(aParent, aChannel, aCallback, aContext, level, authInfo, checkboxLabel, checkValue) |
{ |
return null; // NS_ERROR_NOT_IMPLEMENTED |
return NoModal_Prompt.origin.asyncPromptAuth(aParent, aChannel, level, authInfo, checkboxLabel, checkValue); |
}, |
|
// ----------------------------------------------------------------------------------------------------------------- |
604,5 → 500,9 |
// ===================================================================================================================== |
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]); |
} |