michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock; michael@0: michael@0: var dialogParams; michael@0: michael@0: function onLoad() michael@0: { michael@0: dialogParams = window.arguments[0].QueryInterface(nsIDialogParamBlock); michael@0: var selectElement = document.getElementById("tokens"); michael@0: var aCount = dialogParams.GetInt(0); michael@0: for (var i=0; i < aCount; i++) { michael@0: var menuItemNode = document.createElement("menuitem"); michael@0: var token = dialogParams.GetString(i); michael@0: menuItemNode.setAttribute("value", token); michael@0: menuItemNode.setAttribute("label", token); michael@0: selectElement.firstChild.appendChild(menuItemNode); michael@0: if (i == 0) { michael@0: selectElement.selectedItem = menuItemNode; michael@0: } michael@0: } michael@0: } michael@0: michael@0: function doOK() michael@0: { michael@0: var tokenList = document.getElementById("tokens"); michael@0: var token = tokenList.value; michael@0: dialogParams.SetInt(0,1); michael@0: dialogParams.SetString(0, token); michael@0: return true; michael@0: } michael@0: michael@0: function doCancel() michael@0: { michael@0: dialogParams.SetInt(0,0); michael@0: return true; michael@0: }