3
* ***** BEGIN LICENSE BLOCK *****
4
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
6
* The contents of this file are subject to the Mozilla Public
7
* License Version 1.1 (the "MPL"); you may not use this file
8
* except in compliance with the MPL. You may obtain a copy of
9
* the MPL at http://www.mozilla.org/MPL/
11
* Software distributed under the MPL is distributed on an "AS
12
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
13
* implied. See the MPL for the specific language governing
14
* rights and limitations under the MPL.
16
* The Original Code is Enigmail.
18
* The Initial Developer of the Original Code is Patrick Brunschwig.
19
* Portions created by Patrick Brunschwig <patrick@mozilla-enigmail.org> are
20
* Copyright (C) 2004 Patrick Brunschwig. All Rights Reserved.
24
* Alternatively, the contents of this file may be used under the terms of
25
* either the GNU General Public License Version 2 or later (the "GPL"), or
26
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
* in which case the provisions of the GPL or the LGPL are applicable instead
28
* of those above. If you wish to allow use of your version of this file only
29
* under the terms of either the GPL or the LGPL, and not to allow others to
30
* use your version of this file under the terms of the MPL, indicate your
31
* decision by deleting the provisions above and replace them with the notice
32
* and other provisions required by the GPL or the LGPL. If you do not delete
33
* the provisions above, a recipient may use your version of this file under
34
* the terms of any one of the MPL, the GPL or the LGPL.
35
* ***** END LICENSE BLOCK ***** *
38
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
39
<?xml-stylesheet href="chrome://enigmail/skin/enigmail.css" type="text/css"?>
42
<!ENTITY % brandDTD SYSTEM "chrome://global/locale/brand.dtd" >
44
<!ENTITY % enigMailDTD SYSTEM "chrome://enigmail/locale/enigmail.dtd" >
48
<dialog id="enigmailManageUidDlg"
49
title="&enigmail.manageUidDlg.title;"
50
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
54
<vbox orient="vertical" flex="1">
56
<label value="&enigmail.manageUidDlg.affectedKey.label;"/>
57
<label id="keyId" value="?"/>
60
<label value="&enigmail.manageUidDlg.availableUid.label;" control="uidList"/>
61
<listbox flex="1" id="uidList" style="height:100px"
63
onselect="uidSelectCb()"
64
ondblclick="handleDblClick()"/>
67
label="&enigmail.manageUidDlg.addUid.label;"
68
oncommand="addUid()"/>
69
<button id="setPrimary"
70
label="&enigmail.manageUidDlg.setPrimary.label;"
71
oncommand="setPrimaryUid()"/>
72
<button id="deleteUid"
73
label="&enigmail.manageUidDlg.deleteUid.label;"
74
oncommand="deleteUid()"/>
75
<button id="revokeUid"
76
label="&enigmail.manageUidDlg.revokeUid.label;"
77
oncommand="revokeUid()"/>
80
<button dlgtype="accept" label="&enigmail.keyMan.close.label;"/>
84
<script type="application/x-javascript">
86
Components.utils.import("resource://enigmail/commonFuncs.jsm");
87
Components.utils.import("resource://enigmail/enigmailCommon.jsm");
88
Components.utils.import("resource://enigmail/keyManagement.jsm");
90
const Ec = EnigmailCommon;
93
window.arguments[1].refresh = false;
95
var keyId = window.enigmailUid +" - 0x"+ window.arguments[0].keyId.substr(-8,8);
96
document.getElementById("keyId").value = keyId;
98
if (! window.arguments[0].ownKey) {
99
document.getElementById("addUid").setAttribute("disabled", "true");
100
document.getElementById("setPrimary").setAttribute("disabled", "true");
101
document.getElementById("revokeUid").setAttribute("disabled", "true");
105
function reloadUidList() {
106
var uidList=document.getElementById("uidList");
107
while (uidList.getRowCount()>0) {
108
uidList.removeItemAt(0);
111
var enigmailSvc = Ec.getService();
115
var keyData = enigmailSvc.getKeyDetails("0x"+window.arguments[0].keyId, false);
117
var keyList=keyData.split(/[\n\r]+/);
119
for (var i=0; i < keyList.length; i++) {
120
var uidStr = keyList[i].split(/:/);
125
if (uidStr[0]=="uid") {
126
uidTxt=Ec.convertGpgToUnicode(uidStr[9]).replace(/\\e3A/g, ":");
127
if (!window.enigmailUid) {
128
window.enigmailUid = uidTxt;
132
if (uidStr[9].indexOf("1 ")==0) {
133
uidTxt=Ec.getString("userAtt.photo");
136
if (uidStr[1]=="r") {
137
uidTxt += " - "+Ec.getString("keyValid.revoked");
138
uidStr[0]=uidStr[0].replace(/^./,"r");
140
item=uidList.appendItem(uidTxt, uidStr[0]+":"+String(uidNum));
141
if (uidStr[1]=="r") {
142
item.setAttribute("class", "enigmailUidInactive");
150
function handleDblClick() {
151
var uidList = document.getElementById("uidList")
152
if (uidList.selectedCount > 0) {
153
var selValue=uidList.selectedItem.value;
154
var uidType = selValue.substr(0,3);
155
if (uidType=="uat" || uidType=="rat") {
156
EnigmailFuncs.showPhoto(window, window.arguments[0].keyId, window.enigmailUid);
161
function uidSelectCb() {
162
var uidList = document.getElementById("uidList")
163
if (uidList.selectedCount > 0) {
164
var selValue=uidList.selectedItem.value;
169
if (window.arguments[0].ownKey) {
170
var uidType = selValue.substr(0,3);
171
if (uidType=="uat" || uidType=="rat" || uidType=="rid" || selValue.substr(4)=="1") {
172
document.getElementById("setPrimary").setAttribute("disabled", "true");
175
document.getElementById("setPrimary").removeAttribute("disabled");
177
if (selValue.substr(4)=="1") {
178
document.getElementById("deleteUid").setAttribute("disabled", "true");
179
document.getElementById("revokeUid").setAttribute("disabled", "true");
182
document.getElementById("deleteUid").removeAttribute("disabled");
183
if (uidType=="rid" || uidType=="rat") {
184
document.getElementById("revokeUid").setAttribute("disabled", "true");
187
document.getElementById("revokeUid").removeAttribute("disabled");
192
if (selValue.substr(4)=="1") {
193
document.getElementById("deleteUid").setAttribute("disabled", "true");
196
document.getElementById("deleteUid").removeAttribute("disabled");
203
keyId: "0x"+window.arguments[0].keyId,
204
userId: window.enigmailUid
206
var resultObj = { refresh: false };
207
window.openDialog("chrome://enigmail/content/enigmailAddUidDlg.xul",
208
"", "dialog,modal,centerscreen", inputObj, resultObj);
209
window.arguments[1].refresh = resultObj.refresh;
213
function setPrimaryUid() {
214
var enigmailSvc = Ec.getService();
217
var errorMsgObj = new Object();
218
var uidList = document.getElementById("uidList");
219
if (uidList.selectedItem.value.substr(0,3)=="uid") {
221
EnigmailKeyMgmt.setPrimaryUid(window,
222
"0x"+window.arguments[0].keyId,
223
uidList.selectedItem.value.substr(4),
224
function _cb(exitCode, errorMsg) {
226
Ec.alert(window, Ec.getString("changePrimUidOK"));
227
window.arguments[1].refresh = true;
231
Ec.alert(window, Ec.getString("changePrimUidFailed")+"\n\n"+errorMsg);
236
function revokeUid() {
237
var enigmailSvc = Ec.getService();
240
var uidList = document.getElementById("uidList");
241
if (! Ec.confirmDlg(window, Ec.getString("revokeUidQuestion", uidList.selectedItem.label))) return;
242
if (uidList.selectedItem.value.substr(4)!="1") {
243
EnigmailKeyMgmt.revokeUid(window,
244
"0x"+window.arguments[0].keyId,
245
uidList.selectedItem.value.substr(4),
246
function _cb (exitCode, errorMsg) {
248
Ec.alert(window, Ec.getString("revokeUidOK", uidList.selectedItem.label));
249
window.arguments[1].refresh = true;
253
Ec.alert(window, Ec.getString("revokeUidFailed", uidList.selectedItem.label)+"\n\n"+errorMsgObj.value);
261
function deleteUid() {
262
var enigmailSvc = Ec.getService();
265
var uidList = document.getElementById("uidList");
266
if (! Ec.confirmDlg(window, Ec.getString("deleteUidQuestion", uidList.selectedItem.label))) return;
267
if (uidList.selectedItem.value.substr(4) != "1") {
268
EnigmailKeyMgmt.deleteUid(window,
269
"0x"+window.arguments[0].keyId,
270
uidList.selectedItem.value.substr(4),
271
function _cb (exitCode, errorMsg) {
273
Ec.alert(window, Ec.getString("deleteUidOK", uidList.selectedItem.label));
274
window.arguments[1].refresh = true;
278
Ec.alert(window, Ec.getString("deleteUidFailed", uidList.selectedItem.label)+"\n\n"+errorMsgObj.value);