Bug 879435 - Hide Chat nick fields and properly decode 'Prefers HTML mail' flag in own vCard dialog . r=Standard8
authoraceman <acelists@atlas.sk>
Mon, 24 Jun 2013 19:39:45 +0100
changeset 15807 cfb9aed1790df413aa7194d2a233eee7120fc64e
parent 15806 9ff0c7ce1ea245e1ed3d9a2217673b0df5ad95aa
child 15808 f9daa00af61d914e66c37da5cde25c1b551914e8
push idunknown
push userunknown
push dateunknown
reviewersStandard8
bugs879435
Bug 879435 - Hide Chat nick fields and properly decode 'Prefers HTML mail' flag in own vCard dialog . r=Standard8
mail/components/addrbook/content/abCardOverlay.js
mail/components/addrbook/content/abCardOverlay.xul
mailnews/addrbook/src/nsAbManager.cpp
--- a/mail/components/addrbook/content/abCardOverlay.js
+++ b/mail/components/addrbook/content/abCardOverlay.js
@@ -529,16 +529,17 @@ function GetCardValues(cardproperty, doc
 }
 
 // when the ab card dialog is being loaded to show a vCard,
 // hide the fields which aren't supported
 // by vCard so the user does not try to edit them.
 function HideNonVcardFields()
 {
   document.getElementById("homeTabButton").hidden = true;
+  document.getElementById("chatTabButton").hidden = true;
   document.getElementById("photoTabButton").hidden = true;
   var i;
   for (i = kNonVcardFields.length; i-- > 0; )
     document.getElementById(kNonVcardFields[i]).collapsed = true;
   for (i = kPhoneticFields.length; i-- > 0; )
     document.getElementById(kPhoneticFields[i]).collapsed = true;
 }
 
--- a/mail/components/addrbook/content/abCardOverlay.xul
+++ b/mail/components/addrbook/content/abCardOverlay.xul
@@ -165,30 +165,30 @@
               <spacer flex="1"/>
               <label control="CellularNumber" value="&CellularNumber.label;"
                      accesskey="&CellularNumber.accesskey;"/>
               <textbox id="CellularNumber" class="PhoneEditWidth"/>
             </hbox>
           </vbox> <!-- End of Phonenumbers -->
         </hbox> <!-- End of Name/Email/Phonenumbers -->
         <!-- Email Preferences -->
-        <hbox>
-          <vbox valign="middle">
-            <label control="PreferMailFormatPopup"
-                   value="&PreferMailFormat.label;"
-                   accesskey="&PreferMailFormat.accesskey;"/>
-          </vbox>
+        <hbox align="center">
+          <label control="PreferMailFormatPopup"
+                 value="&PreferMailFormat.label;"
+                 accesskey="&PreferMailFormat.accesskey;"/>
+
           <menulist id="PreferMailFormatPopup">
             <menupopup>
               <!-- 0,1,2 come from nsIAbPreferMailFormat in nsIAbCard.idl -->
               <menuitem value="0" label="&Unknown.label;"/>
               <menuitem value="1" label="&PlainText.label;"/>
               <menuitem value="2" label="&HTML.label;"/>
             </menupopup>
           </menulist>
+
           <checkbox id="allowRemoteContent" label="&allowRemoteContent1.label;"
                     accesskey="&allowRemoteContent1.accesskey;"
                     tooltiptext="&allowRemoteContent1.tooltip;"/>
         </hbox>
       </vbox> <!-- End of Name Tab -->
 
       <!-- ** Home Address Tab ** -->
       <vbox id="abHomeTab" >
--- a/mailnews/addrbook/src/nsAbManager.cpp
+++ b/mailnews/addrbook/src/nsAbManager.cpp
@@ -1173,17 +1173,26 @@ static void convertNameValue(VObject *vO
       cardPropName = kWorkWebPageProperty;
   else
       return;
 
   if (!VALUE_TYPE(vObj))
       return;
 
   char *cardPropValue = getCString(vObj);
-  aCard->SetPropertyAsAUTF8String(cardPropName, nsDependentCString(cardPropValue));
+  if (PL_strcmp(cardPropName, kPreferMailFormatProperty)) {
+    aCard->SetPropertyAsAUTF8String(cardPropName, nsDependentCString(cardPropValue));
+  } else {
+    if (!PL_strcmp(cardPropValue, "TRUE"))
+      aCard->SetPropertyAsUint32(cardPropName, nsIAbPreferMailFormat::html);
+    else if (!PL_strcmp(cardPropValue, "FALSE"))
+      aCard->SetPropertyAsUint32(cardPropName, nsIAbPreferMailFormat::plaintext);
+    else
+      aCard->SetPropertyAsUint32(cardPropName, nsIAbPreferMailFormat::unknown);
+  }
   PR_FREEIF(cardPropValue);
   return;
 }
 
 static void convertFromVObject(VObject *vObj, nsIAbCard *aCard)
 {
     if (vObj)
     {