This is just some static backup of the original site, don't expect every link to work!

source: chrome/content/v_identity/vI_msgIdentityCloneTools.js @ 80940ab

multiEditng_0.6ng_0.8ng_0.9
Last change on this file since 80940ab was 80940ab, checked in by rene <rene@…>, 13 years ago

modified comments to get clearer debug info

  • Property mode set to 100644
File size: 4.8 KB
Line 
1/* ***** BEGIN LICENSE BLOCK *****
2    This program is free software; you can redistribute it and/or modify
3    it under the terms of the GNU General Public License as published by
4    the Free Software Foundation; either version 2 of the License, or
5    (at your option) any later version.
6
7    This program is distributed in the hope that it will be useful,
8    but WITHOUT ANY WARRANTY; without even the implied warranty of
9    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10    GNU General Public License for more details.
11
12    You should have received a copy of the GNU General Public License
13    along with this program; if not, write to the Free Software
14    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
15
16    The Original Code is the Virtual Identity Extension.
17
18    The Initial Developer of the Original Code is Rene Ejury.
19    Portions created by the Initial Developer are Copyright (C) 2007
20    the Initial Developer. All Rights Reserved.
21
22    Contributor(s): Thunderbird Developers
23 * ***** END LICENSE BLOCK ***** */
24
25var vI_msgIdentityCloneTools = {   
26    copySelectedIdentity : function(id_key) {
27        vI_notificationBar.dump("## vI_msgIdentityCloneTools: copySelectedIdentity\n");
28        var msgIdentityElem = document.getElementById("msgIdentity");
29        var msgIdentityPopupElem = document.getElementById("msgIdentityPopup");
30        // copy selected Menu-Value from clone to orig.
31        var MenuItems = msgIdentityPopupElem.childNodes
32        for (var index = 0; index < MenuItems.length; index++) {
33            if ( MenuItems[index].getAttribute("value") == id_key ) {
34                msgIdentityElem.selectedItem = MenuItems[index];
35                msgIdentityElem.value = MenuItems[index].getAttribute("value");
36                break;
37            }
38        }
39        msgIdentityPopupElem.doCommand();
40    },
41       
42    signatureSwitch: function(existingIdentity) {
43        if (!existingIdentity) {
44            vI_notificationBar.dump("## vI_msgIdentityCloneTools: signatureSwitch hide/remove signatures\n");
45            // code to hide the text signature
46            try { if (vI.preferences.getBoolPref("hide_signature") && ss_signature.length == 0) {
47                vI_notificationBar.dump("## vI_msgIdentityCloneTools: hide text/html signature");
48                ss_main.signatureSwitch()
49                vI_notificationBar.dump("\n");
50            } } catch(vErr) { vI_notificationBar.dump(" -- missing signatureSwitch extension?\n"); };
51            // code to hide the sMime signature
52            try { if (vI.preferences.getBoolPref("hide_sMime_messageSignature")) {
53                var element = document.getElementById("menu_securitySign1");
54                if (element.getAttribute("checked") == "true") {
55                    vI_notificationBar.dump("## signatureSwitch hide_sMime_messageSignature with doCommand\n");
56                    element.doCommand();
57                }
58            }
59            //  document.getElementById("menu_securitySign1").removeAttribute("checked");
60            } catch(vErr) { };
61            // code to hide the openGPG signature
62            try { if (vI.preferences.getBoolPref("hide_openPGP_messageSignature")) {
63                var element = document.getElementById("enigmail_signed_send");
64                if (element.getAttribute("checked") == "true") {
65                    vI_notificationBar.dump("## signatureSwitch hide_openPGP_messageSignature with doCommand\n");
66                    element.doCommand();
67                }
68            }
69            //  document.getElementById("enigmail_signed_send").removeAttribute("checked");
70            } catch(vErr) { };
71        }
72        else {
73            vI_notificationBar.dump("## vI_msgIdentityCloneTools: signatureSwitch restore signature\n");
74            // code to show the text signature
75            try { if (ss_signature.length > 0) {
76                vI_notificationBar.dump("## vI_msgIdentityCloneTools: show text/html signature");
77                ss_main.signatureSwitch()
78                vI_notificationBar.dump("\n");
79            } } catch(vErr) { vI_notificationBar.dump(" -- missing signatureSwitch extension?\n"); };
80            // sMime and openGPG signature will not be re-added automatically
81        }
82    },
83   
84    initReplyTo : function() {
85        if (vI_statusmenu.prefroot.getBoolPref("extensions.virtualIdentity.autoReplyToSelf")) {
86            document.getElementById("autoReplyToSelfLabel").removeAttribute("hidden");
87            vI_msgIdentityCloneTools.removeAllReplyTos();
88        }
89        else document.getElementById("autoReplyToSelfLabel").setAttribute("hidden", "true");
90    },
91   
92    removeAllReplyTos : function() {
93        if (!document.getElementById("autoReplyToSelfLabel").hasAttribute("hidden")) {
94            for (var row = 1; row <= top.MAX_RECIPIENTS; row ++) {
95                var awType = awGetPopupElement(row).selectedItem.getAttribute("value");
96                if (awType == "addr_reply") {
97                    vI_notificationBar.dump("## vI_msgIdentityCloneTools: removed ReplyTo found in row " + row + "\n");
98                    awDeleteRow(row--); // removed one line therefore decrease row-value
99                }
100            }
101        }
102    },
103
104    addReplyToSelf : function() {
105        if (!document.getElementById("autoReplyToSelfLabel").hasAttribute("hidden")) {
106            awAddRecipient("addr_reply",document.getElementById("msgIdentity_clone").label);
107            vI_notificationBar.dump("## vI_msgIdentityCloneTools: added ReplyToSelf");
108            document.getElementById("autoReplyToSelfLabel").setAttribute("hidden","true");
109        }
110    }
111}
Note: See TracBrowser for help on using the repository browser.