Bug 261882 Import & Export to/from text files (CSV,TAB) fails to include "Screenname" field. r=Standard8,sr=dmose
authorŽiga Sancin <bisi@pikslar.com>
Thu, 29 Jan 2009 10:30:05 +0000
changeset 1787 c01858f3a47b4203f990a688cc5450a3816aac17
parent 1786 174fa863d99c3d41eae53ce03ceab098e5e065bb
child 1788 510a21be10f74025024ae529f367258127d29533
push idunknown
push userunknown
push dateunknown
reviewersStandard8, dmose
bugs261882
Bug 261882 Import & Export to/from text files (CSV,TAB) fails to include "Screenname" field. r=Standard8,sr=dmose
mail/locales/en-US/chrome/messenger/importMsgs.properties
mailnews/addrbook/src/nsAbManager.cpp
mailnews/import/src/nsImportFieldMap.cpp
mailnews/import/src/nsImportStringBundle.h
mailnews/import/test/resources/basic_addressbook.csv
mailnews/import/test/resources/import_helper.js
mailnews/mailnews.js
suite/locales/en-US/chrome/mailnews/importMsgs.properties
--- a/mail/locales/en-US/chrome/messenger/importMsgs.properties
+++ b/mail/locales/en-US/chrome/messenger/importMsgs.properties
@@ -269,19 +269,24 @@ 2132=Custom 2
 2133=Custom 3
 
 # Description: Address book field name
 ## @name IMPORT_FIELD_DESC
 ## @loc None
 2134=Custom 4
 
 # Description: Address book field name
+## @name IMPORT_FIELD_DESC
+## @loc None
+2135=Notes
+
+# Description: Address book field name
 ## @name IMPORT_FIELD_DESC_END
 ## @loc None
-2135=Notes
+2136=Screen Name
 
 #Error strings
 ImportAlreadyInProgress=An import operation is currently in progress. Try again when the current import has finished.
 
 #Error strings for settings import
 ImportSettingsBadModule=Unable to load settings module
 ImportSettingsNotFound=Unable to find settings.  Check to make sure the application is installed on this machine.
 ImportSettingsFailed=An error occurred while importing settings.  Some, or all, of the settings may not have been imported.
--- a/mailnews/addrbook/src/nsAbManager.cpp
+++ b/mailnews/addrbook/src/nsAbManager.cpp
@@ -98,17 +98,17 @@ struct ExportAttributesTableStruct
 
 const ExportAttributesTableStruct EXPORT_ATTRIBUTES_TABLE[] = {
   {kFirstNameProperty, 2100},
   {kLastNameProperty, 2101},
   {kDisplayNameProperty, 2102},
   {kNicknameProperty, 2103},
   {kPriEmailProperty, 2104},
   {k2ndEmailProperty, 2105},
-  {kScreenNameProperty},
+  {kScreenNameProperty, 2136},
   {kPreferMailFormatProperty},
   {kLastModifiedDateProperty},
   {kWorkPhoneProperty, 2106},
   {kWorkPhoneTypeProperty},
   {kHomePhoneProperty, 2107},
   {kHomePhoneTypeProperty},
   {kFaxProperty, 2108},
   {kFaxTypeProperty},
--- a/mailnews/import/src/nsImportFieldMap.cpp
+++ b/mailnews/import/src/nsImportFieldMap.cpp
@@ -362,16 +362,19 @@ NS_IMETHODIMP nsImportFieldMap::SetField
     rv = database->AddCustom3(row, pVal);
     break;
   case 34:
     rv = database->AddCustom4(row, pVal);
     break;
   case 35:
     rv = database->AddNotes(row, pVal);
     break;
+  case 36:
+    rv = database->AddAimScreenName(row, pVal);
+    break;
   default:
     /* Get the field description, and add it as an anonymous attr? */
     /* OR WHAT???? */
     {
       rv = NS_ERROR_FAILURE;
     }
   }
 
@@ -516,16 +519,19 @@ NS_IMETHODIMP nsImportFieldMap::GetField
     rv = card->GetPropertyAsAString(kCustom3Property, value);
     break;
   case 34:
     rv = card->GetPropertyAsAString(kCustom4Property, value);
     break;
   case 35:
     rv = card->GetPropertyAsAString(kNotesProperty, value);
     break;
+  case 36:
+    rv = card->GetPropertyAsAString(kScreenNameProperty, value);
+    break;
   default:
     /* Get the field description, and add it as an anonymous attr? */
     /* OR WHAT???? */
     {
       rv = NS_ERROR_FAILURE;
     }
   }
   if (rv == NS_ERROR_NOT_AVAILABLE)
--- a/mailnews/import/src/nsImportStringBundle.h
+++ b/mailnews/import/src/nsImportStringBundle.h
@@ -66,12 +66,12 @@ public:
 #define  IMPORT_ERROR_MB_NOTINITIALIZED            2005
 #define IMPORT_ERROR_MB_NOTHREAD              2006
 #define IMPORT_ERROR_MB_NOPROXY                2007
 #define IMPORT_ERROR_MB_FINDCHILD              2008
 #define IMPORT_ERROR_MB_CREATE                2009
 #define IMPORT_ERROR_MB_NODESTFOLDER            2010
 
 #define IMPORT_FIELD_DESC_START                2100
-#define IMPORT_FIELD_DESC_END                2135
+#define IMPORT_FIELD_DESC_END                2136
 
 
 #endif /* _nsImportStringBundle_H__ */
