From 5e070cbda5fdbef13dfe2b47a374f1b87e79f9d2 Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Fri, 2 Jun 2000 02:49:06 +0000 Subject: [PATCH] we can't use the localized pretty name for "Local Folders" for the the hostname of the "Local Folders" server, or for the name of the directory on disk. if we did, as soon as someone localized "Local Folders" migration would break. while I'm here, only hard code these strings once. to allow people to build without mailnews, hard code them in nsIPrefMigration.idl r=alecf git-svn-id: svn://10.0.0.236/trunk@71330 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/mailnews/base/src/nsMessengerMigrator.cpp | 11 +++-------- .../profile/pref-migrator/public/nsIPrefMigration.idl | 6 ++++++ mozilla/profile/pref-migrator/src/nsPrefMigration.cpp | 10 ---------- mozilla/profile/src/nsProfile.cpp | 6 +++--- mozilla/xpfe/appshell/src/nsFileLocations.cpp | 7 ++++--- 5 files changed, 16 insertions(+), 24 deletions(-) diff --git a/mozilla/mailnews/base/src/nsMessengerMigrator.cpp b/mozilla/mailnews/base/src/nsMessengerMigrator.cpp index e86fc274c13..027684249ef 100644 --- a/mozilla/mailnews/base/src/nsMessengerMigrator.cpp +++ b/mozilla/mailnews/base/src/nsMessengerMigrator.cpp @@ -71,6 +71,8 @@ #include "nsIMsgFilterService.h" #include "nsIMsgFilterList.h" +#include "nsIPrefMigration.h" // for NEW_LOCAL_MAIL_DIR_NAME + #define BUF_STR_LEN 1024 #if defined(DEBUG_sspitzer) || defined(DEBUG_seth) @@ -112,9 +114,6 @@ static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); #ifdef HAVE_MOVEMAIL #define MOVEMAIL_FAKE_HOST_NAME "movemail" #endif /* HAVE_MOVEMAIL */ -#define NEW_MAIL_DIR_NAME "Mail" -#define NEW_NEWS_DIR_NAME "News" -#define NEW_IMAPMAIL_DIR_NAME "ImapMail" #define DEFAULT_4X_DRAFTS_FOLDER_NAME "Drafts" #define DEFAULT_4X_SENT_FOLDER_NAME "Sent" #define DEFAULT_4X_TEMPLATES_FOLDER_NAME "Templates" @@ -419,11 +418,7 @@ nsMessengerMigrator::initializeStrings() // convert to unicode and ASCII mLocalFoldersName.Assign(localFolders); - // should we use utf8 here? or maybe the system charset? - // or if we switch to nsIFile, it won't matter? - // this string is only visible to the user when creating the root - // folder on disk - mLocalFoldersHostname.AssignWithConversion(localFolders); + mLocalFoldersHostname = NEW_LOCAL_MAIL_DIR_NAME; return NS_OK; } diff --git a/mozilla/profile/pref-migrator/public/nsIPrefMigration.idl b/mozilla/profile/pref-migrator/public/nsIPrefMigration.idl index fd47eb691be..8bc9933670e 100644 --- a/mozilla/profile/pref-migrator/public/nsIPrefMigration.idl +++ b/mozilla/profile/pref-migrator/public/nsIPrefMigration.idl @@ -30,6 +30,12 @@ interface nsIWebShellWindow; #define NS_PREFCONVERTER_PROGID "component://netscape/migration/pref-converter" #define NS_ERROR_NOT_ENOUGH_SPACE_TO_MIGRATE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_MAILNEWS, 1) +/* these are hard coded, in ascii, as they will be used for directory folder names on disk. NEW_LOCAL_MAIL_DIR_NAME is also used as the host name for the local folders account */ +#define NEW_MAIL_DIR_NAME "Mail" +#define NEW_NEWS_DIR_NAME "News" +#define NEW_IMAPMAIL_DIR_NAME "ImapMail" +#define NEW_LOCAL_MAIL_DIR_NAME "Local Folders" + %} [scriptable, uuid(85c86e4c-6a6c-11d3-9a55-004005263078)] diff --git a/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp b/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp index 4669094973c..e8f9c83539e 100644 --- a/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp +++ b/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp @@ -155,16 +155,6 @@ #define NEW_DIR_SUFFIX "5" -/* sspitzer: - * TODO: these should come from the messenger back end, which gets them - * from a string bundle somewhere - */ -/* these are the same for all platforms */ -#define NEW_MAIL_DIR_NAME "Mail" -#define NEW_NEWS_DIR_NAME "News" -#define NEW_IMAPMAIL_DIR_NAME "ImapMail" -#define NEW_LOCAL_MAIL_DIR_NAME "Local Folders" - /* who's going to win the file name battle? */ #if defined(XP_UNIX) #define PREF_FILE_NAME_IN_4x "preferences.js" diff --git a/mozilla/profile/src/nsProfile.cpp b/mozilla/profile/src/nsProfile.cpp index 1082f37760e..0784757e286 100644 --- a/mozilla/profile/src/nsProfile.cpp +++ b/mozilla/profile/src/nsProfile.cpp @@ -953,19 +953,19 @@ nsresult nsProfile::CreateUserDirectories(const nsFileSpec& profileDir) nsFileSpec tmpDir; tmpDir = profileDir; - tmpDir += "News"; + tmpDir += NEW_NEWS_DIR_NAME; if (!tmpDir.Exists()) tmpDir.CreateDirectory(); tmpDir = profileDir; - tmpDir += "ImapMail"; + tmpDir += NEW_IMAPMAIL_DIR_NAME; if (!tmpDir.Exists()) tmpDir.CreateDirectory(); tmpDir = profileDir; - tmpDir += "Mail"; + tmpDir += NEW_MAIL_DIR_NAME; if (!tmpDir.Exists()) tmpDir.CreateDirectory(); diff --git a/mozilla/xpfe/appshell/src/nsFileLocations.cpp b/mozilla/xpfe/appshell/src/nsFileLocations.cpp index 5fc14ce4b29..fa57b398f0b 100644 --- a/mozilla/xpfe/appshell/src/nsFileLocations.cpp +++ b/mozilla/xpfe/appshell/src/nsFileLocations.cpp @@ -50,6 +50,7 @@ #endif #include "nsIProfile.h" +#include "nsIPrefMigration.h" // for NEW_IMAPMAIL_DIR_NAME, etc #include "plstr.h" #include "prenv.h" @@ -566,21 +567,21 @@ void nsSpecialFileSpec::operator = (Type aType) case App_MailDirectory50: { *this = nsSpecialFileSpec(App_UserProfileDirectory50); - *this += "Mail"; + *this += NEW_MAIL_DIR_NAME; break; } break; case App_ImapMailDirectory50: { *this = nsSpecialFileSpec(App_UserProfileDirectory50); - *this += "ImapMail"; + *this += NEW_IMAPMAIL_DIR_NAME; break; } break; case App_NewsDirectory50: { *this = nsSpecialFileSpec(App_UserProfileDirectory50); - *this += "News"; + *this += NEW_NEWS_DIR_NAME; break; } break;