From 41337e7380d76ae51597f598ff7c6e8c9d15d014 Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Tue, 5 Oct 1999 04:12:58 +0000 Subject: [PATCH] a bunch of changes, all reviewed by mscott. fix some bugs with next, back, and cancel in the profile manager. (#15223, #15271) re-write all callers of nsProfile::GetCurrentProfileDir() to use the file locator. (#15063) more profile code clean up. (#15042) rename the old 4.x history.dat file. it's called history.dat in 5.0, but the file formats are different. (binary in 4.x, vs mork in 5.0) git-svn-id: svn://10.0.0.236/trunk@49797 18797224-902f-48f8-a5cc-f745e15eee43 --- .../mailnews/base/src/nsMsgAccountManager.cpp | 128 +++------- .../mailnews/base/src/nsMsgMailSession.cpp | 29 +-- mozilla/mailnews/imap/src/nsImapService.cpp | 18 +- mozilla/mailnews/local/src/nsPop3Service.cpp | 20 +- .../news/src/nsNntpIncomingServer.cpp | 18 +- mozilla/mailnews/news/src/nsNntpService.cpp | 17 +- .../pref-migrator/src/nsPrefMigration.cpp | 26 +- mozilla/profile/public/Makefile.in | 4 - mozilla/profile/public/makefile.win | 3 +- mozilla/profile/public/nsIProfile.idl | 3 - .../resources/content/createProfileWizard.js | 40 ++-- .../resources/content/createProfileWizard.xul | 2 +- .../resources/content/profileManager.js | 3 +- mozilla/profile/src/nsProfile.cpp | 30 ++- mozilla/rdf/datasource/src/nsLocalStore.cpp | 37 +-- .../xpfe/appshell/public/nsFileLocations.h | 7 +- mozilla/xpfe/appshell/src/nsFileLocations.cpp | 56 ++++- mozilla/xpfe/bootstrap/nsAppRunner.cpp | 30 +-- .../bookmarks/resources/bookmarks.html | 225 +++++++++--------- .../bookmarks/src/nsBookmarksService.cpp | 39 ++- .../history/src/nsGlobalHistory.cpp | 25 +- 21 files changed, 362 insertions(+), 398 deletions(-) diff --git a/mozilla/mailnews/base/src/nsMsgAccountManager.cpp b/mozilla/mailnews/base/src/nsMsgAccountManager.cpp index b47c36f4c9c..89dd4fac435 100644 --- a/mozilla/mailnews/base/src/nsMsgAccountManager.cpp +++ b/mozilla/mailnews/base/src/nsMsgAccountManager.cpp @@ -33,6 +33,8 @@ #include "nsIMsgBiffManager.h" #include "nscore.h" #include "nsIProfile.h" +#include "nsIFileLocator.h" +#include "nsFileLocations.h" #include "nsCRT.h" // for nsCRT::strtok #include "prprf.h" #include "nsINetSupportDialogService.h" @@ -68,9 +70,10 @@ static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); static NS_DEFINE_CID(kMsgBiffManagerCID, NS_MSGBIFFMANAGER_CID); static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID); static NS_DEFINE_CID(kCNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); -static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); static NS_DEFINE_CID(kStandardUrlCID, NS_STANDARDURL_CID); static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID); +static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); +static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID); #define IMAP_SCHEMA "imap:/" #define IMAP_SCHEMA_LENGTH 6 @@ -1721,25 +1724,11 @@ nsMsgAccountManager::CreateLocalMailAccount(nsIMsgIdentity *identity) } if (NS_FAILED(rv)) { - nsFileSpec profileDir; - - NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv); + // we want /Mail + NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); if (NS_FAILED(rv)) return rv; - - rv = profile->GetCurrentProfileDir(&profileDir); - if (NS_FAILED(rv)) return rv; - - dir = profileDir; - // we want /Mail, not - dir += NEW_MAIL_DIR_NAME; - - // create /Mail if it doesn't exist - if (!dir.Exists()) { - dir.CreateDir(); - } - - rv = NS_NewFileSpecWithSpec(dir, getter_AddRefs(mailDir)); + rv = locator->GetFileLocation(nsSpecialFileSpec::App_MailDirectory50, getter_AddRefs(mailDir)); if (NS_FAILED(rv)) return rv; } @@ -1831,25 +1820,11 @@ nsMsgAccountManager::MigrateLocalMailAccount(nsIMsgIdentity *identity) // if they used -installer, this pref will point to where their files got copied rv = m_prefs->GetFilePref(PREF_MAIL_DIRECTORY, getter_AddRefs(mailDir)); if (NS_FAILED(rv)) { - nsFileSpec profileDir; - - NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv); + // we want /Mail + NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); if (NS_FAILED(rv)) return rv; - - rv = profile->GetCurrentProfileDir(&profileDir); - if (NS_FAILED(rv)) return rv; - - dir = profileDir; - // we want /Mail, not - dir += NEW_MAIL_DIR_NAME; - - // create /Mail if it doesn't exist - if (!dir.Exists()) { - dir.CreateDir(); - } - - rv = NS_NewFileSpecWithSpec(dir, getter_AddRefs(mailDir)); + rv = locator->GetFileLocation(nsSpecialFileSpec::App_MailDirectory50, getter_AddRefs(mailDir)); if (NS_FAILED(rv)) return rv; } @@ -1938,25 +1913,11 @@ nsMsgAccountManager::MigratePopAccount(nsIMsgIdentity *identity) // // if the "mail.directory" pref is set, use that. if (NS_FAILED(rv)) { - nsFileSpec profileDir; - - NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv); - if (NS_FAILED(rv)) return rv; - - rv = profile->GetCurrentProfileDir(&profileDir); + // we wan't /Mail + NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); if (NS_FAILED(rv)) return rv; - dir = profileDir; - - // we wan't /Mail, not - dir += NEW_MAIL_DIR_NAME; - - // create /Mail if it doesn't exist - if (!dir.Exists()) { - dir.CreateDir(); - } - - rv = NS_NewFileSpecWithSpec(dir, getter_AddRefs(mailDir)); + rv = locator->GetFileLocation(nsSpecialFileSpec::App_MailDirectory50, getter_AddRefs(mailDir)); if (NS_FAILED(rv)) return rv; } @@ -2096,14 +2057,7 @@ nsMsgAccountManager::MigrateImapAccount(nsIMsgIdentity *identity, const char *ho account->AddIdentity(copied_identity); // now upgrade all the prefs - nsFileSpec profileDir; - - NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv); - if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - - rv = profile->GetCurrentProfileDir(&profileDir); - if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - + rv = MigrateOldImapPrefs(server, hostname); if (NS_FAILED(rv)) return rv; @@ -2115,15 +2069,11 @@ nsMsgAccountManager::MigrateImapAccount(nsIMsgIdentity *identity, const char *ho rv = m_prefs->GetFilePref(PREF_IMAP_DIRECTORY, getter_AddRefs(imapMailDir)); // if the "mail.imap.root_dir" pref is set, use that. if (NS_FAILED(rv)) { - dir = profileDir; - - // we want /ImapMail, not - dir += NEW_IMAPMAIL_DIR_NAME; - if (!dir.Exists()) { - dir.CreateDir(); - } + // we want /ImapMail + NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); + if (NS_FAILED(rv)) return rv; - rv = NS_NewFileSpecWithSpec(dir, getter_AddRefs(imapMailDir)); + rv = locator->GetFileLocation(nsSpecialFileSpec::App_ImapMailDirectory50, getter_AddRefs(imapMailDir)); if (NS_FAILED(rv)) return rv; } @@ -2195,12 +2145,10 @@ nsMsgAccountManager::MigrateOldImapPrefs(nsIMsgIncomingServer *server, const cha nsresult nsMsgAccountManager::MigrateNewsAccounts(nsIMsgIdentity *identity) { - nsresult rv; - nsCOMPtr news_dir; + nsresult rv; + nsCOMPtr newsDir; nsFileSpec newsrcDir; // the directory that holds the newsrc files (and the fat file, if we are using one) nsFileSpec newsHostsDir; // the directory that holds the host directory, and the summary files. - nsFileSpec profileDir; - // the host directories will be under /News or // <"news.directory" pref>/News. // @@ -2213,29 +2161,25 @@ nsMsgAccountManager::MigrateNewsAccounts(nsIMsgIdentity *identity) // the newsrc files lived. we don't want that for the newsHostsDir. #ifdef USE_NEWSRC_MAP_FILE // if they used -installer, this pref will point to where their files got copied - rv = m_prefs->GetFilePref(PREF_NEWS_DIRECTORY, getter_AddRefs(news_dir)); + rv = m_prefs->GetFilePref(PREF_NEWS_DIRECTORY, getter_AddRefs(newsDir)); if (NS_SUCCEEDED(rv)) { - rv = news_dir->GetFileSpec(&newsHostsDir); + rv = newsDir->GetFileSpec(&newsHostsDir); } #else rv = NS_ERROR_FAILURE; #endif /* USE_NEWSRC_MAP_FILE */ if (NS_FAILED(rv)) { - NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv); - if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - - rv = profile->GetCurrentProfileDir(&profileDir); - if (NS_FAILED(rv)) return NS_ERROR_FAILURE; - - newsHostsDir = profileDir; - - // we want /News, not - newsHostsDir += NEW_NEWS_DIR_NAME; - - // create /News if it doesn't exist - if (!newsHostsDir.Exists()) { - newsHostsDir.CreateDir(); - } + NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); + if (NS_FAILED(rv)) return rv; + + rv = locator->GetFileLocation(nsSpecialFileSpec::App_NewsDirectory50, getter_AddRefs(newsDir)); + if (NS_FAILED(rv)) return rv; + } + + PRBool dirExists; + rv = newsDir->Exists(&dirExists); + if (!dirExists) { + newsDir->CreateDir(); } #ifdef USE_NEWSRC_MAP_FILE @@ -2347,16 +2291,16 @@ nsMsgAccountManager::MigrateNewsAccounts(nsIMsgIdentity *identity) inputStream.close(); #else /* USE_NEWSRC_MAP_FILE */ - rv = m_prefs->GetFilePref(PREF_PREMIGRATION_NEWS_DIRECTORY, getter_AddRefs(news_dir)); + rv = m_prefs->GetFilePref(PREF_PREMIGRATION_NEWS_DIRECTORY, getter_AddRefs(newsDir)); if (NS_FAILED(rv)) { #ifdef DEBUG_ACCOUNTMANAGER printf("%s was not set, attempting to use %s instead.\n",PREF_PREMIGRATION_NEWS_DIRECTORY,PREF_NEWS_DIRECTORY); #endif - rv = m_prefs->GetFilePref(PREF_NEWS_DIRECTORY, getter_AddRefs(news_dir)); + rv = m_prefs->GetFilePref(PREF_NEWS_DIRECTORY, getter_AddRefs(newsDir)); } if (NS_SUCCEEDED(rv)) { - rv = news_dir->GetFileSpec(&newsrcDir); + rv = newsDir->GetFileSpec(&newsrcDir); if (NS_FAILED(rv)) return rv; } else { diff --git a/mozilla/mailnews/base/src/nsMsgMailSession.cpp b/mozilla/mailnews/base/src/nsMsgMailSession.cpp index 5fbb25c5fcd..2f533d75193 100644 --- a/mozilla/mailnews/base/src/nsMsgMailSession.cpp +++ b/mozilla/mailnews/base/src/nsMsgMailSession.cpp @@ -25,14 +25,17 @@ #include "nsMsgBaseCID.h" #include "nsCOMPtr.h" #include "nsMsgFolderCache.h" -#include "nsIProfile.h" +#include "nsIFileLocator.h" +#include "nsFileLocations.h" #include "nsIMsgStatusFeedback.h" NS_IMPL_ISUPPORTS(nsMsgMailSession, nsCOMTypeInfo::GetIID()); static NS_DEFINE_CID(kMsgAccountManagerCID, NS_MSGACCOUNTMANAGER_CID); static NS_DEFINE_CID(kMsgFolderCacheCID, NS_MSGFOLDERCACHE_CID); -static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID); +static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID); +static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); + //static NS_DEFINE_CID(kMsgIdentityCID, NS_MSGIDENTITY_CID); //static NS_DEFINE_CID(kPop3IncomingServerCID, NS_POP3INCOMINGSERVER_CID); //static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); @@ -144,26 +147,14 @@ nsresult nsMsgMailSession::GetFolderCache(nsIMsgFolderCache* *aFolderCache) if (NS_FAILED(rv)) return rv; - nsFileSpec profileDir; nsCOMPtr cacheFile; - - NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv); - if (NS_FAILED(rv)) - return 0; + NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); + if (NS_FAILED(rv)) return rv; - rv = profile->GetCurrentProfileDir(&profileDir); - if (NS_FAILED(rv)) - return 0; + rv = locator->GetFileLocation(nsSpecialFileSpec::App_MessengerFolderCache50, getter_AddRefs(cacheFile)); + if (NS_FAILED(rv)) return rv; - nsFileSpec folderCache(profileDir); - - folderCache += "panacea.dat"; - - rv = NS_NewFileSpecWithSpec(folderCache, getter_AddRefs(cacheFile)); - if (NS_FAILED(rv)) - return rv; - - m_msgFolderCache->Init(cacheFile); + m_msgFolderCache->Init(cacheFile); } diff --git a/mozilla/mailnews/imap/src/nsImapService.cpp b/mozilla/mailnews/imap/src/nsImapService.cpp index b47dd42b1d0..6df46defbeb 100644 --- a/mozilla/mailnews/imap/src/nsImapService.cpp +++ b/mozilla/mailnews/imap/src/nsImapService.cpp @@ -39,15 +39,18 @@ #include "nsIMsgStatusFeedback.h" #include "nsIPref.h" -#include "nsIProfile.h" + +#include "nsIFileLocator.h" +#include "nsFileLocations.h" #define PREF_MAIL_ROOT_IMAP "mail.root.imap" static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); - static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); static NS_DEFINE_CID(kImapUrlCID, NS_IMAPURL_CID); +static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID); +static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); static const char *sequenceString = "SEQUENCE"; static const char *uidString = "UID"; @@ -2116,17 +2119,10 @@ nsImapService::GetDefaultLocalPath(nsIFileSpec ** aResult) rv = prefs->GetFilePref(PREF_MAIL_ROOT_IMAP, aResult); if (NS_SUCCEEDED(rv)) return rv; - NS_WITH_SERVICE(nsIProfile, profile, NS_PROFILE_PROGID, &rv); + NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); if (NS_FAILED(rv)) return rv; - nsFileSpec dir; - rv = profile->GetCurrentProfileDir(&dir); - if (NS_FAILED(rv)) return rv; - - // we want /ImapMail not - dir += "ImapMail"; - - rv = NS_NewFileSpecWithSpec(dir, aResult); + rv = locator->GetFileLocation(nsSpecialFileSpec::App_ImapMailDirectory50, aResult); if (NS_FAILED(rv)) return rv; rv = SetDefaultLocalPath(*aResult); diff --git a/mozilla/mailnews/local/src/nsPop3Service.cpp b/mozilla/mailnews/local/src/nsPop3Service.cpp index 8006e0c62a1..8e110cba802 100644 --- a/mozilla/mailnews/local/src/nsPop3Service.cpp +++ b/mozilla/mailnews/local/src/nsPop3Service.cpp @@ -23,7 +23,6 @@ #include "nsIPop3IncomingServer.h" #include "nsIMsgMailSession.h" -#include "nsIProfile.h" #include "nsIPref.h" #include "nsPop3URL.h" @@ -34,15 +33,19 @@ #include "nsXPIDLString.h" #include "nsCOMPtr.h" +#include "nsIFileLocator.h" +#include "nsFileLocations.h" + #define POP3_PORT 110 // The IANA port for Pop3 #define PREF_MAIL_ROOT_POP3 "mail.root.pop3" #define PREF_MAIL_ROOT_NONE "mail.root.none" static NS_DEFINE_CID(kPrefCID, NS_PREF_CID); -static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID); static NS_DEFINE_CID(kPop3UrlCID, NS_POP3URL_CID); static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID); +static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID); +static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); nsPop3Service::nsPop3Service() { @@ -305,20 +308,13 @@ nsPop3Service::GetDefaultLocalPath(nsIFileSpec ** aResult) rv = prefs->GetFilePref(PREF_MAIL_ROOT_POP3, aResult); if (NS_SUCCEEDED(rv)) return rv; - NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv); + NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); if (NS_FAILED(rv)) return rv; - nsFileSpec dir; - rv = profile->GetCurrentProfileDir(&dir); - if (NS_FAILED(rv)) return rv; - - // we want /Mail, not - dir += "Mail"; - - rv = SetDefaultLocalPath(*aResult); + rv = locator->GetFileLocation(nsSpecialFileSpec::App_MailDirectory50, aResult); if (NS_FAILED(rv)) return rv; - rv = NS_NewFileSpecWithSpec(dir, aResult); + rv = SetDefaultLocalPath(*aResult); return rv; } diff --git a/mozilla/mailnews/news/src/nsNntpIncomingServer.cpp b/mozilla/mailnews/news/src/nsNntpIncomingServer.cpp index 19723e6203a..1fbb6e89906 100644 --- a/mozilla/mailnews/news/src/nsNntpIncomingServer.cpp +++ b/mozilla/mailnews/news/src/nsNntpIncomingServer.cpp @@ -19,8 +19,9 @@ #include "nsNntpIncomingServer.h" #include "nsXPIDLString.h" #include "nsIPref.h" -#include "nsIProfile.h" #include "prenv.h" +#include "nsIFileLocator.h" +#include "nsFileLocations.h" #ifdef DEBUG_seth #define DO_HASHING_OF_HOSTNAME 1 @@ -40,6 +41,8 @@ #endif /* XP_UNIX || XP_BEOS */ static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); +static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID); +static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); NS_IMPL_ISUPPORTS_INHERITED(nsNntpIncomingServer, nsMsgIncomingServer, @@ -151,7 +154,6 @@ NS_IMETHODIMP nsNntpIncomingServer::GetNewsrcRootPath(nsIFileSpec **aNewsrcRootPath) { nsresult rv; - nsFileSpec dir; NS_WITH_SERVICE(nsIPref, prefs, kPrefServiceCID, &rv); if (NS_FAILED(rv)) return rv; @@ -159,25 +161,23 @@ nsNntpIncomingServer::GetNewsrcRootPath(nsIFileSpec **aNewsrcRootPath) rv = prefs->GetFilePref(PREF_MAIL_NEWSRC_ROOT, aNewsrcRootPath); if (NS_SUCCEEDED(rv)) return rv; #ifdef XP_UNIX + nsFileSpec dir; // root the newsrc files to /News, except on UNIX // on UNIX, set it to ~. // this may change soon, and on UNIX, the default will also be /News char *unixHomeDirectory = PR_GetEnv("HOME"); dir = unixHomeDirectory; + rv = NS_NewFileSpecWithSpec(dir, aNewsrcRootPath); + if (NS_FAILED(rv)) return rv; #else - NS_WITH_SERVICE(nsIProfile, profile, NS_PROFILE_PROGID, &rv); + NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); if (NS_FAILED(rv)) return rv; - rv = profile->GetCurrentProfileDir(&dir); + rv = locator->GetFileLocation(nsSpecialFileSpec::App_NewsDirectory50, aNewsrcRootPath); if (NS_FAILED(rv)) return rv; - - dir += NEW_NEWS_DIR_NAME; #endif /* XP_UNIX */ rv = SetNewsrcRootPath(*aNewsrcRootPath); - if (NS_FAILED(rv)) return rv; - - rv = NS_NewFileSpecWithSpec(dir, aNewsrcRootPath); return rv; } diff --git a/mozilla/mailnews/news/src/nsNntpService.cpp b/mozilla/mailnews/news/src/nsNntpService.cpp index e02cd8d98b5..430463f03ea 100644 --- a/mozilla/mailnews/news/src/nsNntpService.cpp +++ b/mozilla/mailnews/news/src/nsNntpService.cpp @@ -34,13 +34,13 @@ #include "nsIMessage.h" #include "nsINetSupportDialogService.h" #include "nsIPref.h" -#include "nsIProfile.h" #include "nsCRT.h" // for nsCRT::strtok #include "nsNntpService.h" #include "nsIChannel.h" #include "nsILoadGroup.h" - #include "nsCOMPtr.h" +#include "nsIFileLocator.h" +#include "nsFileLocations.h" #undef GetPort // XXX Windows! #undef SetPort // XXX Windows! @@ -54,6 +54,8 @@ static NS_DEFINE_CID(kCNNTPNewsgroupCID, NS_NNTPNEWSGROUP_CID); static NS_DEFINE_CID(kCNNTPNewsgroupPostCID, NS_NNTPNEWSGROUPPOST_CID); static NS_DEFINE_CID(kCNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_CID(kCPrefServiceCID, NS_PREF_CID); +static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID); +static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); nsNntpService::nsNntpService() { @@ -958,17 +960,10 @@ nsNntpService::GetDefaultLocalPath(nsIFileSpec ** aResult) rv = prefs->GetFilePref(PREF_MAIL_ROOT_NNTP, aResult); if (NS_SUCCEEDED(rv)) return rv; - NS_WITH_SERVICE(nsIProfile, profile, NS_PROFILE_PROGID, &rv); + NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); if (NS_FAILED(rv)) return rv; - nsFileSpec dir; - rv = profile->GetCurrentProfileDir(&dir); - if (NS_FAILED(rv)) return rv; - - // we want /News, not - dir += "News"; - - rv = NS_NewFileSpecWithSpec(dir, aResult); + rv = locator->GetFileLocation(nsSpecialFileSpec::App_NewsDirectory50, aResult); if (NS_FAILED(rv)) return rv; rv = SetDefaultLocalPath(*aResult); diff --git a/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp b/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp index e101b2b33b3..aa17ddaf368 100644 --- a/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp +++ b/mozilla/profile/pref-migrator/src/nsPrefMigration.cpp @@ -38,6 +38,8 @@ #include "plstr.h" #include "prprf.h" #include "nsXPIDLString.h" +#include "nsIFileLocator.h" +#include "nsFileLocations.h" #include "nsProxiedService.h" @@ -51,8 +53,6 @@ #include "nsPrefMigrationFactory.h" //#include "nsPMProgressDlg.h" -#define NEW_DIR_PERMISSIONS 00700 - #define PREF_FILE_HEADER_STRING "# Mozilla User Preferences " #if defined(XP_UNIX) @@ -61,18 +61,21 @@ #define SUMMARY_SUFFIX_IN_4x ".summary" #define COOKIES_FILE_NAME_IN_4x "cookies" #define BOOKMARKS_FILE_NAME_IN_4x "bookmarks.html" +#define HISTORY_FILE_NAME_IN_4x "history.dat" #elif defined(XP_MAC) #define IMAP_MAIL_FILTER_FILE_NAME_IN_4x " Rules" #define POP_MAIL_FILTER_FILE_NAME_IN_4x "Filter Rules" #define SUMMARY_SUFFIX_IN_4x ".snm" #define COOKIES_FILE_NAME_IN_4x "MagicCookie" #define BOOKMARKS_FILE_NAME_IN_4x "Bookmarks.html" +#define HISTORY_FILE_NAME_IN_4x "Netscape History" #else /* XP_PC */ #define IMAP_MAIL_FILTER_FILE_NAME_IN_4x "rules.dat" #define POP_MAIL_FILTER_FILE_NAME_IN_4x "rules.dat" #define SUMMARY_SUFFIX_IN_4x ".snm" #define COOKIES_FILE_NAME_IN_4x "cookies.txt" #define BOOKMARKS_FILE_NAME_IN_4x "bookmarks.htm" +#define HISTORY_FILE_NAME_IN_4x "history.dat" #endif /* XP_UNIX */ #define SUMMARY_SUFFIX_IN_5x ".msf" @@ -80,6 +83,8 @@ #define IMAP_MAIL_FILTER_FILE_NAME_IN_5x "rules.dat" #define POP_MAIL_FILTER_FILE_NAME_IN_5x "rules.dat" #define BOOKMARKS_FILE_NAME_IN_5x "bookmarks.html" +#define HISTORY_FILE_NAME_IN_5x "history.dat" +#define RENAMED_OLD_HISTORY_FILE_NAME "old "HISTORY_FILE_NAME_IN_4x #define PREMIGRATION_PREFIX "premigration" #define PREF_MAIL_DIRECTORY "mail.directory" @@ -149,7 +154,8 @@ typedef struct static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID ); - +static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID); +static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID); static NS_DEFINE_IID(kIPrefMigrationIID, NS_IPREFMIGRATION_IID); static NS_DEFINE_IID(kPrefMigrationCID, NS_PREFMIGRATION_CID); @@ -159,8 +165,7 @@ static NS_DEFINE_CID(kNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID); static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID); static NS_DEFINE_CID(kCommonDialogsCID, NS_CommonDialog_CID); static NS_DEFINE_CID(kDialogParamBlockCID, NS_DialogParamBlock_CID); - -static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID); +static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); static PRInt32 gInstanceCnt = 0; static PRInt32 gLockCnt = 0; @@ -1254,6 +1259,17 @@ nsPrefMigration::DoSpecialUpdates(nsIFileSpec * profilePath) } #endif /* IMAP_MAIL_FILTER_FILE_NAME_FORMAT_IN_4x */ + // TODO remove any 4.x files that should not be left around + // + // examples: prefs, history + rv = profilePath->AppendRelativeUnixPath(HISTORY_FILE_NAME_IN_5x); + PRBool fileExists; + rv = profilePath->Exists(&fileExists); + if (NS_FAILED(rv)) return rv; + if (fileExists) { + profilePath->Rename(RENAMED_OLD_HISTORY_FILE_NAME); + } + return rv; } diff --git a/mozilla/profile/public/Makefile.in b/mozilla/profile/public/Makefile.in index 2e24b7336a3..00421d7f508 100644 --- a/mozilla/profile/public/Makefile.in +++ b/mozilla/profile/public/Makefile.in @@ -24,11 +24,7 @@ include $(DEPTH)/config/autoconf.mk MODULE = profile -EXPORTS = profileSwitch.h - XPIDLSRCS = nsIProfile.idl -EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) - include $(topsrcdir)/config/rules.mk diff --git a/mozilla/profile/public/makefile.win b/mozilla/profile/public/makefile.win index b02ed274eab..f4ded7817b7 100644 --- a/mozilla/profile/public/makefile.win +++ b/mozilla/profile/public/makefile.win @@ -20,8 +20,7 @@ MODULE=profile DEPTH=..\.. -EXPORTS= profileSwitch.h \ - nsIAccount.h \ +EXPORTS=nsIAccount.h \ dialshr.h \ resource.h \ $(NULL) diff --git a/mozilla/profile/public/nsIProfile.idl b/mozilla/profile/public/nsIProfile.idl index a2b3488a8ec..961c4329770 100644 --- a/mozilla/profile/public/nsIProfile.idl +++ b/mozilla/profile/public/nsIProfile.idl @@ -36,8 +36,6 @@ interface nsIFileSpec; #define NS_PROFILE_PROGID \ "component://netscape/profile/manager" -#define NS_USING_PROFILES 1 - #define PREG_PREF "netcenter.register" %} @@ -47,7 +45,6 @@ interface nsIFileSpec; interface nsIProfile : nsISupports { [noscript] void startupWithArgs(in nsICmdLineService cmdLine); void startup(in string filename); - void shutdown(); [noscript] void getProfileDir(in string profileName, in nsFileSpec profileDir); diff --git a/mozilla/profile/resources/content/createProfileWizard.js b/mozilla/profile/resources/content/createProfileWizard.js index 47110c32de7..0247e83018d 100644 --- a/mozilla/profile/resources/content/createProfileWizard.js +++ b/mozilla/profile/resources/content/createProfileWizard.js @@ -92,14 +92,10 @@ function onNext() return; } - //dump("***********onNext\n"); - - if (currentPageTag != "newProfile1_2") { - saveData(); - var nextPageTag = testMap[currentPageTag].next; - var url = getUrlFromTag(nextPageTag); - displayPage(url); - } + saveData(); + var nextPageTag = testMap[currentPageTag].next; + var url = getUrlFromTag(nextPageTag); + displayPage(url); } function onBack() @@ -108,12 +104,10 @@ function onBack() return; } - if (currentPageTag != "newProfile1_2") { - saveData(); - previousPageTag = testMap[currentPageTag].previous; - var url = grtUrlFromTag(previousPageTag); - displayPage(url); - } + saveData(); + previousPageTag = testMap[currentPageTag].previous; + var url = getUrlFromTag(previousPageTag); + displayPage(url); } function displayPage(content) @@ -128,10 +122,10 @@ function displayPage(content) { contentFrame.setAttribute("src", content); } - //hack for onLoadHandler problem bug #15458 - var tmpUrl = content.split("."); - var tag = tmpUrl[0]; - wizardPageLoaded(tag); + //hack for onLoadHandler problem bug #15458 + var tmpUrl = content.split(pagePostfix); + var tag = tmpUrl[0]; + wizardPageLoaded(tag); } } @@ -263,7 +257,13 @@ function ExitApp() appShell.Quit(); } -function cancelApp() +function onCancel() { - dump("fix this.\n"); + if (top.window.opener) { + // we came from the profile manager window... + window.close(); + } + else { + ExitApp() + } } diff --git a/mozilla/profile/resources/content/createProfileWizard.xul b/mozilla/profile/resources/content/createProfileWizard.xul index 955cc73554b..3e2169ea6a9 100644 --- a/mozilla/profile/resources/content/createProfileWizard.xul +++ b/mozilla/profile/resources/content/createProfileWizard.xul @@ -26,7 +26,7 @@ - + diff --git a/mozilla/profile/resources/content/profileManager.js b/mozilla/profile/resources/content/profileManager.js index f93d3e79e8f..486763377b4 100644 --- a/mozilla/profile/resources/content/profileManager.js +++ b/mozilla/profile/resources/content/profileManager.js @@ -7,8 +7,7 @@ profile = profile.QueryInterface(Components.interfaces.nsIProfile); function openCreateProfile() { // Need to call CreateNewProfile xuls - var win = window.openDialog('chrome://profile/content/createProfileWizard.xul', 'CPW', 'chrome'); - return win; + window.openDialog('chrome://profile/content/createProfileWizard.xul', 'CPW', 'chrome'); } function CreateProfile() diff --git a/mozilla/profile/src/nsProfile.cpp b/mozilla/profile/src/nsProfile.cpp index 02eee602579..b6f28c88081 100644 --- a/mozilla/profile/src/nsProfile.cpp +++ b/mozilla/profile/src/nsProfile.cpp @@ -214,7 +214,6 @@ nsProfile::nsProfile() nsProfile::~nsProfile() { - printf("nsProfile::~nsProfile()\n"); } /* @@ -280,11 +279,6 @@ nsProfile::OpenRegistry() return rv; } -NS_IMETHODIMP nsProfile::Shutdown() -{ - return NS_OK; -} - NS_IMETHODIMP nsProfile::StartupWithArgs(nsICmdLineService *cmdLineArgs) { @@ -302,17 +296,23 @@ nsProfile::StartupWithArgs(nsICmdLineService *cmdLineArgs) if (cmdLineArgs) rv = ProcessArgs(cmdLineArgs, &profileDirSet, profileURLStr); - if (!profileDirSet) + if (!profileDirSet) { rv = LoadDefaultProfileDir(profileURLStr); - + if (NS_FAILED(rv)) { + CloseRegistry(); + return rv; + } + } + // Closing the registry that was opened in Startup() rv = CloseRegistry(); + if (NS_FAILED(rv)) return rv; #ifdef DEBUG_profile printf("Profile Manager : Profile Wizard and Manager activites : End\n"); #endif - return rv; + return NS_OK; } @@ -381,15 +381,19 @@ nsProfile::LoadDefaultProfileDir(nsCString & profileURLStr) NS_SIZETOCONTENT, // height getter_AddRefs(profWindow)); - if (NS_FAILED(rv)) - { - return rv; - } + if (NS_FAILED(rv)) return rv; /* * Start up the main event loop... */ rv = profAppShell->Run(); + + char *currentProfileStr = nsnull; + rv = GetCurrentProfile(¤tProfileStr); + if (NS_FAILED(rv) || !currentProfileStr) { + return NS_ERROR_FAILURE; + } + PR_DELETE(currentProfileStr); } if (pregPref && PL_strcmp(isPregInfoSet, REGISTRY_TRUE_STRING) != 0) diff --git a/mozilla/rdf/datasource/src/nsLocalStore.cpp b/mozilla/rdf/datasource/src/nsLocalStore.cpp index d177c678e66..31545624c13 100644 --- a/mozilla/rdf/datasource/src/nsLocalStore.cpp +++ b/mozilla/rdf/datasource/src/nsLocalStore.cpp @@ -35,10 +35,13 @@ #include "nsXPIDLString.h" #include "plstr.h" #include "rdf.h" +#include "nsCOMPtr.h" -#include "nsIProfile.h" +#include "nsIFileLocator.h" +#include "nsFileLocations.h" -static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID); +static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID); +static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); //////////////////////////////////////////////////////////////////////// @@ -311,25 +314,23 @@ static NS_DEFINE_CID(kRDFXMLDataSourceCID, NS_RDFXMLDATASOURCE_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); nsresult rv; - - // Look for localstore.rdf in the current profile - // directory. Bomb if we can't find it. - NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv); - if (NS_FAILED(rv)) return rv; - nsFileSpec spec; - rv = profile->GetCurrentProfileDir(&spec); + nsCOMPtr localStoreSpec; + + // Look for localstore.rdf in the current profile + // directory. Bomb if we can't find it. + + NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); if (NS_FAILED(rv)) return rv; - // Make sure the profile directory _really exists_ before we try - // to create file in it. - if (! spec.Exists()) - return NS_ERROR_UNEXPECTED; + rv = locator->GetFileLocation(nsSpecialFileSpec::App_LocalStore50, getter_AddRefs(localStoreSpec)); + if (NS_FAILED(rv)) return rv; + + rv = localStoreSpec->GetFileSpec(&spec); + if (NS_FAILED(rv)) return rv; - spec += "localstore.rdf"; - - if (! spec.Exists()) - { + // XXX TODO: rewrite this to use the nsIFileSpec we already have. + if (! spec.Exists()) { { nsOutputFileStream os(spec); @@ -345,7 +346,7 @@ static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); // back a read-only directory. Whatever. if (! spec.Exists()) return NS_ERROR_UNEXPECTED; - } + } rv = nsComponentManager::CreateInstance(kRDFXMLDataSourceCID, nsnull, diff --git a/mozilla/xpfe/appshell/public/nsFileLocations.h b/mozilla/xpfe/appshell/public/nsFileLocations.h index 4a93557e072..435a00f58da 100644 --- a/mozilla/xpfe/appshell/public/nsFileLocations.h +++ b/mozilla/xpfe/appshell/public/nsFileLocations.h @@ -82,7 +82,12 @@ class NS_APPSHELL nsSpecialFileSpec : public nsFileSpec , App_Registry40 = App_FileBase + 20 , App_Registry50 = App_FileBase + 21 - + , App_LocalStore50 = App_FileBase + 30 + , App_History50 = App_FileBase + 40 + , App_MailDirectory50 = App_FileBase + 50 + , App_ImapMailDirectory50 = App_FileBase + 60 + , App_NewsDirectory50 = App_FileBase + 70 + , App_MessengerFolderCache50 = App_FileBase + 80 }; //nsSpecialFileSpec(); nsSpecialFileSpec(Type aType); diff --git a/mozilla/xpfe/appshell/src/nsFileLocations.cpp b/mozilla/xpfe/appshell/src/nsFileLocations.cpp index 244d0686a17..d7b1fadc941 100644 --- a/mozilla/xpfe/appshell/src/nsFileLocations.cpp +++ b/mozilla/xpfe/appshell/src/nsFileLocations.cpp @@ -77,7 +77,6 @@ static PRBool GetProfileDirectory(nsFileSpec& outSpec) // CreateDefaultProfileDirectorySpec() above. //---------------------------------------------------------------------------------------- { - //static nsFileSpec* gProfileDir = nsnull; // pointer so that we can detect whether it has been initialized if (!gProfileDir) { @@ -407,7 +406,11 @@ void nsSpecialFileSpec::operator = (Type aType) } #endif case App_BookmarksFile50: - NS_NOTYETIMPLEMENTED("Write me!"); + { + *this = nsSpecialFileSpec(App_UserProfileDirectory50); + *this += "bookmarks.html"; + break; + } break; case App_Registry40: @@ -430,6 +433,48 @@ void nsSpecialFileSpec::operator = (Type aType) NS_NOTYETIMPLEMENTED("Write me!"); break; + case App_LocalStore50: + { + *this = nsSpecialFileSpec(App_UserProfileDirectory50); + *this += "localstore.rdf"; + break; + } + break; + case App_History50: + { + *this = nsSpecialFileSpec(App_UserProfileDirectory50); + *this += "history.dat"; + break; + } + break; + case App_MailDirectory50: + { + *this = nsSpecialFileSpec(App_UserProfileDirectory50); + *this += "Mail"; + break; + } + break; + case App_ImapMailDirectory50: + { + *this = nsSpecialFileSpec(App_UserProfileDirectory50); + *this += "ImapMail"; + break; + } + break; + case App_NewsDirectory50: + { + *this = nsSpecialFileSpec(App_UserProfileDirectory50); + *this += "News"; + break; + } + break; + case App_MessengerFolderCache50: + { + *this = nsSpecialFileSpec(App_UserProfileDirectory50); + *this += "panacea.dat"; + break; + } + break; case App_DirectoryBase: case App_FileBase: default: @@ -510,9 +555,10 @@ NS_IMETHODIMP nsFileLocator::GetFileLocation( NS_IMETHODIMP nsFileLocator::ForgetProfileDir() //---------------------------------------------------------------------------------------- { - - delete gProfileDir; - gProfileDir = nsnull; + if (gProfileDir) { + delete gProfileDir; + gProfileDir = nsnull; + } return NS_OK; } diff --git a/mozilla/xpfe/bootstrap/nsAppRunner.cpp b/mozilla/xpfe/bootstrap/nsAppRunner.cpp index 6a17153a8e1..11fd72e1fc0 100644 --- a/mozilla/xpfe/bootstrap/nsAppRunner.cpp +++ b/mozilla/xpfe/bootstrap/nsAppRunner.cpp @@ -74,8 +74,6 @@ static NS_DEFINE_CID( kToolkitCoreCID, NS_TOOLKITCORE_CID ); // header file for profile manager #include "nsIProfile.h" -// Uncomment this line to skip the profile code compilation -//#include "profileSwitch.h" #if defined(XP_MAC) @@ -115,10 +113,7 @@ static NS_DEFINE_IID(kIWalletServiceIID, NS_IWALLETSERVICE_IID); static NS_DEFINE_CID(kCookieServiceCID, NS_COOKIESERVICE_CID); #endif // NECKO -// defined for profileManager -#if defined(NS_USING_PROFILES) static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID); -#endif // NS_USING_PROFILES /********************************************* AppCores @@ -537,15 +532,19 @@ static nsresult main1(int argc, char* argv[]) } rv = appShell->Initialize( cmdLineArgs ); - if ( NS_FAILED(rv) ) - return rv; + if ( NS_FAILED(rv) ) return rv; + #ifdef DEBUG printf("initialized appshell\n"); #endif NS_WITH_SERVICE(nsIProfile, profileMgr, kProfileCID, &rv); - if (NS_SUCCEEDED(rv)) - profileMgr->StartupWithArgs(cmdLineArgs); + if ( NS_FAILED(rv) ) return rv; + + rv = profileMgr->StartupWithArgs(cmdLineArgs); + if (NS_FAILED(rv)) { + return rv; + } if ( CheckAndRunPrefs(cmdLineArgs) ) return NS_OK; @@ -701,19 +700,6 @@ int main(int argc, char* argv[]) nsresult result = main1( argc, argv ); - { - // Scoping this in a block to force the profile service to be - // released. - - // this is supposed to happen automatically when XPCOM shuts down, but - // that doesn't always occur! - NS_WITH_SERVICE(nsIProfile, profileMgr, kProfileCID, &rv); - if (NS_SUCCEEDED(rv)) - profileMgr->Shutdown(); - // calling this explicitly will cut down on a large number of leaks we're - // seeing: - } - #ifdef DETECT_WEBSHELL_LEAKS if ( unsigned long count = NS_TotalWebShellsInExistence() ) { printf("XXX WARNING: Number of webshells being leaked: %d \n", count); diff --git a/mozilla/xpfe/components/bookmarks/resources/bookmarks.html b/mozilla/xpfe/components/bookmarks/resources/bookmarks.html index 062025374a8..06a57c86357 100644 --- a/mozilla/xpfe/components/bookmarks/resources/bookmarks.html +++ b/mozilla/xpfe/components/bookmarks/resources/bookmarks.html @@ -2,150 +2,151 @@ -Bookmarks for temp -

Bookmarks for temp

+ +Bookmarks +

Bookmarks

-

Sample FTP URLs

+

Sample FTP URLs

-

FTP: Netscape -
FTP: XPNav +
FTP: Netscape +
FTP: XPNav

-

Sample SmartFind queries

+

Sample SmartFind queries

-

Find: Bookmark Names containing 'Netscape' -
Find: Bookmark Names starting with 'A' -
Find: Bookmark Names ending with '.com' -
Find: Bookmark Names containing 'Mac' -
Find: Bookmark URLs containing 'mac' +
Find: Bookmark Names containing 'Netscape' +
Find: Bookmark Names starting with 'A' +
Find: Bookmark Names ending with '.com' +
Find: Bookmark Names containing 'Mac' +
Find: Bookmark URLs containing 'mac'

-

Personal Toolbar Folder

+

Personal Toolbar Folder

-

Mozilla.org -
Tinderbox -
Bonsai -
Bugzilla -

Channels

+
Mozilla.org +
Tinderbox +
Bonsai +
Bugzilla +

Channels

-

Autos -
Business -
Computing and Internet -
Education -
Entertainment -
Games -
Health -
Kids and Family -
Lifestyles -
Local -
Netscape -
News -
Personal Finance -
Real Estate -
Shopping -
Sports -
Travel +
Autos +
Business +
Computing and Internet +
Education +
Entertainment +
Games +
Health +
Kids and Family +
Lifestyles +
Local +
Netscape +
News +
Personal Finance +
Real Estate +
Shopping +
Sports +
Travel


-

Search

+

Search

-

Alta Vista -
Excite -
GoTo.com -
Infoseek -
LookSmart -
Lycos -
Netscape Search +
Alta Vista +
Excite +
GoTo.com +
Infoseek +
LookSmart +
Lycos +
Netscape Search

-

Business and Finance

+

Business and Finance

-

Career Center -
CBS.MarketWatch -
Datek Online -
dbusiness.com -
Gartner Group, Inc. -
NextCard Internet Visa -
Personal Finance -
Small Business Source -
Virtual Office by Netopia +
Career Center +
CBS.MarketWatch +
Datek Online +
dbusiness.com +
Gartner Group, Inc. +
NextCard Internet Visa +
Personal Finance +
Small Business Source +
Virtual Office by Netopia

-

Computers and Internet

+

Computers and Internet

-

@vantage -
Computing Channel -
Netscape Channel -
ONSALE Computer Auctions -
Open Studio -
Professional Connections -
SmartUpdate -
Toshiba +
@vantage +
Computing Channel +
Netscape Channel +
ONSALE Computer Auctions +
Open Studio +
Professional Connections +
SmartUpdate +
Toshiba

-

Directories

+

Directories

-

GTE SuperPages -
Member Directory -
Netcenter Yellow Pages -
People -
Thomas Register -
Web Directory -
YellowPages AtHand +
GTE SuperPages +
Member Directory +
Netcenter Yellow Pages +
People +
Thomas Register +
Web Directory +
YellowPages AtHand

-

Entertainment and Lifestyle

+

Entertainment and Lifestyle

-

Entertainment Channel -
Games -
Health -
Kids and Family -
Lifestyle Channel -
theglobe.com community -
TV Guide -
Women.com +
Entertainment Channel +
Games +
Health +
Kids and Family +
Lifestyle Channel +
theglobe.com community +
TV Guide +
Women.com

-

News and Sports

+

News and Sports

-

ABCNEWS.com -
Business Journal -
CBS SportsLine -
In-Box Direct -
News Channel -
Sports Channel +
ABCNEWS.com +
Business Journal +
CBS SportsLine +
In-Box Direct +
News Channel +
Sports Channel

-

Shopping and Classifieds

+

Shopping and Classifieds

-

Amazon.com -
Audio Book Club -
DealDeal.com Auctions -
FreeRide -
FTD Flowers -
Music Boulevard -
netMarket -
Real Estate -
Rent.Net -
Software Depot +
Amazon.com +
Audio Book Club +
DealDeal.com Auctions +
FreeRide +
FTD Flowers +
Music Boulevard +
netMarket +
Real Estate +
Rent.Net +
Software Depot

-

Travel and Leisure

+

Travel and Leisure

-

Leisure Planet -
Local -
Renaissance Cruises -
Travelocity +
Leisure Planet +
Local +
Renaissance Cruises +
Travelocity

-

Macintosh Resources

+

Macintosh Resources

-

Mac OS Rumors -
MacSurfer -
Macintouch -
MacWEEK -
O'Grady's Mac PowerPage +
Mac OS Rumors +
MacSurfer +
Macintouch +
MacWEEK +
O'Grady's Mac PowerPage

-

AAA URLs with no redirection

+

AAA URLs with no redirection

-

Netscape -
Yahoo -
AOL +
Netscape +
Yahoo +
AOL


-

Personal Bookmarks

+

Personal Bookmarks

diff --git a/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp b/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp index 277b606c57d..88dd3dc2707 100644 --- a/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp +++ b/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp @@ -72,7 +72,10 @@ #include "nsIChannel.h" #include "nsIHTTPChannel.h" #include "nsHTTPEnums.h" -static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); + +#include "nsIFileLocator.h" +#include "nsFileLocations.h" + #include "nsIInputStream.h" #include "nsIBufferInputStream.h" @@ -95,7 +98,9 @@ static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kRDFContainerCID, NS_RDFCONTAINER_CID); static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); +static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); +static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); +static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); //static NS_DEFINE_CID(kNSCOMMONDIALOGSCID, NS_CommonDialog_CID); //static NS_DEFINE_IID(kNSCOMMONDIALOGSIID, NS_ICOMMONDIALOGS_IID); @@ -107,7 +112,8 @@ static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID); static NS_DEFINE_IID(kIRDFLiteralIID, NS_IRDFLITERAL_IID); static NS_DEFINE_IID(kIRDFIntIID, NS_IRDFINT_IID); static NS_DEFINE_IID(kIRDFDateIID, NS_IRDFDATE_IID); -static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID); +static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); +static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID); static const char kURINC_BookmarksRoot[] = "NC:BookmarksRoot"; // XXX? static const char kURINC_IEFavoritesRoot[] = "NC:IEFavoritesRoot"; // XXX? @@ -3097,31 +3103,16 @@ nsBookmarksService::GetBookmarksFile(nsFileSpec* aResult) // still deal reasonably (in the short term) when no // bookmarks.html is installed in the profile directory. do { - NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv); + nsCOMPtr bookmarksFile; + + NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); if (NS_FAILED(rv)) break; - rv = profile->GetCurrentProfileDir(aResult); + rv = locator->GetFileLocation(nsSpecialFileSpec::App_BookmarksFile50, getter_AddRefs(bookmarksFile)); if (NS_FAILED(rv)) break; - *aResult += "bookmarks.html"; - - // Note: first try "bookmarks.html" and, if that doesn't exist, - // fallback to trying "bookmark.htm". Do this due to older - // versions of the browser where the name is different per - // platform. - if (! aResult->Exists()) - { - // XXX should we NS_RELEASE(*aResult) ??? - - rv = profile->GetCurrentProfileDir(aResult); - if (NS_FAILED(rv)) break; - *aResult += "bookmark.htm"; - - if (! aResult->Exists()) - { - rv = NS_ERROR_FAILURE; - } - } + rv = bookmarksFile->GetFileSpec(aResult); + if (NS_FAILED(rv)) break; } while (0); #ifdef DEBUG diff --git a/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp b/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp index 6d211a1f784..a4c37f72946 100644 --- a/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp +++ b/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp @@ -35,7 +35,6 @@ #include "nsIEnumerator.h" #include "nsIGenericFactory.h" #include "nsIGlobalHistory.h" -#include "nsIProfile.h" #include "nsIRDFDataSource.h" #include "nsIRDFService.h" #include "nsIServiceManager.h" @@ -61,6 +60,9 @@ #include "nsIBrowsingProfile.h" #endif +#include "nsIFileLocator.h" +#include "nsFileLocations.h" + //////////////////////////////////////////////////////////////////////// // Common CIDs @@ -68,7 +70,9 @@ static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); static NS_DEFINE_CID(kGenericFactoryCID, NS_GENERICFACTORY_CID); static NS_DEFINE_CID(kGlobalHistoryCID, NS_GLOBALHISTORY_CID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); -static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID); +static NS_DEFINE_CID(kFileLocatorCID, NS_FILELOCATOR_CID); + +static NS_DEFINE_IID(kIFileLocatorIID, NS_IFILELOCATOR_IID); #ifdef MOZ_BRPROF static NS_DEFINE_CID(kBrowsingProfileCID, NS_BROWSINGPROFILE_CID); @@ -1285,20 +1289,17 @@ nsGlobalHistory::OpenDB() { nsresult rv; - NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv); - if (NS_FAILED(rv)) return rv; - + nsCOMPtr historyFile; nsFileSpec dbfile; - rv = profile->GetCurrentProfileDir(&dbfile); + + NS_WITH_SERVICE(nsIFileLocator, locator, kFileLocatorCID, &rv); if (NS_FAILED(rv)) return rv; - // Urgh. No profile directory. Use tmp instead. - if (! dbfile.Exists()) { - // XXX Probably should warn user before doing this. Oh well. - dbfile = nsSpecialSystemDirectory(nsSpecialSystemDirectory::OS_TemporaryDirectory); - } + rv = locator->GetFileLocation(nsSpecialFileSpec::App_History50, getter_AddRefs(historyFile)); + if (NS_FAILED(rv)) return rv; - dbfile += "history.dat"; + rv = historyFile->GetFileSpec(&dbfile); + if (NS_FAILED(rv)) return rv; // Leaving XPCOM, entering Mork. The IID is a lie; the component // manager appears to be used solely to get dynamic loading of the