--- a/mailnews/import/test/resources/basic_addressbook.csv
+++ b/mailnews/import/test/resources/basic_addressbook.csv
@@ -1,2 +1,2 @@
-First Name,Last Name,Display Name,Nickname,Primary Email,Secondary Email,Work Phone,Home Phone,Fax Number,Pager Number,Mobile Number,Home Address,Home Address 2,Home City,Home State,Home ZipCode,Home Country,Work Address,Work Address 2,Work City,Work State,Work ZipCode,Work Country,Job Title,Department,Organization,Web Page 1,Web Page 2,Birth Year,Birth Month,Birth Day,Custom 1,Custom 2,Custom 3,Custom 4,Notes,
-John,Doe,John Doe,,johndoe@host.invalid,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+First Name,Last Name,Display Name,Nickname,Primary Email,Secondary Email,Work Phone,Home Phone,Fax Number,Pager Number,Mobile Number,Home Address,Home Address 2,Home City,Home State,Home ZipCode,Home Country,Work Address,Work Address 2,Work City,Work State,Work ZipCode,Work Country,Job Title,Department,Organization,Web Page 1,Web Page 2,Birth Year,Birth Month,Birth Day,Custom 1,Custom 2,Custom 3,Custom 4,Notes,Screen Name,
+John,Doe,John Doe,,johndoe@host.invalid,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
--- a/mailnews/import/test/resources/import_helper.js
+++ b/mailnews/import/test/resources/import_helper.js
@@ -20,36 +20,35 @@ var gAbImportHelper;
  */
 function AbImportHelper(aFile, aType, aAbName, aJsonName)
 {
   gAbImportHelper = null;
   this.mFile = aFile; // checked in the beginImport method
   this.mAbName = aAbName;
 
   /* Attribute notes:  The attributes listed in the declaration below are
-   * supported by all three text export/import types.  AimScreenName and
-   * PreferMailFormat are only supported by LDIF.
+   * supported by all three text export/import types. PreferMailFormat is only
+   * supported by LDIF.
    * The following are not supported: anniversaryYear, anniversaryMonth,
    * anniversaryDay, popularityIndex, isMailList, mailListURI, lastModifiedDate,
    * and allowRemoteContent
    */
   var supportedAttributes =
     ["FirstName", "LastName", "DisplayName", "NickName", "PrimaryEmail",
      "SecondEmail", "WorkPhone", "HomePhone", "FaxNumber", "PagerNumber",
      "CellularNumber", "HomeAddress", "HomeAddress2", "HomeCity", "HomeState",
      "HomeZipCode", "HomeCountry", "WorkAddress", "WorkAddress2", "WorkCity",
      "WorkState", "WorkZipCode", "WorkCountry", "JobTitle", "Department",
      "Company", "BirthYear", "BirthMonth", "BirthDay", "WebPage1", "WebPage2",
-     "Custom1", "Custom2", "Custom3", "Custom4", "Notes"];
+     "Custom1", "Custom2", "Custom3", "Custom4", "Notes", "_AimScreenName"];
   // get the extra attributes supported for the given type of import
   if (aType == "LDIF")
   {
-    // LDIF: add AimScreenName and PreferMailFormat
-    this.mSupportedAttributes = supportedAttributes.concat(["_AimScreenName",
-                                                            "PreferMailFormat"]);
+    // LDIF: add PreferMailFormat
+    this.mSupportedAttributes = supportedAttributes.concat(["PreferMailFormat"]);
     this.mLdif = true;
   }
   else if (aType == "CSV" || aType == "TAB")
   {
     this.mSupportedAttributes = supportedAttributes;
     this.mLdif = false;
   }
   else
--- a/mailnews/mailnews.js
+++ b/mailnews/mailnews.js
@@ -812,8 +812,11 @@ pref("mailnews.emptyTrash.dontAskAgain",
 // Should the indexer be enabled?
 pref("mailnews.database.global.indexer.enabled", false);
 // Should we output warnings and errors to the "error console"?
 pref("mailnews.database.global.logging.console", false);
 // Should we output all output levels to stdout via dump?
 pref("mailnews.database.global.logging.dump", false);
 // Should we consider outputting all levels via the network?
 pref("mailnews.database.global.logging.net", false);
+
+// default field order in the fieldmap
+pref("mailnews.import.text.fieldmap", "+0,+1,+2,+3,+4,+5,+36,+6,+7,+8,+9,+10,+11,+12,+13,+14,+15,+16,+17,+18,+19,+20,+21,+22,+23,+24,+25,+26,+27,+28,+29,+30,+31,+32,+33,+34,+35");
--- a/suite/locales/en-US/chrome/mailnews/importMsgs.properties
+++ b/suite/locales/en-US/chrome/mailnews/importMsgs.properties
@@ -271,19 +271,24 @@ 2132=Custom 2
 2133=Custom 3
 
 # Description: Address book field name
 ## @name IMPORT_FIELD_DESC
 ## @loc None
 2134=Custom 4
 
 # Description: Address book field name
+## @name IMPORT_FIELD_DESC
+## @loc None
+2135=Notes
+
+# Description: Address book field name
 ## @name IMPORT_FIELD_DESC_END
 ## @loc None
-2135=Notes
+2136=Screen Name
 
 #Error strings
 ImportAlreadyInProgress=An import operation is currently in progress. Try again when the current import has finished.
 
 #Error strings for settings import
 ImportSettingsBadModule=Unable to load settings module
 ImportSettingsNotFound=Unable to find settings.  Check to make sure the application is installed on this machine.
 ImportSettingsFailed=An error occurred while importing settings.  Some, or all, of the settings may not have been imported.