--- a/calendar/sunbird/app/nsCalendarApp.cpp
+++ b/calendar/sunbird/app/nsCalendarApp.cpp
@@ -8,17 +8,17 @@
#include <windows.h>
#include <stdlib.h>
#endif
#include <stdio.h>
#include <stdarg.h>
#include "nsCOMPtr.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsStringGlue.h"
#ifdef XP_WIN
#include "nsWindowsWMain.cpp"
#endif
static void Output(const char *fmt, ... )
{
@@ -33,17 +33,17 @@ static void Output(const char *fmt, ...
vfprintf(stderr, fmt, ap);
#endif
va_end(ap);
}
int main(int argc, char* argv[])
{
- nsCOMPtr<nsILocalFile> appini;
+ nsCOMPtr<nsIFile> appini;
nsresult rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appini));
if (NS_FAILED(rv)) {
Output("Couldn't calculate the application directory.");
return 255;
}
appini->SetNativeLeafName(NS_LITERAL_CSTRING("application.ini"));
nsXREAppData *appData;
--- a/chat/components/public/imIUserStatusInfo.idl
+++ b/chat/components/public/imIUserStatusInfo.idl
@@ -1,17 +1,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
#include "nsIObserver.idl"
//forward declarations
-interface nsILocalFile;
+interface nsIFile;
interface nsIFileURL;
[scriptable, uuid(817918fa-1f4b-4254-9cdb-f906da91c45d)]
interface imIUserStatusInfo: nsISupports {
readonly attribute AUTF8String statusText;
// See imIStatusInfo for the values.
@@ -20,17 +20,17 @@ interface imIUserStatusInfo: nsISupports
// Only works with STATUS_OFFLINE, STATUS_UNAVAILABLE, STATUS_AWAY,
// STATUS_AVAILABLE and STATUS_INVISIBLE.
// - When called with the status type STATUS_UNSET, only the status
// message will be changed.
// - When called with STATUS_OFFLINE, the aMessage parameter is ignored.
void setStatus(in short aStatus, in AUTF8String aMessage);
/* Will fire an user-icon-changed notificaton. */
- void setUserIcon(in nsILocalFile aIconFile);
+ void setUserIcon(in nsIFile aIconFile);
nsIFileURL getUserIcon();
/* The setter will fire an user-display-name-changed notificaton. */
attribute AUTF8String displayName;
void addObserver(in nsIObserver aObserver);
void removeObserver(in nsIObserver aObserver);
--- a/mail/app/nsMailApp.cpp
+++ b/mail/app/nsMailApp.cpp
@@ -16,17 +16,17 @@
#ifdef XP_MACOSX
#include "MacQuirks.h"
#endif
#include <stdio.h>
#include <stdarg.h>
#include "nsCOMPtr.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsStringGlue.h"
#ifdef XP_WIN
// we want a wmain entry point
#include "nsWindowsWMain.cpp"
#define snprintf _snprintf
#define strcasecmp _stricmp
#endif
@@ -80,17 +80,17 @@ static const nsDynamicFunctionLoad kXULF
#endif
{ "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
{ "XRE_main", (NSFuncPtr*) &XRE_main },
{ nsnull, nsnull }
};
static int do_main(const char *exePath, int argc, char* argv[])
{
- nsCOMPtr<nsILocalFile> appini;
+ nsCOMPtr<nsIFile> appini;
#ifdef XP_WIN
// exePath comes from mozilla::BinaryPath::Get, which returns a UTF-8
// encoded path, so it is safe to convert it
nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), false,
getter_AddRefs(appini));
#else
nsresult rv = NS_NewNativeLocalFile(nsDependentCString(exePath), false,
getter_AddRefs(appini));
--- a/mail/components/cloudfile/nsIMsgCloudFileProvider.idl
+++ b/mail/components/cloudfile/nsIMsgCloudFileProvider.idl
@@ -1,15 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
-interface nsILocalFile;
+interface nsIFile;
interface nsIRequestObserver;
interface nsIPrefBranch;
[scriptable, uuid(c961919b-980b-4adc-bcfe-dabe916d1acc)]
interface nsIMsgCloudFileProvider : nsISupports {
// The type is a unique string identifier used by various interface elements
// for styling. As such, the type should be an alphanumpheric string with
// no spaces.
readonly attribute ACString type;
@@ -33,26 +33,26 @@ interface nsIMsgCloudFileProvider : nsIS
* upload the file to the cloud provider. The callback's OnStopRequest
* method will be called when finished, with success or an error code.
*
* @param aFile file to upload
* @param aCallback callback when finished.
*
* @throws nsIMsgCloudFileProvider.offlineErr if we are offline.
*/
- void uploadFile(in nsILocalFile aFile, in nsIRequestObserver aCallback);
- ACString urlForFile(in nsILocalFile aFile);
+ void uploadFile(in nsIFile aFile, in nsIRequestObserver aCallback);
+ ACString urlForFile(in nsIFile aFile);
/**
* Cancels the upload of the passed in file, if it hasn't finished yet.
* If it hasn't started yet, it will be removed from the upload queue.
*
* @param aFile file whose upload we should cancel.
*/
- void cancelFileUpload(in nsILocalFile aFile);
+ void cancelFileUpload(in nsIFile aFile);
/**
* Refresh the user info for this account. This will fill in the quota info,
* if supported by the provider.
*
* @param aWithUI if true, we may prompt for a password, or bring up an auth
* page. If false, we won't, and will fail if auth is required.
* @param aCallback callback when finished.
@@ -65,17 +65,17 @@ interface nsIMsgCloudFileProvider : nsIS
* operation is asynchronous.
*
* @param aFile File we previously uploaded in this session.
* @param aCallback callback when finished
*
* @throws NS_ERROR_FAILURE if we don't know about the file.
* @throws nsIMsgCloudFileProvider.offlineErr if we are offline.
*/
- void deleteFile(in nsILocalFile aFile, in nsIRequestObserver aCallback);
+ void deleteFile(in nsIFile aFile, in nsIRequestObserver aCallback);
/**
* If the provider has an API for creating an account, this will start the
* process of creating one. There will probably have to be some sort of
* validation on the part of the user before the account is created.
* If not, this will throw NS_ERROR_NOT_IMPLEMENTED.
*
* If the REST call succeeds, aCallback.onStopRequest will get called back
--- a/mail/components/migration/src/nsEudoraProfileMigrator.h
+++ b/mail/components/migration/src/nsEudoraProfileMigrator.h
@@ -2,17 +2,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef eudoraprofilemigrator___h___
#define eudoraprofilemigrator___h___
#include "nsIMailProfileMigrator.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIObserverService.h"
#include "nsString.h"
#include "nsITimer.h"
#include "nsIImportGeneric.h"
#include "nsIImportModule.h"
#include "nsIMsgAccount.h"
#include "nsProfileMigratorBase.h"
--- a/mail/components/migration/src/nsMailProfileMigratorUtils.h
+++ b/mail/components/migration/src/nsMailProfileMigratorUtils.h
@@ -36,17 +36,17 @@ void SetProxyPref(const nsACString& aHos
const char* aPortPref, nsIPrefBranch* aPrefs);
struct MigrationData {
PRUnichar* fileName;
PRUint32 sourceFlag;
bool replaceOnly;
};
-class nsILocalFile;
+class nsIFile;
void GetMigrateDataFromArray(MigrationData* aDataArray,
PRInt32 aDataArrayLength,
bool aReplace,
nsIFile* aSourceProfile,
PRUint16* aResult);
// get the base directory of the *target* profile
--- a/mail/components/migration/src/nsNetscapeProfileMigratorBase.cpp
+++ b/mail/components/migration/src/nsNetscapeProfileMigratorBase.cpp
@@ -35,25 +35,22 @@ nsNetscapeProfileMigratorBase::nsNetscap
mCurrentProgress = LL_ZERO;
mFileCopyTransactionIndex = 0;
}
NS_IMPL_ISUPPORTS2(nsNetscapeProfileMigratorBase, nsIMailProfileMigrator,
nsITimerCallback)
nsresult
-nsNetscapeProfileMigratorBase::GetProfileDataFromProfilesIni(nsILocalFile* aDataDir,
+nsNetscapeProfileMigratorBase::GetProfileDataFromProfilesIni(nsIFile* aDataDir,
nsIMutableArray* aProfileNames,
nsIMutableArray* aProfileLocations)
{
- nsCOMPtr<nsIFile> dataDir;
- nsresult rv = aDataDir->Clone(getter_AddRefs(dataDir));
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsILocalFile> profileIni(do_QueryInterface(dataDir, &rv));
+ nsCOMPtr<nsIFile> profileIni;
+ nsresult rv = aDataDir->Clone(getter_AddRefs(profileIni));
NS_ENSURE_SUCCESS(rv, rv);
profileIni->Append(NS_LITERAL_STRING("profiles.ini"));
// Does it exist?
bool profileFileExists = false;
rv = profileIni->Exists(&profileFileExists);
NS_ENSURE_SUCCESS(rv, rv);
@@ -86,17 +83,17 @@ nsNetscapeProfileMigratorBase::GetProfil
}
rv = parser.GetString(profileID.get(), "Name", buffer);
if (NS_FAILED(rv)) {
NS_ERROR("Malformed profiles.ini: Name= not found");
continue;
}
- nsCOMPtr<nsILocalFile> rootDir;
+ nsCOMPtr<nsIFile> rootDir;
rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(rootDir));
NS_ENSURE_SUCCESS(rv, rv);
rv = isRelative ? rootDir->SetRelativeDescriptor(aDataDir, filePath) :
rootDir->SetPersistentDescriptor(filePath);
if (NS_FAILED(rv))
continue;
@@ -301,21 +298,20 @@ nsresult nsNetscapeProfileMigratorBase::
rv = dirIterator->GetNext((nsISupports**)getter_AddRefs(dirEntry));
if (NS_SUCCEEDED(rv))
{
rv = dirEntry->IsDirectory(&isDir);
if (NS_SUCCEEDED(rv))
{
if (isDir)
{
- nsCOMPtr<nsIFile> destClone;
- rv = destDir->Clone(getter_AddRefs(destClone));
+ nsCOMPtr<nsIFile> newChild;
+ rv = destDir->Clone(getter_AddRefs(newChild));
if (NS_SUCCEEDED(rv))
{
- nsCOMPtr<nsILocalFile> newChild(do_QueryInterface(destClone));
nsAutoString leafName;
dirEntry->GetLeafName(leafName);
newChild->AppendRelativePath(leafName);
rv = newChild->Exists(&exists);
if (NS_SUCCEEDED(rv) && !exists)
rv = newChild->Create(nsIFile::DIRECTORY_TYPE, 0775);
rv = RecursiveCopy(dirEntry, newChild);
}
--- a/mail/components/migration/src/nsNetscapeProfileMigratorBase.h
+++ b/mail/components/migration/src/nsNetscapeProfileMigratorBase.h
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef netscapeprofilemigratorbase___h___
#define netscapeprofilemigratorbase___h___
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIStringBundle.h"
#include "nsStringGlue.h"
#include "nsTArray.h"
#include "nsIObserverService.h"
#include "nsITimer.h"
#include "nsIMailProfileMigrator.h"
class nsIPrefBranch;
@@ -81,26 +81,26 @@ public:
static nsresult SetInt(PrefTransform* aTransform, nsIPrefBranch* aBranch);
nsresult RecursiveCopy(nsIFile* srcDir, nsIFile* destDir); // helper routine
protected:
void CopyNextFolder();
void EndCopyFolders();
- nsresult GetProfileDataFromProfilesIni(nsILocalFile* aDataDir,
+ nsresult GetProfileDataFromProfilesIni(nsIFile* aDataDir,
nsIMutableArray* aProfileNames,
nsIMutableArray* aProfileLocations);
nsresult CopyFile(const nsAString& aSourceFileName, const nsAString& aTargetFileName);
nsresult GetSignonFileName(bool aReplace, char** aFileName);
nsresult LocateSignonsFile(char** aResult);
- nsCOMPtr<nsILocalFile> mSourceProfile;
+ nsCOMPtr<nsIFile> mSourceProfile;
nsCOMPtr<nsIFile> mTargetProfile;
// List of src/destination files we still have to copy into the new profile
// directory.
nsTArray<fileTransactionEntry> mFileCopyTransactions;
PRUint32 mFileCopyTransactionIndex;
PRInt64 mMaxProgress;
--- a/mail/components/migration/src/nsProfileMigrator.cpp
+++ b/mail/components/migration/src/nsProfileMigrator.cpp
@@ -1,14 +1,14 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIDOMWindow.h"
#include "nsIProfileMigrator.h"
#include "nsIPrefService.h"
#include "nsIServiceManager.h"
#include "nsIToolkitProfile.h"
#include "nsIToolkitProfileService.h"
#include "nsIWindowWatcher.h"
#include "nsISupportsPrimitives.h"
--- a/mail/components/migration/src/nsProfileMigrator.h
+++ b/mail/components/migration/src/nsProfileMigrator.h
@@ -1,14 +1,14 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIProfileMigrator.h"
#include "nsIMailProfileMigrator.h"
#include "nsIServiceManager.h"
#include "nsIToolkitProfile.h"
#include "nsIToolkitProfileService.h"
#include "nsCOMPtr.h"
#include "nsDirectoryServiceDefs.h"
--- a/mail/components/migration/src/nsProfileMigratorBase.h
+++ b/mail/components/migration/src/nsProfileMigratorBase.h
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef profilemigratorbase___h___
#define profilemigratorbase___h___
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIObserverService.h"
#include "nsString.h"
#include "nsITimer.h"
#include "nsIImportGeneric.h"
#include "nsIImportModule.h"
#include "nsIMsgAccount.h"
class nsProfileMigratorBase
--- a/mail/components/migration/src/nsSeamonkeyProfileMigrator.cpp
+++ b/mail/components/migration/src/nsSeamonkeyProfileMigrator.cpp
@@ -203,46 +203,46 @@ nsSeamonkeyProfileMigrator::GetSourcePro
}
nsresult
nsSeamonkeyProfileMigrator::FillProfileDataFromSeamonkeyRegistry()
{
// Find the Seamonkey Registry
nsCOMPtr<nsIProperties> fileLocator(
do_GetService("@mozilla.org/file/directory_service;1"));
- nsCOMPtr<nsILocalFile> seamonkeyData;
+ nsCOMPtr<nsIFile> seamonkeyData;
#undef EXTRA_PREPEND
#ifdef XP_WIN
#define NEW_FOLDER "SeaMonkey"
#define EXTRA_PREPEND "Mozilla"
- fileLocator->Get(NS_WIN_APPDATA_DIR, NS_GET_IID(nsILocalFile),
+ fileLocator->Get(NS_WIN_APPDATA_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(seamonkeyData));
NS_ENSURE_TRUE(seamonkeyData, NS_ERROR_FAILURE);
#elif defined(XP_MACOSX)
#define NEW_FOLDER "SeaMonkey"
#define EXTRA_PREPEND "Application Support"
- fileLocator->Get(NS_MAC_USER_LIB_DIR, NS_GET_IID(nsILocalFile),
+ fileLocator->Get(NS_MAC_USER_LIB_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(seamonkeyData));
NS_ENSURE_TRUE(seamonkeyData, NS_ERROR_FAILURE);
#elif defined(XP_UNIX)
#define NEW_FOLDER "seamonkey"
#define EXTRA_PREPEND ".mozilla"
- fileLocator->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsILocalFile),
+ fileLocator->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(seamonkeyData));
NS_ENSURE_TRUE(seamonkeyData, NS_ERROR_FAILURE);
#elif defined(XP_OS2)
#define NEW_FOLDER "SeaMonkey"
#define EXTRA_PREPEND "Mozilla"
- fileLocator->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsILocalFile),
+ fileLocator->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(seamonkeyData));
NS_ENSURE_TRUE(seamonkeyData, NS_ERROR_FAILURE);
#else
// On other OS just abort.
return NS_ERROR_FAILURE;
#endif
@@ -250,20 +250,17 @@ nsSeamonkeyProfileMigrator::FillProfileD
seamonkeyData->Clone(getter_AddRefs(newSeamonkeyData));
NS_ENSURE_TRUE(newSeamonkeyData, NS_ERROR_FAILURE);
#ifdef EXTRA_PREPEND
newSeamonkeyData->Append(NS_LITERAL_STRING(EXTRA_PREPEND));
#endif
newSeamonkeyData->Append(NS_LITERAL_STRING(NEW_FOLDER));
- nsCOMPtr<nsILocalFile> newSmDataLocal(do_QueryInterface(newSeamonkeyData));
- NS_ENSURE_TRUE(newSmDataLocal, NS_ERROR_FAILURE);
-
- nsresult rv = GetProfileDataFromProfilesIni(newSmDataLocal,
+ nsresult rv = GetProfileDataFromProfilesIni(newSeamonkeyData,
mProfileNames,
mProfileLocations);
return rv;
}
static
nsSeamonkeyProfileMigrator::PrefTransform gTransforms[] = {
@@ -430,18 +427,18 @@ nsSeamonkeyProfileMigrator::CopySignatur
// a partial fix for bug #255043
// if the user's signature file from seamonkey lives in the
// seamonkey profile root, we'll copy it over to the new
// thunderbird profile root and thenn set the pref to the new value
// note, this doesn't work for multiple signatures that live
// below the seamonkey profile root
if (StringEndsWith(prefName, nsDependentCString(".sig_file")))
{
- // turn the pref into a nsILocalFile
- nsCOMPtr<nsILocalFile> srcSigFile =
+ // turn the pref into a nsIFile
+ nsCOMPtr<nsIFile> srcSigFile =
do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
srcSigFile->SetPersistentDescriptor(nsDependentCString(pref->stringValue));
nsCOMPtr<nsIFile> targetSigFile;
rv = mTargetProfile->Clone(getter_AddRefs(targetSigFile));
NS_ENSURE_SUCCESS(rv, rv);
// now make the copy
@@ -451,18 +448,17 @@ nsSeamonkeyProfileMigrator::CopySignatur
{
nsAutoString leafName;
srcSigFile->GetLeafName(leafName);
srcSigFile->CopyTo(targetSigFile,leafName); // will fail if we've already copied a sig file here
targetSigFile->Append(leafName);
// now write out the new descriptor
nsCAutoString descriptorString;
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(targetSigFile);
- localFile->GetPersistentDescriptor(descriptorString);
+ targetSigFile->GetPersistentDescriptor(descriptorString);
NS_Free(pref->stringValue);
pref->stringValue = ToNewCString(descriptorString);
}
}
}
return NS_OK;
}
@@ -507,18 +503,18 @@ nsSeamonkeyProfileMigrator::CopyMailFold
aPrefService->GetBranch(prefName.get(), getter_AddRefs(serverBranch));
if (!serverBranch)
break; // should we clear out this server pref from aMailServers?
nsCString serverType;
serverBranch->GetCharPref("type", getter_Copies(serverType));
- nsCOMPtr<nsILocalFile> sourceMailFolder;
- serverBranch->GetComplexValue("directory", NS_GET_IID(nsILocalFile), getter_AddRefs(sourceMailFolder));
+ nsCOMPtr<nsIFile> sourceMailFolder;
+ serverBranch->GetComplexValue("directory", NS_GET_IID(nsIFile), getter_AddRefs(sourceMailFolder));
// now based on type, we need to build a new destination path for the mail folders for this server
nsCOMPtr<nsIFile> targetMailFolder;
if (serverType.Equals("imap"))
{
mTargetProfile->Clone(getter_AddRefs(targetMailFolder));
targetMailFolder->Append(IMAP_MAIL_DIR_50_NAME);
}
@@ -546,49 +542,47 @@ nsSeamonkeyProfileMigrator::CopyMailFold
// has multiple servers with the same host name.
targetMailFolder->CreateUnique(nsIFile::DIRECTORY_TYPE, 0777);
rv = RecursiveCopy(sourceMailFolder, targetMailFolder);
// now we want to make sure the actual directory pref that gets
// transformed into the new profile's pref.js has the right file
// location.
nsCAutoString descriptorString;
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(targetMailFolder);
- localFile->GetPersistentDescriptor(descriptorString);
+ targetMailFolder->GetPersistentDescriptor(descriptorString);
NS_Free(pref->stringValue);
pref->stringValue = ToNewCString(descriptorString);
}
}
else if (StringEndsWith(prefName, nsDependentCString(".newsrc.file")))
{
// copy the news RC file into \News. this won't work if the user has different newsrc files for each account
// I don't know what to do in that situation.
nsCOMPtr<nsIFile> targetNewsRCFile;
mTargetProfile->Clone(getter_AddRefs(targetNewsRCFile));
targetNewsRCFile->Append(NEWS_DIR_50_NAME);
- // turn the pref into a nsILocalFile
- nsCOMPtr<nsILocalFile> srcNewsRCFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
+ // turn the pref into a nsIFile
+ nsCOMPtr<nsIFile> srcNewsRCFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
srcNewsRCFile->SetPersistentDescriptor(nsDependentCString(pref->stringValue));
// now make the copy
bool exists;
srcNewsRCFile->Exists(&exists);
if (exists)
{
nsAutoString leafName;
srcNewsRCFile->GetLeafName(leafName);
srcNewsRCFile->CopyTo(targetNewsRCFile,leafName); // will fail if we've already copied a newsrc file here
targetNewsRCFile->Append(leafName);
// now write out the new descriptor
nsCAutoString descriptorString;
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(targetNewsRCFile);
- localFile->GetPersistentDescriptor(descriptorString);
+ targetNewsRCFile->GetPersistentDescriptor(descriptorString);
NS_Free(pref->stringValue);
pref->stringValue = ToNewCString(descriptorString);
}
}
}
return NS_OK;
}
--- a/mail/components/shell/nsMailWinIntegration.cpp
+++ b/mail/components/shell/nsMailWinIntegration.cpp
@@ -5,17 +5,17 @@
#include "nsMailWinIntegration.h"
#include "nsIServiceManager.h"
#include "nsICategoryManager.h"
#include "nsNativeCharsetUtils.h"
#include "nsIPrefService.h"
#include "windows.h"
#include "shellapi.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsDirectoryServiceDefs.h"
#include "nsUnicharUtils.h"
#include "nsIWinTaskbar.h"
#include "nsISupportsPrimitives.h"
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
@@ -113,19 +113,19 @@ static SETTING gFeedSettings[] = {
nsresult
GetHelperPath(nsAutoString& aPath)
{
nsresult rv;
nsCOMPtr<nsIProperties> directoryService =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> appHelper;
+ nsCOMPtr<nsIFile> appHelper;
rv = directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(appHelper));
NS_ENSURE_SUCCESS(rv, rv);
rv = appHelper->Append(NS_LITERAL_STRING("uninstall"));
NS_ENSURE_SUCCESS(rv, rv);
rv = appHelper->Append(NS_LITERAL_STRING("helper.exe"));
NS_ENSURE_SUCCESS(rv, rv);
--- a/mailnews/addrbook/public/nsIAbLDAPDirectory.idl
+++ b/mailnews/addrbook/public/nsIAbLDAPDirectory.idl
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
interface nsIMutableArray;
-interface nsILocalFile;
+interface nsIFile;
interface nsIAddrDatabase;
interface nsIAbLDAPAttributeMap;
interface nsILDAPURL;
%{C++
#define kLDAPDirectoryRoot "moz-abldapdirectory://"
#define kLDAPDirectoryRootLen 22
%}
@@ -79,17 +79,17 @@ interface nsIAbLDAPDirectory : nsISuppor
* url, e.g. ldap://localhost:389/ whereas the uri will give you the
* directories rdf uri, e.g. moz-abldapdirectory://<pref base name>/.
*/
attribute nsILDAPURL lDAPURL;
/**
* The replication (offline) file that this database uses.
*/
- readonly attribute nsILocalFile replicationFile;
+ readonly attribute nsIFile replicationFile;
/**
* A database that is set up for the replication file.
*/
readonly attribute nsIAddrDatabase replicationDatabase;
/**
* The LDAP attributes used to build the Relative Distinguished Name
--- a/mailnews/addrbook/public/nsIAbMDBDirectory.idl
+++ b/mailnews/addrbook/public/nsIAbMDBDirectory.idl
@@ -1,16 +1,16 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
-interface nsILocalFile;
+interface nsIFile;
interface nsIAbDirectory;
interface nsIAbCard;
interface nsIAddrDatabase;
%{C++
#define kMDBDirectoryRoot "moz-abmdbdirectory://"
#define kMDBDirectoryRootLen 21
%}
@@ -19,22 +19,22 @@ interface nsIAddrDatabase;
interface nsIAbMDBDirectory : nsISupports {
// Creates a directory component from the
// uriName, adds it to its children and returns
// the component
nsIAbDirectory addDirectory(in string uriName);
/**
- * Supplies a nsILocalFile point to the database file for this directory
+ * Supplies a nsIFile point to the database file for this directory
*
* @exception NS_ERROR_NOT_INITIALIZED If there is no filename preference
* present or it is empty
*/
- readonly attribute nsILocalFile databaseFile;
+ readonly attribute nsIFile databaseFile;
/**
* Supplies a nsIAddrDatabase that uses the databaseFile. See also
* databaseFile for possible exceptions.
*/
readonly attribute nsIAddrDatabase database;
// Mail list specific
--- a/mailnews/addrbook/public/nsIAbManager.idl
+++ b/mailnews/addrbook/public/nsIAbManager.idl
@@ -5,17 +5,17 @@
#include "nsISupports.idl"
#include "nsIAbListener.idl"
interface nsIDOMWindow;
interface nsIAbDirectory;
interface nsIAbCard;
interface nsIAbDirectoryProperties;
-interface nsILocalFile;
+interface nsIFile;
interface nsISimpleEnumerator;
interface nsIAbBooleanExpression;
/**
* nsIAbManager is an interface to the main address book mananger
* via the contract id "@mozilla.org/abmanager;1"
*
* It contains the main functions to create and delete address books as well
@@ -132,17 +132,17 @@ interface nsIAbManager : nsISupports
*/
void notifyDirectoryDeleted(in nsIAbDirectory aParentDirectory,
in nsISupports aDirectory);
/**
* Returns the user profile directory. NOTE: this should not be used
* as it may go away soon.
*/
- readonly attribute nsILocalFile userProfileDirectory;
+ readonly attribute nsIFile userProfileDirectory;
/**
* Finds out if the mailing list name exists in any *mork/MDB* based
* address book
*
* @param aName The name of the list to try and find.
*
* @return True if the name exists.
--- a/mailnews/addrbook/src/nsAbLDAPChangeLogData.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPChangeLogData.cpp
@@ -155,17 +155,17 @@ nsresult nsAbLDAPProcessChangeLogData::O
break;
case kSearchingRootDSE:
{
// Before starting the changeLog check the DB file, if its not there or bogus
// we need to create a new one and set to all.
nsCOMPtr<nsIAddrBookSession> abSession = do_GetService(NS_ADDRBOOKSESSION_CONTRACTID, &rv);
if (NS_FAILED(rv))
break;
- nsCOMPtr<nsILocalFile> dbPath;
+ nsCOMPtr<nsIFile> dbPath;
rv = abSession->GetUserProfileDirectory(getter_AddRefs(dbPath));
if (NS_FAILED(rv))
break;
nsCAutoString fileName;
rv = mDirectory->GetReplicationFileName(fileName);
if (NS_FAILED(rv))
break;
--- a/mailnews/addrbook/src/nsAbLDAPDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPDirectory.cpp
@@ -17,17 +17,17 @@
#include "nsArrayEnumerator.h"
#include "nsEnumeratorUtils.h"
#include "nsIAbLDAPAttributeMap.h"
#include "nsIAbMDBDirectory.h"
#include "nsILDAPURL.h"
#include "nsILDAPConnection.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsILDAPModification.h"
#include "nsILDAPService.h"
#include "nsIAbLDAPCard.h"
#include "nsAbUtils.h"
#include "nsArrayUtils.h"
#include "nsIPrefService.h"
#include "nsIMsgAccountManager.h"
#include "nsMsgBaseCID.h"
@@ -517,17 +517,17 @@ NS_IMETHODIMP nsAbLDAPDirectory::UseForA
NS_ENSURE_SUCCESS(rv,rv);
}
// Now see if the pref name matches our pref id.
if (prefName.Equals(m_DirPrefId))
{
// Yes it does, one last check - does the replication file exist?
nsresult rv;
- nsCOMPtr<nsILocalFile> databaseFile;
+ nsCOMPtr<nsIFile> databaseFile;
// If we can't get the file, then there is no database to use
if (NS_FAILED(GetReplicationFile(getter_AddRefs(databaseFile))))
return NS_OK;
bool exists;
rv = databaseFile->Exists(&exists);
NS_ENSURE_SUCCESS(rv, rv);
@@ -652,17 +652,17 @@ NS_IMETHODIMP nsAbLDAPDirectory::GetAttr
nsresult rv;
nsCOMPtr<nsIAbLDAPAttributeMapService> mapSvc =
do_GetService("@mozilla.org/addressbook/ldap-attribute-map-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
return mapSvc->GetMapForPrefBranch(m_DirPrefId, aAttributeMap);
}
-NS_IMETHODIMP nsAbLDAPDirectory::GetReplicationFile(nsILocalFile **aResult)
+NS_IMETHODIMP nsAbLDAPDirectory::GetReplicationFile(nsIFile **aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
nsCString fileName;
nsresult rv = GetStringValue("filename", EmptyCString(), fileName);
NS_ENSURE_SUCCESS(rv, rv);
if (fileName.IsEmpty())
@@ -671,30 +671,27 @@ NS_IMETHODIMP nsAbLDAPDirectory::GetRepl
nsCOMPtr<nsIFile> profileDir;
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
getter_AddRefs(profileDir));
NS_ENSURE_SUCCESS(rv, rv);
rv = profileDir->AppendNative(fileName);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> replFile(do_QueryInterface(profileDir, &rv));
- NS_ENSURE_SUCCESS(rv, rv);
-
- NS_ADDREF(*aResult = replFile);
+ NS_ADDREF(*aResult = profileDir);
return NS_OK;
}
NS_IMETHODIMP nsAbLDAPDirectory::GetReplicationDatabase(nsIAddrDatabase **aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
nsresult rv;
- nsCOMPtr<nsILocalFile> databaseFile;
+ nsCOMPtr<nsIFile> databaseFile;
rv = GetReplicationFile(getter_AddRefs(databaseFile));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAddrDatabase> addrDBFactory =
do_GetService(NS_ADDRDATABASE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
return addrDBFactory->Open(databaseFile, false /* no create */, true,
--- a/mailnews/addrbook/src/nsAbLDAPReplicationData.h
+++ b/mailnews/addrbook/src/nsAbLDAPReplicationData.h
@@ -6,17 +6,17 @@
#ifndef nsAbLDAPReplicationData_h__
#define nsAbLDAPReplicationData_h__
#include "nsIAbLDAPReplicationData.h"
#include "nsIWebProgressListener.h"
#include "nsIAbLDAPReplicationQuery.h"
#include "nsAbLDAPListenerBase.h"
#include "nsIAddrDatabase.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsDirPrefs.h"
#include "nsIAbLDAPAttributeMap.h"
#include "nsIAbLDAPDirectory.h"
#include "nsStringGlue.h"
class nsAbLDAPProcessReplicationData : public nsIAbLDAPProcessReplicationData,
public nsAbLDAPListenerBase
{
@@ -35,18 +35,18 @@ protected:
virtual void InitFailed(bool aCancelled = false);
// pointer to the interfaces used by this object
nsCOMPtr<nsIWebProgressListener> mListener;
// pointer to the query to call back to once we've finished
nsCOMPtr<nsIAbLDAPReplicationQuery> mQuery;
nsCOMPtr<nsIAddrDatabase> mReplicationDB;
- nsCOMPtr <nsILocalFile> mReplicationFile;
- nsCOMPtr <nsILocalFile> mBackupReplicationFile;
+ nsCOMPtr <nsIFile> mReplicationFile;
+ nsCOMPtr <nsIFile> mBackupReplicationFile;
// state of processing, protocol used and count of results
PRInt32 mState;
PRInt32 mProtocol;
PRInt32 mCount;
bool mDBOpen;
bool mInitialized;
--- a/mailnews/addrbook/src/nsAbMDBDirFactory.cpp
+++ b/mailnews/addrbook/src/nsAbMDBDirFactory.cpp
@@ -2,17 +2,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsAbMDBDirFactory.h"
#include "nsAbUtils.h"
#include "nsStringGlue.h"
#include "nsServiceManagerUtils.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIAbManager.h"
#include "nsIAbMDBDirectory.h"
#include "nsAbMDBDirFactory.h"
#include "nsIAddrDBListener.h"
#include "nsIAddrDatabase.h"
#include "nsEnumeratorUtils.h"
#include "nsIMutableArray.h"
#include "nsArrayUtils.h"
@@ -42,17 +42,17 @@ NS_IMETHODIMP nsAbMDBDirFactory::GetDire
nsCOMPtr<nsIAbDirectory> directory;
rv = abManager->GetDirectory(aURI, getter_AddRefs(directory));
NS_ENSURE_SUCCESS(rv, rv);
rv = directory->SetDirPrefId(aPrefName);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> dbPath;
+ nsCOMPtr<nsIFile> dbPath;
rv = abManager->GetUserProfileDirectory(getter_AddRefs(dbPath));
nsCOMPtr<nsIAddrDatabase> listDatabase;
if (NS_SUCCEEDED(rv))
{
nsCAutoString fileName;
if (StringBeginsWith(aURI, NS_LITERAL_CSTRING(kMDBDirectoryRoot)))
--- a/mailnews/addrbook/src/nsAbMDBDirProperty.cpp
+++ b/mailnews/addrbook/src/nsAbMDBDirProperty.cpp
@@ -129,17 +129,17 @@ NS_IMETHODIMP nsAbMDBDirProperty::Notify
}
/* [noscript] void clearDatabase (); */
NS_IMETHODIMP nsAbMDBDirProperty::ClearDatabase()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
-NS_IMETHODIMP nsAbMDBDirProperty::GetDatabaseFile(nsILocalFile **aResult)
+NS_IMETHODIMP nsAbMDBDirProperty::GetDatabaseFile(nsIFile **aResult)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsAbMDBDirProperty::GetDatabase(nsIAddrDatabase **aResult)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
--- a/mailnews/addrbook/src/nsAbMDBDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbMDBDirectory.cpp
@@ -18,17 +18,17 @@
#include "nsIMutableArray.h"
#include "nsArrayEnumerator.h"
#include "nsEnumeratorUtils.h"
#include "mdb.h"
#include "prprf.h"
#include "nsIPrefService.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsComponentManagerUtils.h"
#include "nsMemory.h"
#include "nsArrayUtils.h"
#include "nsUnicharUtils.h"
nsAbMDBDirectory::nsAbMDBDirectory(void):
nsAbMDBDirProperty(),
mPerformingQuery(false)
@@ -315,49 +315,46 @@ NS_IMETHODIMP nsAbMDBDirectory::AddDirec
NS_ENSURE_SUCCESS(rv, rv);
if (mSubDirectories.IndexOf(directory) == -1)
mSubDirectories.AppendObject(directory);
NS_IF_ADDREF(*childDir = directory);
return rv;
}
-NS_IMETHODIMP nsAbMDBDirectory::GetDatabaseFile(nsILocalFile **aResult)
+NS_IMETHODIMP nsAbMDBDirectory::GetDatabaseFile(nsIFile **aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
nsCString fileName;
nsresult rv = GetStringValue("filename", EmptyCString(), fileName);
NS_ENSURE_SUCCESS(rv, rv);
if (fileName.IsEmpty())
return NS_ERROR_NOT_INITIALIZED;
- nsCOMPtr<nsIFile> profileDir;
+ nsCOMPtr<nsIFile> dbFile;
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
- getter_AddRefs(profileDir));
+ getter_AddRefs(dbFile));
NS_ENSURE_SUCCESS(rv, rv);
- rv = profileDir->AppendNative(fileName);
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsILocalFile> dbFile = do_QueryInterface(profileDir, &rv);
+ rv = dbFile->AppendNative(fileName);
NS_ENSURE_SUCCESS(rv, rv);
NS_ADDREF(*aResult = dbFile);
return NS_OK;
}
NS_IMETHODIMP nsAbMDBDirectory::GetDatabase(nsIAddrDatabase **aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
nsresult rv;
- nsCOMPtr<nsILocalFile> databaseFile;
+ nsCOMPtr<nsIFile> databaseFile;
rv = GetDatabaseFile(getter_AddRefs(databaseFile));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAddrDatabase> addrDBFactory =
do_GetService(NS_ADDRDATABASE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
return addrDBFactory->Open(databaseFile, false /* no create */, true,
--- a/mailnews/addrbook/src/nsAbMDBDirectory.h
+++ b/mailnews/addrbook/src/nsAbMDBDirectory.h
@@ -44,17 +44,17 @@ public:
// nsIAbMDBDirectory methods
NS_IMETHOD GetURI(nsACString &aURI);
NS_IMETHOD ClearDatabase();
NS_IMETHOD NotifyDirItemAdded(nsISupports *item) { return NotifyItemAdded(item);}
NS_IMETHOD RemoveElementsFromAddressList();
NS_IMETHOD RemoveEmailAddressAt(PRUint32 aIndex);
NS_IMETHOD AddDirectory(const char *uriName, nsIAbDirectory **childDir);
- NS_IMETHOD GetDatabaseFile(nsILocalFile **aResult);
+ NS_IMETHOD GetDatabaseFile(nsIFile **aResult);
NS_IMETHOD GetDatabase(nsIAddrDatabase **aResult);
// nsIAbDirectory methods:
NS_IMETHOD GetChildNodes(nsISimpleEnumerator* *result);
NS_IMETHOD GetChildCards(nsISimpleEnumerator* *result);
NS_IMETHOD GetIsQuery(bool *aResult);
NS_IMETHOD DeleteDirectory(nsIAbDirectory *directory);
NS_IMETHOD DeleteCards(nsIArray *cards);
--- a/mailnews/addrbook/src/nsAbManager.cpp
+++ b/mailnews/addrbook/src/nsAbManager.cpp
@@ -20,17 +20,17 @@
#include "nsIFilePicker.h"
#include "plbase64.h"
#include "nsIWindowWatcher.h"
#include "nsDirectoryServiceUtils.h"
#include "nsVCard.h"
#include "nsVCardObj.h"
#include "nsIAbLDAPAttributeMap.h"
#include "nsICommandLine.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIMutableArray.h"
#include "nsArrayUtils.h"
#include "nsDirectoryServiceUtils.h"
#include "nsIObserverService.h"
#include "nsDirPrefs.h"
#include "nsThreadUtils.h"
#include "nsIAbDirFactory.h"
#include "nsComponentManagerUtils.h"
@@ -416,17 +416,17 @@ NS_IMETHODIMP nsAbManager::NotifyDirecto
NS_IMETHODIMP nsAbManager::NotifyDirectoryDeleted(nsIAbDirectory *aParentDirectory,
nsISupports *aDirectory)
{
NOTIFY_AB_LISTENERS(directoryRemoved, OnItemRemoved,
(aParentDirectory, aDirectory));
return NS_OK;
}
-NS_IMETHODIMP nsAbManager::GetUserProfileDirectory(nsILocalFile **userDir)
+NS_IMETHODIMP nsAbManager::GetUserProfileDirectory(nsIFile **userDir)
{
NS_ENSURE_ARG_POINTER(userDir);
*userDir = nsnull;
nsresult rv;
nsCOMPtr<nsIFile> profileDir;
nsCAutoString pathBuf;
@@ -538,17 +538,17 @@ NS_IMETHODIMP nsAbManager::ExportAddress
NS_ENSURE_SUCCESS(rv, rv);
PRInt16 dialogResult;
filePicker->Show(&dialogResult);
if (dialogResult == nsIFilePicker::returnCancel)
return rv;
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
rv = filePicker->GetFile(getter_AddRefs(localFile));
NS_ENSURE_SUCCESS(rv, rv);
if (dialogResult == nsIFilePicker::returnReplace) {
// be extra safe and only delete when the file is really a file
bool isFile;
rv = localFile->IsFile(&isFile);
if (NS_SUCCEEDED(rv) && isFile) {
@@ -605,17 +605,17 @@ NS_IMETHODIMP nsAbManager::ExportAddress
rv = ExportDirectoryToDelimitedText(aDirectory, TAB_DELIM, TAB_DELIM_LEN, localFile);
break;
};
return rv;
}
nsresult
-nsAbManager::ExportDirectoryToDelimitedText(nsIAbDirectory *aDirectory, const char *aDelim, PRUint32 aDelimLen, nsILocalFile *aLocalFile)
+nsAbManager::ExportDirectoryToDelimitedText(nsIAbDirectory *aDirectory, const char *aDelim, PRUint32 aDelimLen, nsIFile *aLocalFile)
{
nsCOMPtr <nsISimpleEnumerator> cardsEnumerator;
nsCOMPtr <nsIAbCard> card;
nsresult rv;
nsCOMPtr <nsIOutputStream> outputStream;
rv = MsgNewBufferedFileOutputStream(getter_AddRefs(outputStream),
@@ -787,17 +787,17 @@ nsAbManager::ExportDirectoryToDelimitedT
NS_ENSURE_SUCCESS(rv,rv);
rv = outputStream->Close();
NS_ENSURE_SUCCESS(rv,rv);
return NS_OK;
}
nsresult
-nsAbManager::ExportDirectoryToLDIF(nsIAbDirectory *aDirectory, nsILocalFile *aLocalFile)
+nsAbManager::ExportDirectoryToLDIF(nsIAbDirectory *aDirectory, nsIFile *aLocalFile)
{
nsCOMPtr <nsISimpleEnumerator> cardsEnumerator;
nsCOMPtr <nsIAbCard> card;
nsresult rv;
nsCOMPtr <nsIOutputStream> outputStream;
rv = MsgNewBufferedFileOutputStream(getter_AddRefs(outputStream),
--- a/mailnews/addrbook/src/nsAbManager.h
+++ b/mailnews/addrbook/src/nsAbManager.h
@@ -30,18 +30,18 @@ public:
NS_DECL_NSIABMANAGER
NS_DECL_NSIOBSERVER
NS_DECL_NSICOMMANDLINEHANDLER
nsresult Init();
private:
nsresult GetRootDirectory(nsIAbDirectory **aResult);
- nsresult ExportDirectoryToDelimitedText(nsIAbDirectory *aDirectory, const char *aDelim, PRUint32 aDelimLen, nsILocalFile *aLocalFile);
- nsresult ExportDirectoryToLDIF(nsIAbDirectory *aDirectory, nsILocalFile *aLocalFile);
+ nsresult ExportDirectoryToDelimitedText(nsIAbDirectory *aDirectory, const char *aDelim, PRUint32 aDelimLen, nsIFile *aLocalFile);
+ nsresult ExportDirectoryToLDIF(nsIAbDirectory *aDirectory, nsIFile *aLocalFile);
nsresult AppendLDIFForMailList(nsIAbCard *aCard, nsIAbLDAPAttributeMap *aAttrMap, nsACString &aResult);
nsresult AppendDNForCard(const char *aProperty, nsIAbCard *aCard, nsIAbLDAPAttributeMap *aAttrMap, nsACString &aResult);
nsresult AppendBasicLDIFForCard(nsIAbCard *aCard, nsIAbLDAPAttributeMap *aAttrMap, nsACString &aResult);
nsresult AppendProperty(const char *aProperty, const PRUnichar *aValue, nsACString &aResult);
bool IsSafeLDIFString(const PRUnichar *aStr);
struct abListener {
nsCOMPtr<nsIAbListener> mListener;
--- a/mailnews/addrbook/src/nsDirPrefs.cpp
+++ b/mailnews/addrbook/src/nsDirPrefs.cpp
@@ -11,17 +11,17 @@
#include "nsIPrefLocalizedString.h"
#include "nsIObserver.h"
#include "nsVoidArray.h"
#include "nsServiceManagerUtils.h"
#include "nsMemory.h"
#include "nsIAddrDatabase.h"
#include "nsAbBaseCID.h"
#include "nsIAbManager.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsWeakReference.h"
#include "nsIAbMDBDirectory.h"
#if defined(MOZ_LDAP_XPCOM)
#include "nsIAbLDAPDirectory.h"
#endif
#include "prmem.h"
#include "prprf.h"
#include "plstr.h"
@@ -612,17 +612,17 @@ static void DIR_DeleteServer(DIR_Server
}
nsresult DIR_DeleteServerFromList(DIR_Server *server)
{
if (!server)
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_OK;
- nsCOMPtr<nsILocalFile> dbPath;
+ nsCOMPtr<nsIFile> dbPath;
nsCOMPtr<nsIAbManager> abManager = do_GetService(NS_ABMANAGER_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
rv = abManager->GetUserProfileDirectory(getter_AddRefs(dbPath));
if (NS_SUCCEEDED(rv))
{
// close the database, as long as it isn't the special ones
@@ -895,17 +895,17 @@ static void DIR_ConvertServerFileName(DI
* string.
*/
void DIR_SetFileName(char** fileName, const char* defaultName)
{
if (!fileName)
return;
nsresult rv = NS_OK;
- nsCOMPtr<nsILocalFile> dbPath;
+ nsCOMPtr<nsIFile> dbPath;
*fileName = nsnull;
nsCOMPtr<nsIAbManager> abManager = do_GetService(NS_ABMANAGER_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
rv = abManager->GetUserProfileDirectory(getter_AddRefs(dbPath));
if (NS_SUCCEEDED(rv))
{
--- a/mailnews/base/public/nsIMessenger.idl
+++ b/mailnews/base/public/nsIMessenger.idl
@@ -110,17 +110,17 @@ interface nsIMessenger : nsISupports {
in nsIUrlListener aListener);
void detachAttachment(in string contentTpe, in string url, in string displayName, in string messageUri, in boolean saveFirst, [optional] in boolean withoutWarning);
void detachAllAttachments(in unsigned long count, [array, size_is(count)] in string contentTypeArray,
[array, size_is(count)] in string urlArray, [array, size_is(count)] in string displayNameArray,
[array, size_is(count)] in string messageUriArray, in boolean saveFirst, [optional] in boolean withoutWarning);
// saveAttachmentToFolder is used by the drag and drop code to drop an attachment to a destination folder
// We need to return the actual file path (including the filename).
- nsILocalFile saveAttachmentToFolder(in ACString contentType, in ACString url, in ACString displayName, in ACString messageUri, in nsILocalFile aDestFolder);
+ nsIFile saveAttachmentToFolder(in ACString contentType, in ACString url, in ACString displayName, in ACString messageUri, in nsIFile aDestFolder);
readonly attribute ACString lastDisplayedMessageUri;
nsIMsgMessageService messageServiceFromURI(in ACString aUri);
nsIMsgDBHdr msgHdrFromURI(in ACString aUri);
// For back forward history, we need a list of visited messages,
// and where we are in the list.
--- a/mailnews/base/public/nsIMsgAccountManager.idl
+++ b/mailnews/base/public/nsIMsgAccountManager.idl
@@ -207,17 +207,17 @@ interface nsIMsgAccountManager : nsISupp
/**
* Iterates over all folders looking for one with the passed in path,
* and returns the uri for the matching folder. In the future,
* the folder lookup service will provide this functionality.
*
* @param aLocalPath path of the folder whose uri we want.
* @return the URI of the folder that corresponds to aLocalPath
*/
- ACString folderUriForPath(in nsILocalFile aLocalPath);
+ ACString folderUriForPath(in nsIFile aLocalPath);
};
%{C++
#define MAILNEWS_ACCOUNTMANAGER_EXTENSIONS "mailnews-accountmanager-extensions"
%}
[scriptable, uuid(70032DE0-CD59-41ba-839D-FC1B65367EE7)]
interface nsIMsgAccountManagerExtension : nsISupports
--- a/mailnews/base/public/nsIMsgFolder.idl
+++ b/mailnews/base/public/nsIMsgFolder.idl
@@ -17,17 +17,17 @@ interface nsIMsgDatabase;
interface nsIDBFolderInfo;
interface nsIMsgFilterList;
interface nsIMsgFolderCacheElement;
interface nsITransport;
interface nsIFile;
interface nsIOutputStream;
interface nsIInputStream;
-interface nsILocalFile;
+interface nsIFile;
interface nsIMsgIdentity;
interface nsIArray;
interface nsIMutableArray;
interface nsISupportsArray;
interface nsIMsgPluggableStore;
typedef long nsMsgBiffState;
@@ -460,17 +460,17 @@ interface nsIMsgFolder : nsISupports {
/**
* are we running a url as a result of the user clicking get msg?
*/
attribute boolean gettingNewMessages;
/**
* local path of this folder
*/
- attribute nsILocalFile filePath;
+ attribute nsIFile filePath;
readonly attribute ACString baseMessageURI;
ACString generateMessageURI(in nsMsgKey msgKey);
const nsMsgDispositionState nsMsgDispositionState_None = -1;
const nsMsgDispositionState nsMsgDispositionState_Replied = 0;
const nsMsgDispositionState nsMsgDispositionState_Forwarded = 1;
void addMessageDispositionState(in nsIMsgDBHdr aMessage,
--- a/mailnews/base/public/nsIMsgIdentity.idl
+++ b/mailnews/base/public/nsIMsgIdentity.idl
@@ -1,15 +1,15 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
-#include "nsILocalFile.idl"
+#include "nsIFile.idl"
/**
* This interface contains all the personal outgoing mail information
* for a given person.
* Each identity is identified by a key, which is the <id> string in
* the identity preferences, such as in mail.identity.<id>.replyTo.
*/
[scriptable, uuid(4a769f39-f8c2-41e6-962a-175a33107578)]
@@ -84,17 +84,17 @@ interface nsIMsgIdentity : nsISupports {
/**
* Include a signature when replying to a message?
*/
attribute boolean sigOnReply;
/**
* The current signature file.
*/
- attribute nsILocalFile signature;
+ attribute nsIFile signature;
/**
* Modification time of the signature file.
*/
attribute long signatureDate;
/**
* Signature text if not read from file; format depends on htmlSigFormat.
--- a/mailnews/base/public/nsIMsgIncomingServer.idl
+++ b/mailnews/base/public/nsIMsgIncomingServer.idl
@@ -11,17 +11,17 @@ interface nsIMsgFolderCache;
interface nsIMsgWindow;
interface nsIMsgFilterList;
interface nsIMsgRetentionSettings;
interface nsIMsgDownloadSettings;
interface nsISpamSettings;
interface nsIMsgFilterPlugin;
interface nsIUrlListener;
interface nsIMsgDBHdr;
-interface nsILocalFile;
+interface nsIFile;
interface nsIURI;
interface nsIMsgPluggableStore;
/*
* Interface for incoming mail/news host
* this is the base interface for all mail server types (imap, pop, nntp, etc)
* often you will want to add extra interfaces that give you server-specific
* attributes and methods.
@@ -127,17 +127,17 @@ interface nsIMsgIncomingServer : nsISupp
/* current biff state */
attribute unsigned long biffState;
/* are we running a url as a result of biff going off? (different from user clicking get msg) */
attribute boolean performingBiff;
/* the on-disk path to message storage for this server */
- attribute nsILocalFile localPath;
+ attribute nsIFile localPath;
/// message store to use for the folders under this server.
readonly attribute nsIMsgPluggableStore msgStore;
/* the RDF URI for the root mail folder */
readonly attribute ACString serverURI;
/* the root folder for this server, even if server is deferred */
@@ -220,17 +220,17 @@ interface nsIMsgIncomingServer : nsISupp
* @see getEditableFilterList
* @see setFilterList
*
* @param aFilterList The new list of filters.
*/
void setEditableFilterList(in nsIMsgFilterList aFilterList);
/* we use this to set the default local path. we use this when migrating prefs */
- void setDefaultLocalPath(in nsILocalFile aDefaultLocalPath);
+ void setDefaultLocalPath(in nsIFile aDefaultLocalPath);
/**
* Verify that we can logon
*
* @param aUrlListener - gets called back with success or failure.
* @param aMsgWindow nsIMsgWindow to use for notification callbacks.
* @return - the url that we run.
*/
@@ -306,18 +306,18 @@ interface nsIMsgIncomingServer : nsISupp
* parameter. Callers must still provide a valid value, though.
*
* @param relpref The name of the relative file preference.
* @param absref The name of the absolute file preference.
* @param aValue The value of the preference to set.
* @return The value of the preference.
* @{
*/
- nsILocalFile getFileValue(in string relpref, in string abspref);
- void setFileValue(in string relpref, in string abspref, in nsILocalFile aValue);
+ nsIFile getFileValue(in string relpref, in string abspref);
+ void setFileValue(in string relpref, in string abspref, in nsIFile aValue);
/** @} */
/**
* this is really dangerous. this destroys all pref values
* do not call this unless you know what you're doing!
*/
void clearAllValues();
--- a/mailnews/base/public/nsIMsgPluggableStore.idl
+++ b/mailnews/base/public/nsIMsgPluggableStore.idl
@@ -1,16 +1,16 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
-interface nsILocalFile;
+interface nsIFile;
interface nsIMsgFolder;
interface nsIMsgCopyServiceListener;
interface nsIMsgDBHdr;
interface nsIMsgWindow;
interface nsISimpleEnumerator;
interface nsIOutputStream;
interface nsIInputStream;
interface nsIArray;
@@ -48,23 +48,23 @@ interface nsIMsgPluggableStore : nsISupp
* @param aFolderName leaf name of folder.
* @return newly created folder.
* @exception NS_MSG_FOLDER_EXISTS If the child exists.
* @exception NS_MSG_CANT_CREATE_FOLDER for other errors.
*/
nsIMsgFolder createFolder(in nsIMsgFolder aParent, in AString aFolderName);
/**
- * Get an nsILocalFile corresponding to the .msf file. This allows stores
+ * Get an nsIFile corresponding to the .msf file. This allows stores
* to put the .msf files where they want.
*
* @param aFolder folder we want summary file for
* @return summary file
*/
- nsILocalFile getSummaryFile(in nsIMsgFolder aFolder);
+ nsIFile getSummaryFile(in nsIMsgFolder aFolder);
/**
* Delete the passed in folder. This is a real delete, not a move
* to the trash folder.
*
* @param aFolder folder to delete
*/
void deleteFolder(in nsIMsgFolder aFolder);
--- a/mailnews/base/public/nsIMsgProtocolInfo.idl
+++ b/mailnews/base/public/nsIMsgProtocolInfo.idl
@@ -1,31 +1,31 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
-interface nsILocalFile;
+interface nsIFile;
%{C++
#define NS_MSGPROTOCOLINFO_CONTRACTID_PREFIX \
"@mozilla.org/messenger/protocol/info;1?type="
%}
[scriptable, uuid(9428b5f5-8b12-493c-aae2-18296c2877b0)]
interface nsIMsgProtocolInfo : nsISupports
{
/**
* the default path to store local data for this type of
* server. Each server is usually in a subdirectory below this
*/
- attribute nsILocalFile defaultLocalPath;
+ attribute nsIFile defaultLocalPath;
/**
* the IID of the protocol-specific interface for this server
* usually used from JS to dynamically get server-specific attributes
*/
readonly attribute nsIIDPtr serverIID;
/**
--- a/mailnews/base/search/public/nsIMsgFilterList.idl
+++ b/mailnews/base/search/public/nsIMsgFilterList.idl
@@ -59,17 +59,17 @@ interface nsIMsgFilterList : nsISupports
nsIMsgFilter createFilter(in AString name);
void saveToFile(in nsIOutputStream stream);
void parseCondition(in nsIMsgFilter aFilter, in string condition);
// this is temporary so that we can save the filterlist to disk
// without knowing where the filters were read from intially
// (such as the filter list dialog)
- attribute nsILocalFile defaultFile;
+ attribute nsIFile defaultFile;
void saveToDefaultFile();
// marking noscript because headers is a null-separated list
// of strings, which is not scriptable
[noscript]
void applyFiltersToHdr(in nsMsgFilterTypeType filterType,
in nsIMsgDBHdr msgHdr,
--- a/mailnews/base/search/public/nsIMsgFilterPlugin.idl
+++ b/mailnews/base/search/public/nsIMsgFilterPlugin.idl
@@ -6,17 +6,17 @@
#include "nsISupports.idl"
#include "MailNewsTypes2.idl"
interface nsIMsgFilterHitNotify;
interface nsIMsgWindow;
interface nsIMsgDBHdr;
interface nsIStreamListener;
-interface nsILocalFile;
+interface nsIFile;
/**
* This interface is still very much under development, and is not yet stable.
*/
[scriptable, uuid(e2e56690-a676-11d6-80c9-00008646b737)]
interface nsIMsgFilterPlugin : nsISupports
{
@@ -318,17 +318,17 @@ interface nsIMsgCorpus : nsISupports
* @param aFromTraits array of trait ids used in aFile. If aFile contains
* trait ids that are not in this array, they are not
* remapped, but assummed to be local trait ids.
*
* @param aToTraits array of trait ids, corresponding to elements of
* aFromTraits, that represent the local trait ids to
* be used in storing data from aFile into the local corpus.
*/
- void updateData(in nsILocalFile aFile, in boolean aIsAdd,
+ void updateData(in nsIFile aFile, in boolean aIsAdd,
[optional] in unsigned long aRemapCount,
[optional, array, size_is(aRemapCount)] in unsigned long aFromTraits,
[optional, array, size_is(aRemapCount)] in unsigned long aToTraits);
/**
* Get the corpus count for a token as a string.
*
* @param aWord string of characters representing the token
--- a/mailnews/base/search/public/nsIMsgFilterService.idl
+++ b/mailnews/base/search/public/nsIMsgFilterService.idl
@@ -5,29 +5,29 @@
#include "nsISupports.idl"
#include "nsMsgFilterCore.idl"
interface nsIMsgFilterList;
interface nsIMsgWindow;
interface nsIMsgFilterCustomAction;
interface nsISimpleEnumerator;
-interface nsILocalFile;
+interface nsIFile;
interface nsIMsgFolder;
interface nsISupportsArray;
interface nsIMsgSearchCustomTerm;
[scriptable, uuid(C1A5F1BB-4D6C-447a-B70F-A12BE767DC0A)]
interface nsIMsgFilterService : nsISupports {
- nsIMsgFilterList OpenFilterList(in nsILocalFile filterFile, in nsIMsgFolder rootFolder, in nsIMsgWindow msgWindow);
+ nsIMsgFilterList OpenFilterList(in nsIFile filterFile, in nsIMsgFolder rootFolder, in nsIMsgWindow msgWindow);
void CloseFilterList(in nsIMsgFilterList filterList);
void SaveFilterList(in nsIMsgFilterList filterList,
- in nsILocalFile filterFile);
+ in nsIFile filterFile);
void CancelFilterList(in nsIMsgFilterList filterList);
nsIMsgFilterList getTempFilterList(in nsIMsgFolder aFolder);
void applyFiltersToFolders(in nsIMsgFilterList aFilterList, in nsISupportsArray aFolders, in nsIMsgWindow aMsgWindow);
/*
* Apply filters to a specific list of messages in a folder.
* @param aFilterType The type of filter to match against
--- a/mailnews/base/search/public/nsIMsgSearchScopeTerm.idl
+++ b/mailnews/base/search/public/nsIMsgSearchScopeTerm.idl
@@ -1,16 +1,16 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIMsgSearchSession.idl"
-interface nsILocalFile;
+interface nsIFile;
interface nsIMsgFolder;
interface nsIMsgDBHdr;
interface nsILineInputStream;
[scriptable, uuid(934672c3-9b8f-488a-935d-87b4023fa0be)]
interface nsIMsgSearchScopeTerm : nsISupports {
nsIInputStream getInputStream(in nsIMsgDBHdr aHdr);
void closeInputStream();
--- a/mailnews/base/search/public/nsMsgBodyHandler.h
+++ b/mailnews/base/search/public/nsMsgBodyHandler.h
@@ -55,17 +55,17 @@ protected:
// local / POP related methods
void OpenLocalFolder();
// goes through the mail folder
PRInt32 GetNextLocalLine(nsCString &buf);
nsIMsgSearchScopeTerm *m_scope;
nsCOMPtr <nsILineInputStream> m_fileLineStream;
- nsCOMPtr <nsILocalFile> m_localFile;
+ nsCOMPtr <nsIFile> m_localFile;
/**
* The number of lines in the message. If |m_lineCountInBodyLines| then this
* is the number of body lines, otherwise this is the entire number of lines
* in the message. This is important so we know when to stop reading the file
* without accidentally reading part of the next message.
*/
PRUint32 m_numLocalLines;
--- a/mailnews/base/search/src/nsMsgBodyHandler.cpp
+++ b/mailnews/base/search/src/nsMsgBodyHandler.cpp
@@ -7,17 +7,17 @@
#include "nsMsgSearchCore.h"
#include "nsMsgUtils.h"
#include "nsMsgBodyHandler.h"
#include "nsMsgSearchTerm.h"
#include "nsIMsgHdr.h"
#include "nsMsgMessageFlags.h"
#include "nsISeekableStream.h"
#include "nsIInputStream.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "plbase64.h"
#include "prmem.h"
nsMsgBodyHandler::nsMsgBodyHandler (nsIMsgSearchScopeTerm * scope,
PRUint32 numLines,
nsIMsgDBHdr* msg, nsIMsgDatabase * db)
{
m_scope = scope;
--- a/mailnews/base/search/src/nsMsgFilterList.cpp
+++ b/mailnews/base/search/src/nsMsgFilterList.cpp
@@ -88,17 +88,17 @@ NS_IMETHODIMP nsMsgFilterList::SaveToFil
{
if (!stream)
return NS_ERROR_NULL_POINTER;
return SaveTextFilters(stream);
}
NS_IMETHODIMP nsMsgFilterList::EnsureLogFile()
{
- nsCOMPtr <nsILocalFile> file;
+ nsCOMPtr <nsIFile> file;
nsresult rv = GetLogFile(getter_AddRefs(file));
NS_ENSURE_SUCCESS(rv,rv);
bool exists;
rv = file->Exists(&exists);
if (NS_SUCCEEDED(rv) && !exists) {
rv = file->Create(nsIFile::NORMAL_FILE_TYPE, 0644);
NS_ENSURE_SUCCESS(rv,rv);
@@ -107,17 +107,17 @@ NS_IMETHODIMP nsMsgFilterList::EnsureLog
}
nsresult nsMsgFilterList::TruncateLog()
{
// this will flush and close the steam
nsresult rv = SetLogStream(nsnull);
NS_ENSURE_SUCCESS(rv,rv);
- nsCOMPtr <nsILocalFile> file;
+ nsCOMPtr <nsIFile> file;
rv = GetLogFile(getter_AddRefs(file));
NS_ENSURE_SUCCESS(rv,rv);
file->Remove(false);
rv = file->Create(nsIFile::NORMAL_FILE_TYPE, 0644);
NS_ENSURE_SUCCESS(rv,rv);
return rv;
}
@@ -136,17 +136,17 @@ NS_IMETHODIMP nsMsgFilterList::ClearLog(
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to truncate filter log");
m_loggingEnabled = loggingEnabled;
return NS_OK;
}
nsresult
-nsMsgFilterList::GetLogFile(nsILocalFile **aFile)
+nsMsgFilterList::GetLogFile(nsIFile **aFile)
{
NS_ENSURE_ARG_POINTER(aFile);
// XXX todo
// the path to the log file won't change
// should we cache it?
nsCOMPtr <nsIMsgFolder> folder;
nsresult rv = GetFolder(getter_AddRefs(folder));
@@ -167,21 +167,21 @@ nsMsgFilterList::GetLogFile(nsILocalFile
// for news folders (not servers), the filter file is
// mcom.test.dat
// where the summary file is
// mcom.test.msf
// since the log is an html file we make it
// mcom.test.htm
if (type.Equals("nntp") && !isServer)
{
- nsCOMPtr<nsILocalFile> thisFolder;
+ nsCOMPtr<nsIFile> thisFolder;
rv = m_folder->GetFilePath(getter_AddRefs(thisFolder));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> filterLogFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr<nsIFile> filterLogFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = filterLogFile->InitWithFile(thisFolder);
NS_ENSURE_SUCCESS(rv, rv);
// NOTE:
// we don't we need to call NS_MsgHashIfNecessary()
// it's already been hashed, if necessary
nsAutoString filterLogName;
@@ -203,17 +203,17 @@ nsMsgFilterList::GetLogFile(nsILocalFile
NS_ENSURE_SUCCESS(rv,rv);
}
return NS_OK;
}
NS_IMETHODIMP
nsMsgFilterList::GetLogURL(nsACString &aLogURL)
{
- nsCOMPtr <nsILocalFile> file;
+ nsCOMPtr <nsIFile> file;
nsresult rv = GetLogFile(getter_AddRefs(file));
NS_ENSURE_SUCCESS(rv,rv);
rv = NS_GetURLSpecFromFile(file, aLogURL);
NS_ENSURE_SUCCESS(rv,rv);
return !aLogURL.IsEmpty() ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
@@ -238,17 +238,17 @@ nsMsgFilterList::SetLogStream(nsIOutputS
NS_IMETHODIMP
nsMsgFilterList::GetLogStream(nsIOutputStream **aLogStream)
{
NS_ENSURE_ARG_POINTER(aLogStream);
nsresult rv;
if (!m_logStream) {
- nsCOMPtr <nsILocalFile> logFile;
+ nsCOMPtr <nsIFile> logFile;
rv = GetLogFile(getter_AddRefs(logFile));
NS_ENSURE_SUCCESS(rv,rv);
// append to the end of the log file
rv = MsgNewBufferedFileOutputStream(getter_AddRefs(m_logStream),
logFile,
PR_CREATE_FILE | PR_WRONLY | PR_APPEND,
0600);
@@ -328,24 +328,24 @@ nsMsgFilterList::ApplyFiltersToHdr(nsMsg
}
}
}
scope->Release();
return rv;
}
NS_IMETHODIMP
-nsMsgFilterList::SetDefaultFile(nsILocalFile *aFile)
+nsMsgFilterList::SetDefaultFile(nsIFile *aFile)
{
m_defaultFile = aFile;
return NS_OK;
}
NS_IMETHODIMP
-nsMsgFilterList::GetDefaultFile(nsILocalFile **aResult)
+nsMsgFilterList::GetDefaultFile(nsIFile **aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
NS_IF_ADDREF(*aResult = m_defaultFile);
return NS_OK;
}
NS_IMETHODIMP
--- a/mailnews/base/search/src/nsMsgFilterList.h
+++ b/mailnews/base/search/src/nsMsgFilterList.h
@@ -6,17 +6,17 @@
#ifndef _nsMsgFilterList_H_
#define _nsMsgFilterList_H_
#include "nscore.h"
#include "nsIMsgFolder.h"
#include "nsIMsgFilterList.h"
#include "nsCOMPtr.h"
#include "nsISupportsArray.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIOutputStream.h"
const PRInt16 kFileVersion = 9;
const PRInt16 kManualContextVersion = 9;
const PRInt16 k60Beta1Version = 7;
const PRInt16 k45Version = 6;
@@ -63,21 +63,21 @@ protected:
PRInt16 m_fileVersion;
bool m_loggingEnabled;
bool m_startWritingToBuffer; //tells us when to start writing one whole filter to m_unparsedBuffer
nsCOMPtr <nsIMsgFolder> m_folder;
nsMsgFilter *m_curFilter; // filter we're filing in or out(?)
nsCString m_filterFileName;
nsCOMPtr<nsISupportsArray> m_filters;
nsCString m_arbitraryHeaders;
- nsCOMPtr<nsILocalFile> m_defaultFile;
+ nsCOMPtr<nsIFile> m_defaultFile;
nsCString m_unparsedFilterBuffer; //holds one entire filter unparsed
private:
nsresult TruncateLog();
- nsresult GetLogFile(nsILocalFile **aFile);
+ nsresult GetLogFile(nsIFile **aFile);
nsCOMPtr<nsIOutputStream> m_logStream;
};
#endif
--- a/mailnews/base/search/src/nsMsgFilterService.cpp
+++ b/mailnews/base/search/src/nsMsgFilterService.cpp
@@ -44,17 +44,17 @@ NS_IMPL_ISUPPORTS1(nsMsgFilterService, n
nsMsgFilterService::nsMsgFilterService()
{
}
nsMsgFilterService::~nsMsgFilterService()
{
}
-NS_IMETHODIMP nsMsgFilterService::OpenFilterList(nsILocalFile *aFilterFile, nsIMsgFolder *rootFolder, nsIMsgWindow *aMsgWindow, nsIMsgFilterList **resultFilterList)
+NS_IMETHODIMP nsMsgFilterService::OpenFilterList(nsIFile *aFilterFile, nsIMsgFolder *rootFolder, nsIMsgWindow *aMsgWindow, nsIMsgFilterList **resultFilterList)
{
NS_ENSURE_ARG_POINTER(aFilterFile);
nsresult rv;
bool exists;
aFilterFile->Exists(&exists);
if (!exists)
{
@@ -113,17 +113,17 @@ NS_IMETHODIMP nsMsgFilterService::OpenFi
NS_IMETHODIMP nsMsgFilterService::CloseFilterList(nsIMsgFilterList *filterList)
{
//NS_ASSERTION(false,"CloseFilterList doesn't do anything yet");
return NS_OK;
}
/* save without deleting */
-NS_IMETHODIMP nsMsgFilterService::SaveFilterList(nsIMsgFilterList *filterList, nsILocalFile *filterFile)
+NS_IMETHODIMP nsMsgFilterService::SaveFilterList(nsIMsgFilterList *filterList, nsIFile *filterFile)
{
NS_ENSURE_ARG_POINTER(filterFile);
NS_ENSURE_ARG_POINTER(filterList);
nsCOMPtr<nsIOutputStream> out;
nsresult rv = NS_NewSafeLocalFileOutputStream(getter_AddRefs(out),
filterFile, -1, 0600);
NS_ENSURE_SUCCESS(rv, rv);
@@ -143,17 +143,17 @@ NS_IMETHODIMP nsMsgFilterService::SaveF
return rv;
}
NS_IMETHODIMP nsMsgFilterService::CancelFilterList(nsIMsgFilterList *filterList)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
-nsresult nsMsgFilterService::BackUpFilterFile(nsILocalFile *aFilterFile, nsIMsgWindow *aMsgWindow)
+nsresult nsMsgFilterService::BackUpFilterFile(nsIFile *aFilterFile, nsIMsgWindow *aMsgWindow)
{
AlertBackingUpFilterFile(aMsgWindow);
nsCOMPtr<nsIFile> localParentDir;
nsresult rv = aFilterFile->GetParent(getter_AddRefs(localParentDir));
NS_ENSURE_SUCCESS(rv,rv);
//if back-up file exists delete the back up file otherwise copy fails.
--- a/mailnews/base/search/src/nsMsgFilterService.h
+++ b/mailnews/base/search/src/nsMsgFilterService.h
@@ -24,17 +24,17 @@ public:
virtual ~nsMsgFilterService();
NS_DECL_ISUPPORTS
NS_DECL_NSIMSGFILTERSERVICE
/* clients call OpenFilterList to get a handle to a FilterList, of existing nsMsgFilter *.
These are manipulated by the front end as a result of user interaction
with dialog boxes. To apply the new list call MSG_CloseFilterList.
*/
- nsresult BackUpFilterFile(nsILocalFile *aFilterFile, nsIMsgWindow *aMsgWindow);
+ nsresult BackUpFilterFile(nsIFile *aFilterFile, nsIMsgWindow *aMsgWindow);
nsresult AlertBackingUpFilterFile(nsIMsgWindow *aMsgWindow);
nsresult ThrowAlertMsg(const char*aMsgName, nsIMsgWindow *aMsgWindow);
nsresult GetStringFromBundle(const char *aMsgName, PRUnichar **aResult);
nsresult GetFilterStringBundle(nsIStringBundle **aBundle);
protected:
nsCOMArray<nsIMsgFilterCustomAction> mCustomActions; // defined custom action list
nsCOMArray<nsIMsgSearchCustomTerm> mCustomTerms; // defined custom term list
--- a/mailnews/base/search/src/nsMsgSearchTerm.cpp
+++ b/mailnews/base/search/src/nsMsgSearchTerm.cpp
@@ -20,17 +20,17 @@
#include "nsMsgSearchNews.h"
#include "nsMsgSearchValue.h"
#include "nsMsgI18N.h"
#include "nsIMimeConverter.h"
#include "nsMsgMimeCID.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIMsgFilterPlugin.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsISupportsObsolete.h"
#include "nsISeekableStream.h"
#include "nsNetCID.h"
#include "nsIFileStreams.h"
#include "nsUnicharUtils.h"
#include "nsIAbCard.h"
#include "nsServiceManagerUtils.h"
#include "nsComponentManagerUtils.h"
--- a/mailnews/base/src/nsMessenger.cpp
+++ b/mailnews/base/src/nsMessenger.cpp
@@ -6,17 +6,17 @@
#include "prsystem.h"
#include "nsMessenger.h"
// xpcom
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIStringStream.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsDirectoryServiceDefs.h"
#include "nsISupportsObsolete.h"
#include "nsQuickSort.h"
#include "nsAutoPtr.h"
#if defined(XP_MACOSX) && !defined(__LP64__)
#include "nsIAppleFileDecoder.h"
#include "nsILocalFileMac.h"
#endif
@@ -311,17 +311,17 @@ NS_IMETHODIMP nsMessenger::SetDisplayCha
mCurrentDisplayCharset = aCharset;
}
}
return NS_OK;
}
nsresult
-nsMessenger::PromptIfFileExists(nsILocalFile *file)
+nsMessenger::PromptIfFileExists(nsIFile *file)
{
nsresult rv = NS_ERROR_FAILURE;
bool exists;
file->Exists(&exists);
if (exists)
{
nsCOMPtr<nsIPrompt> dialog(do_GetInterface(mDocShell));
if (!dialog) return rv;
@@ -347,17 +347,17 @@ nsMessenger::PromptIfFileExists(nsILocal
if (dialogResult)
{
return NS_OK; // user says okay to replace
}
else
{
// if we don't re-init the path for redisplay the picker will
// show the full path, not just the file name
- nsCOMPtr<nsILocalFile> currentFile = do_CreateInstance("@mozilla.org/file/local;1");
+ nsCOMPtr<nsIFile> currentFile = do_CreateInstance("@mozilla.org/file/local;1");
if (!currentFile) return NS_ERROR_FAILURE;
rv = currentFile->InitWithPath(path);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString leafName;
currentFile->GetLeafName(leafName);
if (!leafName.IsEmpty())
@@ -369,33 +369,33 @@ nsMessenger::PromptIfFileExists(nsILocal
nsString saveAttachmentStr;
GetString(NS_LITERAL_STRING("SaveAttachment"), saveAttachmentStr);
filePicker->Init(mWindow,
saveAttachmentStr,
nsIFilePicker::modeSave);
filePicker->SetDefaultString(path);
filePicker->AppendFilters(nsIFilePicker::filterAll);
- nsCOMPtr <nsILocalFile> lastSaveDir;
+ nsCOMPtr <nsIFile> lastSaveDir;
rv = GetLastSaveDirectory(getter_AddRefs(lastSaveDir));
if (NS_SUCCEEDED(rv) && lastSaveDir) {
filePicker->SetDisplayDirectory(lastSaveDir);
}
PRInt16 dialogReturn;
rv = filePicker->Show(&dialogReturn);
if (NS_FAILED(rv) || dialogReturn == nsIFilePicker::returnCancel) {
// XXX todo
// don't overload the return value like this
// change this function to have an out boolean
// that we check to see if the user cancelled
return NS_ERROR_FAILURE;
}
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
rv = filePicker->GetFile(getter_AddRefs(localFile));
NS_ENSURE_SUCCESS(rv, rv);
rv = SetLastSaveDirectory(localFile);
NS_ENSURE_SUCCESS(rv,rv);
// reset the file to point to the new path
@@ -597,21 +597,18 @@ nsMessenger::DetachAttachmentsWOPrompts(
NS_ENSURE_ARG_POINTER(aDestFolder);
NS_ENSURE_ARG_POINTER(aContentTypeArray);
NS_ENSURE_ARG_POINTER(aUrlArray);
NS_ENSURE_ARG_POINTER(aMessageUriArray);
NS_ENSURE_ARG_POINTER(aDisplayNameArray);
if (!aCount)
return NS_OK;
nsSaveAllAttachmentsState *saveState;
- nsCOMPtr<nsIFile> clone;
- nsresult rv = aDestFolder->Clone(getter_AddRefs(clone));
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsILocalFile> attachmentDestination(do_QueryInterface(clone, &rv));
+ nsCOMPtr<nsIFile> attachmentDestination;
+ nsresult rv = aDestFolder->Clone(getter_AddRefs(attachmentDestination));
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString path;
rv = attachmentDestination->GetNativePath(path);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString unescapedFileName;
ConvertAndSanitizeFileName(aDisplayNameArray[0], unescapedFileName);
@@ -758,27 +755,25 @@ nsMessenger::OpenAttachment(const nsACSt
mDocShell, mMsgWindow, nsnull);
}
return rv;
}
NS_IMETHODIMP
nsMessenger::SaveAttachmentToFolder(const nsACString& contentType, const nsACString& url, const nsACString& displayName,
- const nsACString& messageUri, nsILocalFile * aDestFolder, nsILocalFile ** aOutFile)
+ const nsACString& messageUri, nsIFile * aDestFolder, nsIFile ** aOutFile)
{
NS_ENSURE_ARG_POINTER(aDestFolder);
nsresult rv;
- nsCOMPtr<nsIFile> clone;
- rv = aDestFolder->Clone(getter_AddRefs(clone));
+ nsCOMPtr<nsIFile> attachmentDestination;
+ rv = aDestFolder->Clone(getter_AddRefs(attachmentDestination));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> attachmentDestination = do_QueryInterface(clone);
-
nsString unescapedFileName;
ConvertAndSanitizeFileName(PromiseFlatCString(displayName).get(), unescapedFileName);
rv = attachmentDestination->Append(unescapedFileName);
NS_ENSURE_SUCCESS(rv, rv);
#ifdef XP_MACOSX
rv = attachmentDestination->CreateUnique(nsIFile::NORMAL_FILE_TYPE, ATTACHMENT_PERMISSION);
NS_ENSURE_SUCCESS(rv, rv);
#endif
@@ -809,18 +804,18 @@ nsMessenger::SaveOneAttachment(const cha
bool detaching)
{
nsresult rv = NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIFilePicker> filePicker =
do_CreateInstance("@mozilla.org/filepicker;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
PRInt16 dialogResult;
- nsCOMPtr<nsILocalFile> localFile;
- nsCOMPtr<nsILocalFile> lastSaveDir;
+ nsCOMPtr<nsIFile> localFile;
+ nsCOMPtr<nsIFile> lastSaveDir;
nsCString filePath;
nsString saveAttachmentStr;
nsString defaultDisplayString;
ConvertAndSanitizeFileName(aDisplayName, defaultDisplayString);
GetString(NS_LITERAL_STRING("SaveAttachment"), saveAttachmentStr);
filePicker->Init(mWindow, saveAttachmentStr,
nsIFilePicker::modeSave);
@@ -876,18 +871,18 @@ nsMessenger::SaveAllAttachments(PRUint32
const char **urlArray,
const char **displayNameArray,
const char **messageUriArray,
bool detaching)
{
nsresult rv = NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIFilePicker> filePicker =
do_CreateInstance("@mozilla.org/filepicker;1", &rv);
- nsCOMPtr<nsILocalFile> localFile;
- nsCOMPtr<nsILocalFile> lastSaveDir;
+ nsCOMPtr<nsIFile> localFile;
+ nsCOMPtr<nsIFile> lastSaveDir;
PRInt16 dialogResult;
nsString saveAttachmentStr;
NS_ENSURE_SUCCESS(rv, rv);
GetString(NS_LITERAL_STRING("SaveAllAttachments"), saveAttachmentStr);
filePicker->Init(mWindow,
saveAttachmentStr,
nsIFilePicker::modeGetFolder);
@@ -955,17 +950,17 @@ nsMessenger::SaveAs(const nsACString& aU
PRInt32 saveAsFileType = EML_FILE_TYPE;
nsresult rv = GetMessageServiceFromURI(aURI, getter_AddRefs(messageService));
if (NS_FAILED(rv))
goto done;
if (aAsFile)
{
- nsCOMPtr<nsILocalFile> saveAsFile;
+ nsCOMPtr<nsIFile> saveAsFile;
// show the file picker if BypassFilePicker is not specified (null) or false
if (!aBypassFilePicker) {
rv = GetSaveAsFile(aMsgFilename, &saveAsFileType, getter_AddRefs(saveAsFile));
// A null saveAsFile means that the user canceled the save as
if (NS_FAILED(rv) || !saveAsFile)
goto done;
}
else {
@@ -1058,24 +1053,23 @@ nsMessenger::SaveAs(const nsACString& aU
rv = messageService->DisplayMessage(urlString.get(), convertedListener, mMsgWindow,
nsnull, nsnull, nsnull);
}
}
else
{
// ** save as Template
- nsCOMPtr <nsIFile> tmpTempFile;
+ nsCOMPtr <nsIFile> tmpFile;
nsresult rv = GetSpecialDirectoryWithFileName(NS_OS_TEMP_DIR,
"nsmail.tmp",
- getter_AddRefs(tmpTempFile));
+ getter_AddRefs(tmpFile));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr <nsILocalFile> tmpFile = do_QueryInterface(tmpTempFile, &rv);
// For temp file, we should use restrictive 00600 instead of ATTACHMENT_PERMISSION
rv = tmpFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 00600);
if (NS_FAILED(rv)) goto done;
// The saveListener is owned by whoever we ultimately register the
// listener with, generally a URL.
saveListener = new nsSaveMsgListener(tmpFile, this, nsnull);
if (!saveListener) {
@@ -1109,17 +1103,17 @@ done:
NS_IF_RELEASE(saveListener);
Alert("saveMessageFailed");
}
return rv;
}
nsresult
nsMessenger::GetSaveAsFile(const nsAString& aMsgFilename, PRInt32 *aSaveAsFileType,
- nsILocalFile **aSaveAsFile)
+ nsIFile **aSaveAsFile)
{
nsresult rv;
nsCOMPtr<nsIFilePicker> filePicker = do_CreateInstance("@mozilla.org/filepicker;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsString saveMailAsStr;
GetString(NS_LITERAL_STRING("SaveMailAs"), saveMailAsStr);
filePicker->Init(mWindow, saveMailAsStr, nsIFilePicker::modeSave);
@@ -1153,22 +1147,22 @@ nsMessenger::GetSaveAsFile(const nsAStri
// Yes, this is fine even if we ultimately save as HTML or text. On Windows,
// this actually is a boolean telling the file picker to automatically add
// the correct extension depending on the filter. On Mac or Linux this is a
// no-op.
filePicker->SetDefaultExtension(NS_LITERAL_STRING("eml"));
PRInt16 dialogResult;
- nsCOMPtr <nsILocalFile> lastSaveDir;
+ nsCOMPtr <nsIFile> lastSaveDir;
rv = GetLastSaveDirectory(getter_AddRefs(lastSaveDir));
if (NS_SUCCEEDED(rv) && lastSaveDir)
filePicker->SetDisplayDirectory(lastSaveDir);
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
rv = filePicker->Show(&dialogResult);
NS_ENSURE_SUCCESS(rv, rv);
if (dialogResult == nsIFilePicker::returnCancel)
{
// We'll indicate this by setting the outparam to null.
*aSaveAsFile = nsnull;
return NS_OK;
}
@@ -1230,42 +1224,42 @@ nsMessenger::GetSaveAsFile(const nsAStri
}
/**
* Show a Save All dialog allowing the user to pick which folder to save
* messages to.
* @param [out] aSaveDir directory to save to. Will be null on cancel.
*/
nsresult
-nsMessenger::GetSaveToDir(nsILocalFile **aSaveDir)
+nsMessenger::GetSaveToDir(nsIFile **aSaveDir)
{
nsresult rv;
nsCOMPtr<nsIFilePicker> filePicker =
do_CreateInstance("@mozilla.org/filepicker;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsString chooseFolderStr;
GetString(NS_LITERAL_STRING("ChooseFolder"), chooseFolderStr);
filePicker->Init(mWindow, chooseFolderStr, nsIFilePicker::modeGetFolder);
- nsCOMPtr<nsILocalFile> lastSaveDir;
+ nsCOMPtr<nsIFile> lastSaveDir;
rv = GetLastSaveDirectory(getter_AddRefs(lastSaveDir));
if (NS_SUCCEEDED(rv) && lastSaveDir)
filePicker->SetDisplayDirectory(lastSaveDir);
PRInt16 dialogResult;
rv = filePicker->Show(&dialogResult);
if (NS_FAILED(rv) || dialogResult == nsIFilePicker::returnCancel)
{
// We'll indicate this by setting the outparam to null.
*aSaveDir = nsnull;
return NS_OK;
}
- nsCOMPtr<nsILocalFile> dir;
+ nsCOMPtr<nsIFile> dir;
rv = filePicker->GetFile(getter_AddRefs(dir));
NS_ENSURE_SUCCESS(rv, rv);
rv = SetLastSaveDirectory(dir);
NS_ENSURE_SUCCESS(rv, rv);
*aSaveDir = nsnull;
dir.swap(*aSaveDir);
@@ -1278,27 +1272,27 @@ nsMessenger::SaveMessages(PRUint32 aCoun
const char **aMessageUriArray)
{
NS_ENSURE_ARG_MIN(aCount, 1);
NS_ENSURE_ARG_POINTER(aFilenameArray);
NS_ENSURE_ARG_POINTER(aMessageUriArray);
nsresult rv;
- nsCOMPtr<nsILocalFile> saveDir;
+ nsCOMPtr<nsIFile> saveDir;
rv = GetSaveToDir(getter_AddRefs(saveDir));
NS_ENSURE_SUCCESS(rv, rv);
if (!saveDir) // A null saveDir means that the user canceled the save.
return NS_OK;
for (PRUint32 i = 0; i < aCount; i++) {
if (!aFilenameArray[i]) // just to be sure
return NS_ERROR_FAILURE;
- nsCOMPtr<nsILocalFile> saveToFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr<nsIFile> saveToFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = saveToFile->InitWithFile(saveDir);
NS_ENSURE_SUCCESS(rv, rv);
rv = saveToFile->Append(nsDependentString(aFilenameArray[i]));
NS_ENSURE_SUCCESS(rv, rv);
rv = PromptIfFileExists(saveToFile);
@@ -1698,40 +1692,38 @@ nsresult nsSaveMsgListener::InitializeDo
if (!m_contentType.IsEmpty())
{
nsCOMPtr<nsIMIMEService> mimeService (do_GetService(NS_MIMESERVICE_CONTRACTID));
nsCOMPtr<nsIMIMEInfo> mimeinfo;
mimeService->GetFromTypeAndExtension(m_contentType, EmptyCString(), getter_AddRefs(mimeinfo));
- nsCOMPtr<nsILocalFile> outputFile = do_QueryInterface(m_file);
-
// create a download progress window
// We don't want to show the progress dialog if the download is really small.
// but what is a small download? Well that's kind of arbitrary
// so make an arbitrary decision based on the content length of the
// attachment -- show it if less than half of the download has completed
// When we don't allow warnings, also don't show progress, as this
// is an environment (typically filters) where we don't want
// interruption.
bool allowProgress = true;
if (m_saveAllAttachmentsState)
allowProgress = !m_saveAllAttachmentsState->m_withoutWarning;
if (allowProgress && mMaxProgress != -1 &&
mMaxProgress > aBytesDownloaded * 2)
{
nsCOMPtr<nsITransfer> tr = do_CreateInstance(NS_TRANSFER_CONTRACTID, &rv);
- if (tr && outputFile)
+ if (tr && m_file)
{
PRTime timeDownloadStarted = PR_Now();
nsCOMPtr<nsIURI> outputURI;
- NS_NewFileURI(getter_AddRefs(outputURI), outputFile);
+ NS_NewFileURI(getter_AddRefs(outputURI), m_file);
nsCOMPtr<nsIURI> url;
channel->GetURI(getter_AddRefs(url));
rv = tr->Init(url, outputURI, EmptyString(), mimeinfo,
timeDownloadStarted, nsnull, this);
// now store the web progresslistener
mTransfer = tr;
@@ -1741,17 +1733,17 @@ nsresult nsSaveMsgListener::InitializeDo
#if defined(XP_MACOSX) && !defined(__LP64__)
/* if we are saving an appledouble or applesingle attachment, we need to use an Apple File Decoder */
if (MsgLowerCaseEqualsLiteral(m_contentType, APPLICATION_APPLEFILE) ||
MsgLowerCaseEqualsLiteral(m_contentType, MULTIPART_APPLEDOUBLE))
{
nsCOMPtr<nsIAppleFileDecoder> appleFileDecoder = do_CreateInstance(NS_IAPPLEFILEDECODER_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && appleFileDecoder)
{
- rv = appleFileDecoder->Initialize(m_outputStream, outputFile);
+ rv = appleFileDecoder->Initialize(m_outputStream, m_file);
if (NS_SUCCEEDED(rv))
m_outputStream = do_QueryInterface(appleFileDecoder, &rv);
}
}
#endif // XP_MACOSX
}
return rv;
}
@@ -1818,17 +1810,17 @@ nsSaveMsgListener::OnStopRequest(nsIRequ
if (m_saveAllAttachmentsState)
{
m_saveAllAttachmentsState->m_curIndex++;
if (!mCanceled && m_saveAllAttachmentsState->m_curIndex < m_saveAllAttachmentsState->m_count)
{
nsSaveAllAttachmentsState *state = m_saveAllAttachmentsState;
PRUint32 i = state->m_curIndex;
nsString unescapedName;
- nsCOMPtr<nsILocalFile> localFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr<nsIFile> localFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
if (NS_FAILED(rv)) goto done;
rv = localFile->InitWithNativePath(nsDependentCString(state->m_directoryName));
if (NS_FAILED(rv)) goto done;
ConvertAndSanitizeFileName(state->m_displayNameArray[i], unescapedName);
rv = localFile->Append(unescapedName);
if (NS_FAILED(rv))
@@ -2020,60 +2012,57 @@ nsSaveAllAttachmentsState::~nsSaveAllAtt
delete[] m_contentTypeArray;
delete[] m_urlArray;
delete[] m_displayNameArray;
delete[] m_messageUriArray;
NS_Free(m_directoryName);
}
nsresult
-nsMessenger::GetLastSaveDirectory(nsILocalFile **aLastSaveDir)
+nsMessenger::GetLastSaveDirectory(nsIFile **aLastSaveDir)
{
nsresult rv;
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv,rv);
// this can fail, and it will, on the first time we call it, as there is no default for this pref.
- nsCOMPtr <nsILocalFile> localFile;
- rv = prefBranch->GetComplexValue(MESSENGER_SAVE_DIR_PREF_NAME, NS_GET_IID(nsILocalFile), getter_AddRefs(localFile));
+ nsCOMPtr <nsIFile> localFile;
+ rv = prefBranch->GetComplexValue(MESSENGER_SAVE_DIR_PREF_NAME, NS_GET_IID(nsIFile), getter_AddRefs(localFile));
if (NS_SUCCEEDED(rv)) {
NS_IF_ADDREF(*aLastSaveDir = localFile);
}
return rv;
}
nsresult
-nsMessenger::SetLastSaveDirectory(nsILocalFile *aLocalFile)
+nsMessenger::SetLastSaveDirectory(nsIFile *aLocalFile)
{
nsresult rv;
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv,rv);
nsCOMPtr <nsIFile> file = do_QueryInterface(aLocalFile, &rv);
NS_ENSURE_SUCCESS(rv,rv);
// if the file is a directory, just use it for the last dir chosen
// otherwise, use the parent of the file as the last dir chosen.
// IsDirectory() will return error on saving a file, as the
// file doesn't exist yet.
bool isDirectory;
rv = file->IsDirectory(&isDirectory);
if (NS_SUCCEEDED(rv) && isDirectory) {
- rv = prefBranch->SetComplexValue(MESSENGER_SAVE_DIR_PREF_NAME, NS_GET_IID(nsILocalFile), aLocalFile);
+ rv = prefBranch->SetComplexValue(MESSENGER_SAVE_DIR_PREF_NAME, NS_GET_IID(nsIFile), aLocalFile);
NS_ENSURE_SUCCESS(rv,rv);
}
else {
nsCOMPtr <nsIFile> parent;
rv = file->GetParent(getter_AddRefs(parent));
NS_ENSURE_SUCCESS(rv,rv);
- nsCOMPtr <nsILocalFile> parentLocalFile = do_QueryInterface(parent, &rv);
- NS_ENSURE_SUCCESS(rv,rv);
-
- rv = prefBranch->SetComplexValue(MESSENGER_SAVE_DIR_PREF_NAME, NS_GET_IID(nsILocalFile), parentLocalFile);
+ rv = prefBranch->SetComplexValue(MESSENGER_SAVE_DIR_PREF_NAME, NS_GET_IID(nsIFile), parent);
NS_ENSURE_SUCCESS(rv,rv);
}
return NS_OK;
}
/* void getUrisAtNavigatePos (in long aPos, out ACString aFolderUri, out ACString aMsgUri); */
// aPos is relative to the current history cursor - 1 is forward, -1 is back.
NS_IMETHODIMP nsMessenger::GetMsgUriAtNavigatePos(PRInt32 aPos, nsACString& aMsgUri)
--- a/mailnews/base/src/nsMessenger.h
+++ b/mailnews/base/src/nsMessenger.h
@@ -5,20 +5,20 @@
#ifndef __nsMsgAppCore_h
#define __nsMsgAppCore_h
#include "nscore.h"
#include "nsIMessenger.h"
#include "nsCOMPtr.h"
#include "nsITransactionManager.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIDocShell.h"
#include "nsIStringBundle.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsWeakReference.h"
#include "nsIDOMWindow.h"
class nsMessenger : public nsIMessenger, public nsSupportsWeakReference, public nsIFolderListener
{
public:
nsMessenger();
@@ -28,17 +28,17 @@ public:
NS_DECL_NSIMESSENGER
NS_DECL_NSIFOLDERLISTENER
nsresult Alert(const char * stringName);
nsresult SaveAttachment(nsIFile *file, const nsACString& unescapedUrl,
const nsACString& messageUri, const nsACString& contentType,
void *closure, nsIUrlListener *aListener);
- nsresult PromptIfFileExists(nsILocalFile *file);
+ nsresult PromptIfFileExists(nsIFile *file);
nsresult DetachAttachments(PRUint32 aCount,
const char ** aContentTypeArray,
const char ** aUrlArray,
const char ** aDisplayNameArray,
const char ** aMessageUriArray,
nsTArray<nsCString> *saveFileUris,
bool withoutWarning = false);
nsresult SaveAllAttachments(PRUint32 count,
@@ -54,24 +54,24 @@ public:
bool detaching);
protected:
void GetString(const nsString& aStringName, nsString& stringValue);
nsresult InitStringBundle();
nsresult PromptIfDeleteAttachments(bool saveFirst, PRUint32 count, const char **displayNameArray);
private:
- nsresult GetLastSaveDirectory(nsILocalFile **aLastSaveAsDir);
+ nsresult GetLastSaveDirectory(nsIFile **aLastSaveAsDir);
// if aLocalFile is a dir, we use it. otherwise, we use the parent of aLocalFile.
- nsresult SetLastSaveDirectory(nsILocalFile *aLocalFile);
+ nsresult SetLastSaveDirectory(nsIFile *aLocalFile);
nsresult GetSaveAsFile(const nsAString& aMsgFilename, PRInt32 *aSaveAsFileType,
- nsILocalFile **aSaveAsFile);
+ nsIFile **aSaveAsFile);
- nsresult GetSaveToDir(nsILocalFile **aSaveToDir);
+ nsresult GetSaveToDir(nsIFile **aSaveToDir);
nsString mId;
nsCOMPtr<nsITransactionManager> mTxnMgr;
/* rhp - need this to drive message display */
nsCOMPtr<nsIDOMWindow> mWindow;
nsCOMPtr<nsIMsgWindow> mMsgWindow;
nsCOMPtr<nsIDocShell> mDocShell;
--- a/mailnews/base/src/nsMsgAccountManager.cpp
+++ b/mailnews/base/src/nsMsgAccountManager.cpp
@@ -21,17 +21,17 @@
#include "prthread.h"
#include "plstr.h"
#include "nsStringGlue.h"
#include "nsUnicharUtils.h"
#include "nscore.h"
#include "prprf.h"
#include "nsIMsgFolderCache.h"
#include "nsMsgUtils.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIURL.h"
#include "nsNetCID.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsISmtpService.h"
#include "nsIMsgBiffManager.h"
#include "nsIMsgPurgeService.h"
#include "nsIObserverService.h"
@@ -2372,17 +2372,17 @@ nsMsgAccountManager::CreateLocalMailAcco
nsCOMPtr<nsINoIncomingServer> noServer;
noServer = do_QueryInterface(server, &rv);
if (NS_FAILED(rv)) return rv;
// create the directory structure for old 4.x "Local Mail"
// under <profile dir>/Mail/Local Folders or
// <"mail.directory" pref>/Local Folders
nsCOMPtr <nsIFile> mailDir;
- nsCOMPtr <nsILocalFile> localFile;
+ nsCOMPtr <nsIFile> localFile;
bool dirExists;
// we want <profile>/Mail
rv = NS_GetSpecialDirectory(NS_APP_MAIL_50_DIR, getter_AddRefs(mailDir));
if (NS_FAILED(rv)) return rv;
localFile = do_QueryInterface(mailDir);
rv = mailDir->Exists(&dirExists);
@@ -2942,31 +2942,31 @@ nsresult VirtualFolderChangeListener::Po
void VirtualFolderChangeListener::ProcessUpdateEvent(nsIMsgFolder *virtFolder,
nsIMsgDatabase *virtDB)
{
m_batchingEvents = false;
virtFolder->UpdateSummaryTotals(true); // force update from db.
virtDB->Commit(nsMsgDBCommitType::kLargeCommit);
}
-nsresult nsMsgAccountManager::GetVirtualFoldersFile(nsCOMPtr<nsILocalFile>& file)
+nsresult nsMsgAccountManager::GetVirtualFoldersFile(nsCOMPtr<nsIFile>& file)
{
nsCOMPtr<nsIFile> profileDir;
nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileDir));
NS_ENSURE_SUCCESS(rv, rv);
rv = profileDir->AppendNative(nsDependentCString("virtualFolders.dat"));
if (NS_SUCCEEDED(rv))
file = do_QueryInterface(profileDir, &rv);
return rv;
}
NS_IMETHODIMP nsMsgAccountManager::LoadVirtualFolders()
{
- nsCOMPtr <nsILocalFile> file;
+ nsCOMPtr <nsIFile> file;
GetVirtualFoldersFile(file);
if (!file)
return NS_ERROR_FAILURE;
if (m_virtualFoldersLoaded)
return NS_OK;
m_loadingVirtualFolders = true;
@@ -3106,17 +3106,17 @@ NS_IMETHODIMP nsMsgAccountManager::LoadV
return rv;
}
NS_IMETHODIMP nsMsgAccountManager::SaveVirtualFolders()
{
if (!m_virtualFoldersLoaded)
return NS_OK;
- nsCOMPtr<nsILocalFile> file;
+ nsCOMPtr<nsIFile> file;
GetVirtualFoldersFile(file);
// Open a buffered, safe output stream
nsCOMPtr<nsIOutputStream> outStreamSink;
nsresult rv = NS_NewSafeLocalFileOutputStream(getter_AddRefs(outStreamSink),
file,
PR_CREATE_FILE | PR_WRONLY | PR_TRUNCATE,
0664);
@@ -3678,17 +3678,17 @@ NS_IMETHODIMP nsMsgAccountManager::OnIte
}
NS_IMETHODIMP nsMsgAccountManager::OnItemEvent(nsIMsgFolder *aFolder, nsIAtom *aEvent)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-nsMsgAccountManager::FolderUriForPath(nsILocalFile *aLocalPath,
+nsMsgAccountManager::FolderUriForPath(nsIFile *aLocalPath,
nsACString &aMailboxUri)
{
NS_ENSURE_ARG_POINTER(aLocalPath);
bool equals;
if (m_lastPathLookedUp &&
NS_SUCCEEDED(aLocalPath->Equals(m_lastPathLookedUp, &equals)) && equals)
{
aMailboxUri = m_lastFolderURIForPath;
@@ -3702,17 +3702,17 @@ nsMsgAccountManager::FolderUriForPath(ns
rv = folderArray->GetLength(&count);
NS_ENSURE_SUCCESS(rv, rv);
for (PRUint32 i = 0; i < count; i++)
{
nsCOMPtr<nsIMsgFolder> folder(do_QueryElementAt(folderArray, i, &rv));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> folderPath;
+ nsCOMPtr<nsIFile> folderPath;
rv = folder->GetFilePath(getter_AddRefs(folderPath));
NS_ENSURE_SUCCESS(rv, rv);
// Check if we're equal
rv = folderPath->Equals(aLocalPath, &equals);
NS_ENSURE_SUCCESS(rv, rv);
if (equals)
--- a/mailnews/base/src/nsMsgAccountManager.h
+++ b/mailnews/base/src/nsMsgAccountManager.h
@@ -193,17 +193,17 @@ private:
nsresult findServerInternal(const nsACString& username,
const nsACString& hostname,
const nsACString& type,
PRInt32 port,
bool aRealFlag,
nsIMsgIncomingServer** aResult);
// handle virtual folders
- static nsresult GetVirtualFoldersFile(nsCOMPtr<nsILocalFile>& file);
+ static nsresult GetVirtualFoldersFile(nsCOMPtr<nsIFile>& file);
static nsresult WriteLineToOutputStream(const char *prefix, const char * line, nsIOutputStream *outputStream);
void ParseAndVerifyVirtualFolderScope(nsCString &buffer,
nsIRDFService *rdf);
nsresult AddVFListenersForVF(nsIMsgFolder *virtualFolder,
const nsCString& srchFolderUris,
nsIRDFService *rdf,
nsIMsgDBService *msgDBService);
--- a/mailnews/base/src/nsMsgFolderCompactor.cpp
+++ b/mailnews/base/src/nsMsgFolderCompactor.cpp
@@ -2,17 +2,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "msgCore.h" // precompiled header...
#include "nsCOMPtr.h"
#include "nsIMsgFolder.h"
#include "nsAutoPtr.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsNetUtil.h"
#include "nsIMsgHdr.h"
#include "nsIStreamListener.h"
#include "nsIMsgMessageService.h"
#include "nsMsgDBCID.h"
#include "nsMsgUtils.h"
#include "nsISeekableStream.h"
#include "nsIDBFolderInfo.h"
@@ -75,17 +75,17 @@ void nsFolderCompactState::CloseOutputSt
}
void nsFolderCompactState::CleanupTempFilesAfterError()
{
CloseOutputStream();
if (m_db)
m_db->ForceClosed();
- nsCOMPtr <nsILocalFile> summaryFile;
+ nsCOMPtr <nsIFile> summaryFile;
GetSummaryFileLocation(m_file, getter_AddRefs(summaryFile));
m_file->Remove(false);
summaryFile->Remove(false);
}
nsresult nsFolderCompactState::BuildMessageURI(const char *baseURI, PRUint32 key, nsCString& uri)
{
uri.Append(baseURI);
@@ -164,17 +164,17 @@ nsFolderCompactState::Compact(nsIMsgFold
if (imapFolder)
return imapFolder->Expunge(this, aMsgWindow);
}
m_window = aMsgWindow;
nsresult rv;
nsCOMPtr<nsIMsgDatabase> db;
nsCOMPtr<nsIDBFolderInfo> folderInfo;
nsCOMPtr<nsIMsgDatabase> mailDBFactory;
- nsCOMPtr<nsILocalFile> path;
+ nsCOMPtr<nsIFile> path;
nsCString baseMessageURI;
nsCOMPtr <nsIMsgLocalMailFolder> localFolder = do_QueryInterface(folder, &rv);
if (NS_SUCCEEDED(rv) && localFolder)
{
rv=localFolder->GetDatabaseWOReparse(getter_AddRefs(db));
if (NS_FAILED(rv) || !db)
{
@@ -244,17 +244,17 @@ nsresult nsFolderCompactState::ShowStatu
if (statusFeedback && !aMsg.IsEmpty())
return statusFeedback->SetStatusString(aMsg);
}
return NS_OK;
}
nsresult
nsFolderCompactState::Init(nsIMsgFolder *folder, const char *baseMsgUri, nsIMsgDatabase *db,
- nsILocalFile *path, nsIMsgWindow *aMsgWindow)
+ nsIFile *path, nsIMsgWindow *aMsgWindow)
{
nsresult rv;
m_folder = folder;
m_baseMessageUri = baseMsgUri;
m_file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
m_file->InitWithFile(path);
@@ -368,24 +368,24 @@ nsresult nsFolderCompactState::StartComp
nsresult
nsFolderCompactState::FinishCompact()
{
if (!m_folder)
return NS_ERROR_NOT_INITIALIZED;
// All okay time to finish up the compact process
- nsCOMPtr<nsILocalFile> path;
+ nsCOMPtr<nsIFile> path;
nsCOMPtr<nsIDBFolderInfo> folderInfo;
// get leaf name and database name of the folder
nsresult rv = m_folder->GetFilePath(getter_AddRefs(path));
- nsCOMPtr <nsILocalFile> folderPath = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr <nsIFile> folderPath = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr <nsILocalFile> summaryFile;
+ nsCOMPtr <nsIFile> summaryFile;
folderPath->InitWithFile(path);
// need to make sure we put the .msf file in the same directory
// as the original mailbox, so resolve symlinks.
folderPath->SetFollowLinks(true);
GetSummaryFileLocation(folderPath, getter_AddRefs(summaryFile));
nsCString leafName;
summaryFile->GetNativeLeafName(leafName);
@@ -402,17 +402,17 @@ nsFolderCompactState::FinishCompact()
// make sure the new database is valid.
// Close it so we can rename the .msf file.
if (m_db)
{
m_db->ForceClosed();
m_db = nsnull;
}
- nsCOMPtr <nsILocalFile> newSummaryFile;
+ nsCOMPtr <nsIFile> newSummaryFile;
GetSummaryFileLocation(m_file, getter_AddRefs(newSummaryFile));
nsCOMPtr <nsIDBFolderInfo> transferInfo;
m_folder->GetDBTransferInfo(getter_AddRefs(transferInfo));
// close down database of the original folder
m_folder->ForceDBClosed();
@@ -989,17 +989,17 @@ done:
return rv;
}
nsresult
nsOfflineStoreCompactState::FinishCompact()
{
// All okay time to finish up the compact process
- nsCOMPtr<nsILocalFile> path;
+ nsCOMPtr<nsIFile> path;
PRUint32 flags;
// get leaf name and database name of the folder
m_folder->GetFlags(&flags);
nsresult rv = m_folder->GetFilePath(getter_AddRefs(path));
nsCString leafName;
path->GetNativeLeafName(leafName);
--- a/mailnews/base/src/nsMsgFolderCompactor.h
+++ b/mailnews/base/src/nsMsgFolderCompactor.h
@@ -36,31 +36,31 @@ public:
protected:
virtual nsresult InitDB(nsIMsgDatabase *db);
virtual nsresult StartCompacting();
virtual nsresult FinishCompact();
void CloseOutputStream();
void CleanupTempFilesAfterError();
nsresult Init(nsIMsgFolder *aFolder, const char* aBaseMsgUri, nsIMsgDatabase *aDb,
- nsILocalFile *aPath, nsIMsgWindow *aMsgWindow);
+ nsIFile *aPath, nsIMsgWindow *aMsgWindow);
nsresult GetMessage(nsIMsgDBHdr **message);
nsresult BuildMessageURI(const char *baseURI, PRUint32 key, nsCString& uri);
nsresult ShowStatusMsg(const nsString& aMsg);
nsresult ReleaseFolderLock();
void ShowCompactingStatusMsg();
void CompactCompleted(nsresult exitCode);
void ShowDoneStatus();
nsresult CompactNextFolder();
nsCString m_baseMessageUri; // base message uri
nsCString m_messageUri; // current message uri being copy
nsCOMPtr<nsIMsgFolder> m_folder; // current folder being compact
nsCOMPtr<nsIMsgDatabase> m_db; // new database for the compact folder
- nsCOMPtr <nsILocalFile> m_file; // new mailbox for the compact folder
+ nsCOMPtr <nsIFile> m_file; // new mailbox for the compact folder
nsCOMPtr <nsIOutputStream> m_fileStream; // output file stream for writing
// all message keys that need to be copied over
nsRefPtr<nsMsgKeyArray> m_keyArray;
PRUint32 m_size;
// sum of the sizes of the messages, accumulated as we visit each msg.
PRUint32 m_totalMsgSize;
--- a/mailnews/base/src/nsSpamSettings.cpp
+++ b/mailnews/base/src/nsSpamSettings.cpp
@@ -1,16 +1,16 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsSpamSettings.h"
#include "nsISupportsObsolete.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "plstr.h"
#include "prmem.h"
#include "nsIMsgHdr.h"
#include "nsNetUtil.h"
#include "nsIMsgFolder.h"
#include "nsMsgUtils.h"
#include "nsMsgFolderFlags.h"
#include "nsImapCore.h"
@@ -202,28 +202,25 @@ nsSpamSettings::SetLogStream(nsIOutputSt
NS_IMETHODIMP
nsSpamSettings::GetLogStream(nsIOutputStream **aLogStream)
{
NS_ENSURE_ARG_POINTER(aLogStream);
nsresult rv;
if (!mLogStream) {
- nsCOMPtr <nsILocalFile> logFile = do_QueryInterface(mLogFile, &rv);
- NS_ENSURE_SUCCESS(rv,rv);
-
// append to the end of the log file
rv = MsgNewBufferedFileOutputStream(getter_AddRefs(mLogStream),
- logFile,
+ mLogFile,
PR_CREATE_FILE | PR_WRONLY | PR_APPEND,
0600);
NS_ENSURE_SUCCESS(rv, rv);
PRInt64 fileSize;
- rv = logFile->GetFileSize(&fileSize);
+ rv = mLogFile->GetFileSize(&fileSize);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 fileLen;
LL_L2UI(fileLen, fileSize);
// write the header at the start
if (fileLen == 0)
{
PRUint32 writeCount;
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -240,29 +240,29 @@ NS_IMETHODIMP nsMsgDBFolder::ForceDBClos
NS_IMETHODIMP nsMsgDBFolder::CloseAndBackupFolderDB(const nsACString& newName)
{
ForceDBClosed();
// We only support backup for mail at the moment
if ( !(mFlags & nsMsgFolderFlags::Mail))
return NS_OK;
- nsCOMPtr<nsILocalFile> folderPath;
+ nsCOMPtr<nsIFile> folderPath;
nsresult rv = GetFilePath(getter_AddRefs(folderPath));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> dbFile;
+ nsCOMPtr<nsIFile> dbFile;
rv = GetSummaryFileLocation(folderPath, getter_AddRefs(dbFile));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> backupDir;
+ nsCOMPtr<nsIFile> backupDir;
rv = CreateBackupDirectory(getter_AddRefs(backupDir));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> backupDBFile;
+ nsCOMPtr<nsIFile> backupDBFile;
rv = GetBackupSummaryFile(getter_AddRefs(backupDBFile), newName);
NS_ENSURE_SUCCESS(rv, rv);
if (mBackupDatabase)
{
mBackupDatabase->ForceClosed();
mBackupDatabase = nsnull;
}
@@ -284,31 +284,31 @@ NS_IMETHODIMP nsMsgDBFolder::CloseAndBac
else
return dbFile->CopyToNative(backupDir, EmptyCString());
}
NS_IMETHODIMP nsMsgDBFolder::OpenBackupMsgDatabase()
{
if (mBackupDatabase)
return NS_OK;
- nsCOMPtr<nsILocalFile> folderPath;
+ nsCOMPtr<nsIFile> folderPath;
nsresult rv = GetFilePath(getter_AddRefs(folderPath));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString folderName;
rv = folderPath->GetLeafName(folderName);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> backupDir;
+ nsCOMPtr<nsIFile> backupDir;
rv = CreateBackupDirectory(getter_AddRefs(backupDir));
NS_ENSURE_SUCCESS(rv, rv);
// We use a dummy message folder file so we can use
// GetSummaryFileLocation to get the db file name
- nsCOMPtr<nsILocalFile> backupDBDummyFolder;
+ nsCOMPtr<nsIFile> backupDBDummyFolder;
rv = CreateBackupDirectory(getter_AddRefs(backupDBDummyFolder));
NS_ENSURE_SUCCESS(rv, rv);
rv = backupDBDummyFolder->Append(folderName);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMsgDBService> msgDBService =
do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
@@ -323,37 +323,37 @@ NS_IMETHODIMP nsMsgDBFolder::OpenBackupM
if (rv == NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE)
// this is normal in reparsing
rv = NS_OK;
return rv;
}
NS_IMETHODIMP nsMsgDBFolder::RemoveBackupMsgDatabase()
{
- nsCOMPtr<nsILocalFile> folderPath;
+ nsCOMPtr<nsIFile> folderPath;
nsresult rv = GetFilePath(getter_AddRefs(folderPath));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString folderName;
rv = folderPath->GetLeafName(folderName);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> backupDir;
+ nsCOMPtr<nsIFile> backupDir;
rv = CreateBackupDirectory(getter_AddRefs(backupDir));
NS_ENSURE_SUCCESS(rv, rv);
// We use a dummy message folder file so we can use
// GetSummaryFileLocation to get the db file name
- nsCOMPtr<nsILocalFile> backupDBDummyFolder;
+ nsCOMPtr<nsIFile> backupDBDummyFolder;
rv = CreateBackupDirectory(getter_AddRefs(backupDBDummyFolder));
NS_ENSURE_SUCCESS(rv, rv);
rv = backupDBDummyFolder->Append(folderName);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> backupDBFile;
+ nsCOMPtr<nsIFile> backupDBFile;
rv = GetSummaryFileLocation(backupDBDummyFolder, getter_AddRefs(backupDBFile));
NS_ENSURE_SUCCESS(rv, rv);
if (mBackupDatabase)
{
mBackupDatabase->ForceClosed();
mBackupDatabase = nsnull;
}
@@ -568,17 +568,17 @@ void nsMsgDBFolder::UpdateNewMessages()
}
SetHasNewMessages(hasNewMessages);
}
}
// helper function that gets the cache element that corresponds to the passed in file spec.
// This could be static, or could live in another class - it's not specific to the current
// nsMsgDBFolder. If it lived at a higher level, we could cache the account manager and folder cache.
-nsresult nsMsgDBFolder::GetFolderCacheElemFromFile(nsILocalFile *file, nsIMsgFolderCacheElement **cacheElement)
+nsresult nsMsgDBFolder::GetFolderCacheElemFromFile(nsIFile *file, nsIMsgFolderCacheElement **cacheElement)
{
nsresult result;
NS_ENSURE_ARG_POINTER(file);
NS_ENSURE_ARG_POINTER(cacheElement);
nsCOMPtr <nsIMsgFolderCache> folderCache;
#ifdef DEBUG_bienvenu1
bool exists;
NS_ASSERTION(NS_SUCCEEDED(fileSpec->Exists(&exists)) && exists, "whoops, file doesn't exist, mac will break");
@@ -604,17 +604,17 @@ nsresult nsMsgDBFolder::ReadDBFolderInfo
// the DBs all the time, if we have to open it once, get everything
// we might need while we're here
nsresult result = NS_OK;
// don't need to reload from cache if we've already read from cache,
// and, we might get stale info, so don't do it.
if (!mInitializedFromCache)
{
- nsCOMPtr <nsILocalFile> dbPath;
+ nsCOMPtr <nsIFile> dbPath;
result = GetFolderCacheKey(getter_AddRefs(dbPath), true /* createDBIfMissing */);
if (dbPath)
{
nsCOMPtr <nsIMsgFolderCacheElement> cacheElement;
result = GetFolderCacheElemFromFile(dbPath, getter_AddRefs(cacheElement));
if (NS_SUCCEEDED(result) && cacheElement)
result = ReadFromFolderCacheElem(cacheElement);
}
@@ -713,27 +713,27 @@ NS_IMETHODIMP nsMsgDBFolder::GetMsgStore
{
NS_ENSURE_ARG_POINTER(aStore);
nsCOMPtr<nsIMsgIncomingServer> server;
nsresult rv = GetServer(getter_AddRefs(server));
NS_ENSURE_SUCCESS(rv, NS_MSG_INVALID_OR_MISSING_SERVER);
return server->GetMsgStore(aStore);
}
-nsresult nsMsgDBFolder::GetSummaryFile(nsILocalFile** aSummaryFile)
+nsresult nsMsgDBFolder::GetSummaryFile(nsIFile** aSummaryFile)
{
nsCOMPtr<nsIMsgPluggableStore> msgStore;
nsresult rv = GetMsgStore(getter_AddRefs(msgStore));
NS_ENSURE_SUCCESS(rv, rv);
return msgStore->GetSummaryFile(this, aSummaryFile);
}
NS_IMETHODIMP nsMsgDBFolder::GetOfflineStoreInputStream(nsIInputStream **stream)
{
- nsCOMPtr <nsILocalFile> localStore;
+ nsCOMPtr <nsIFile> localStore;
nsresult rv = GetFilePath(getter_AddRefs(localStore));
NS_ENSURE_SUCCESS(rv, rv);
return NS_NewLocalFileInputStream(stream, localStore);
}
bool nsMsgDBFolder::VerifyOfflineMessage(nsIMsgDBHdr *msgHdr, nsIInputStream *fileStream)
{
nsCOMPtr <nsISeekableStream> seekableStream = do_QueryInterface(fileStream);
@@ -870,17 +870,17 @@ nsMsgDBFolder::GetMsgInputStream(nsIMsgD
rv = seekableStream->Seek(PR_SEEK_SET, offset);
NS_WARN_IF_FALSE(seekableStream || !offset,
"non-zero offset w/ non-seekable stream");
return rv;
}
// path coming in is the root path without the leaf name,
// on the way out, it's the whole path.
-nsresult nsMsgDBFolder::CreateFileForDB(const nsAString& userLeafName, nsILocalFile *path, nsILocalFile **dbFile)
+nsresult nsMsgDBFolder::CreateFileForDB(const nsAString& userLeafName, nsIFile *path, nsIFile **dbFile)
{
NS_ENSURE_ARG_POINTER(dbFile);
nsAutoString proposedDBName(userLeafName);
NS_MsgHashIfNecessary(proposedDBName);
// (note, the caller of this will be using the dbFile to call db->Open()
// will turn the path into summary file path, and append the ".msf" extension)
@@ -888,17 +888,17 @@ nsresult nsMsgDBFolder::CreateFileForDB(
// we want db->Open() to create a new summary file
// so we have to jump through some hoops to make sure the .msf it will
// create is unique. now that we've got the "safe" proposedDBName,
// we append ".msf" to see if the file exists. if so, we make the name
// unique and then string off the ".msf" so that we pass the right thing
// into Open(). this isn't ideal, since this is not atomic
// but it will make do.
nsresult rv;
- nsCOMPtr <nsILocalFile> dbPath = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr <nsIFile> dbPath = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
dbPath->InitWithFile(path);
proposedDBName.AppendLiteral(SUMMARY_SUFFIX);
dbPath->Append(proposedDBName);
bool exists;
dbPath->Exists(&exists);
if (exists)
{
@@ -1252,37 +1252,37 @@ NS_IMETHODIMP nsMsgDBFolder::ReadFromFol
nsCString uri;
GetURI(uri);
printf("read total %ld for %s\n", mNumTotalMessages, uri.get());
#endif
mInitializedFromCache = true;
return rv;
}
-nsresult nsMsgDBFolder::GetFolderCacheKey(nsILocalFile **aFile, bool createDBIfMissing /* = false */)
+nsresult nsMsgDBFolder::GetFolderCacheKey(nsIFile **aFile, bool createDBIfMissing /* = false */)
{
nsresult rv;
- nsCOMPtr <nsILocalFile> path;
+ nsCOMPtr <nsIFile> path;
rv = GetFilePath(getter_AddRefs(path));
// now we put a new file in aFile, because we're going to change it.
- nsCOMPtr <nsILocalFile> dbPath = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr <nsIFile> dbPath = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
if (dbPath)
{
dbPath->InitWithFile(path);
// if not a server, we need to convert to a db Path with .msf on the end
bool isServer = false;
GetIsServer(&isServer);
// if it's a server, we don't need the .msf appended to the name
if (!isServer)
{
- nsCOMPtr <nsILocalFile> summaryName;
+ nsCOMPtr <nsIFile> summaryName;
rv = GetSummaryFileLocation(dbPath, getter_AddRefs(summaryName));
dbPath->InitWithFile(summaryName);
// create the .msf file
// see bug #244217 for details
bool exists;
if (createDBIfMissing && NS_SUCCEEDED(dbPath->Exists(&exists)) && !exists)
dbPath->Create(nsIFile::NORMAL_FILE_TYPE, 0644);
@@ -1309,17 +1309,17 @@ nsresult nsMsgDBFolder::FlushToFolderCac
NS_IMETHODIMP nsMsgDBFolder::WriteToFolderCache(nsIMsgFolderCache *folderCache, bool deep)
{
nsresult rv = NS_OK;
if (folderCache)
{
nsCOMPtr <nsIMsgFolderCacheElement> cacheElement;
- nsCOMPtr <nsILocalFile> dbPath;
+ nsCOMPtr <nsIFile> dbPath;
rv = GetFolderCacheKey(getter_AddRefs(dbPath));
#ifdef DEBUG_bienvenu1
bool exists;
NS_ASSERTION(NS_SUCCEEDED(dbPath->Exists(&exists)) && exists, "file spec we're adding to cache should exist");
#endif
if (NS_SUCCEEDED(rv) && dbPath)
{
nsCString persistentPath;
@@ -1709,17 +1709,17 @@ nsresult nsMsgDBFolder::EndNewOfflineMes
// We clear the offline flag on the message if the size
// looks wrong. Check if we're off by more than one byte per line.
if (messageSize > (PRUint32) curStorePos &&
(messageSize - (PRUint32) curStorePos) > (PRUint32) m_numOfflineMsgLines)
{
mDatabase->MarkOffline(messageKey, false, nsnull);
// we should truncate the offline store at messgeOffset
- nsCOMPtr <nsILocalFile> localStore;
+ nsCOMPtr <nsIFile> localStore;
rv = GetFilePath(getter_AddRefs(localStore));
if (NS_SUCCEEDED(rv))
{
m_tempMessageStream->Close();
m_tempMessageStream = nsnull;
ReleaseSemaphore(static_cast<nsIMsgFolder*>(this));
if (msgStore)
msgStore->DiscardNewMessage(m_tempMessageStream, m_offlineHeader);
@@ -2100,17 +2100,17 @@ nsMsgDBFolder::SetDBTransferInfo(nsIDBFo
}
return NS_OK;
}
NS_IMETHODIMP
nsMsgDBFolder::GetStringProperty(const char *propertyName, nsACString& propertyValue)
{
NS_ENSURE_ARG_POINTER(propertyName);
- nsCOMPtr <nsILocalFile> dbPath;
+ nsCOMPtr <nsIFile> dbPath;
nsresult rv = GetFolderCacheKey(getter_AddRefs(dbPath));
if (dbPath)
{
nsCOMPtr <nsIMsgFolderCacheElement> cacheElement;
rv = GetFolderCacheElemFromFile(dbPath, getter_AddRefs(cacheElement));
if (cacheElement) //try to get from cache
rv = cacheElement->GetStringProperty(propertyName, propertyValue);
if (NS_FAILED(rv)) //if failed, then try to get from db
@@ -2128,17 +2128,17 @@ nsMsgDBFolder::GetStringProperty(const c
}
return rv;
}
NS_IMETHODIMP
nsMsgDBFolder::SetStringProperty(const char *propertyName, const nsACString& propertyValue)
{
NS_ENSURE_ARG_POINTER(propertyName);
- nsCOMPtr <nsILocalFile> dbPath;
+ nsCOMPtr <nsIFile> dbPath;
GetFolderCacheKey(getter_AddRefs(dbPath));
if (dbPath)
{
nsCOMPtr <nsIMsgFolderCacheElement> cacheElement;
GetFolderCacheElemFromFile(dbPath, getter_AddRefs(cacheElement));
if (cacheElement) //try to set in the cache
cacheElement->SetStringProperty(propertyName, propertyValue);
}
@@ -3185,17 +3185,17 @@ nsMsgDBFolder::parseURI(bool needServer)
scheme.EqualsLiteral("snews") ||
scheme.EqualsLiteral("nntp");
}
NS_MsgCreatePathStringFromFolderURI(urlPath.get(), newPath, scheme,
isNewsFolder);
}
// now append munged path onto server path
- nsCOMPtr<nsILocalFile> serverPath;
+ nsCOMPtr<nsIFile> serverPath;
rv = server->GetLocalPath(getter_AddRefs(serverPath));
if (NS_FAILED(rv)) return rv;
if (!mPath && serverPath)
{
if (!newPath.IsEmpty())
{
// I hope this is temporary - Ultimately,
@@ -3583,17 +3583,17 @@ NS_IMETHODIMP nsMsgDBFolder::PropagateDe
NS_IMETHODIMP nsMsgDBFolder::RecursiveDelete(bool deleteStorage, nsIMsgWindow *msgWindow)
{
// If deleteStorage is true, recursively deletes disk storage for this folder
// and all its subfolders.
// Regardless of deleteStorage, always unlinks them from the children lists and
// frees memory for the subfolders but NOT for _this_
nsresult status = NS_OK;
- nsCOMPtr <nsILocalFile> dbPath;
+ nsCOMPtr <nsIFile> dbPath;
// first remove the deleted folder from the folder cache;
nsresult result = GetFolderCacheKey(getter_AddRefs(dbPath));
nsCOMPtr<nsIMsgAccountManager> accountMgr =
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &result);
if(NS_SUCCEEDED(result))
{
@@ -3785,33 +3785,33 @@ nsMsgDBFolder::CheckIfFolderExists(const
return NS_MSG_FOLDER_EXISTS;
}
}
return NS_OK;
}
nsresult
-nsMsgDBFolder::AddDirectorySeparator(nsILocalFile *path)
+nsMsgDBFolder::AddDirectorySeparator(nsIFile *path)
{
nsAutoString leafName;
path->GetLeafName(leafName);
leafName.AppendLiteral(FOLDER_SUFFIX);
return path->SetLeafName(leafName);
}
/* Finds the directory associated with this folder. That is if the path is
c:\Inbox, it will return c:\Inbox.sbd if it succeeds. If that path doesn't
currently exist then it will create it. Path is strictly an out parameter.
*/
-nsresult nsMsgDBFolder::CreateDirectoryForFolder(nsILocalFile **resultFile)
+nsresult nsMsgDBFolder::CreateDirectoryForFolder(nsIFile **resultFile)
{
nsresult rv = NS_OK;
- nsCOMPtr<nsILocalFile> path;
+ nsCOMPtr<nsIFile> path;
rv = GetFilePath(getter_AddRefs(path));
if (NS_FAILED(rv)) return rv;
bool pathIsDirectory = false;
path->IsDirectory(&pathIsDirectory);
if(!pathIsDirectory)
{
//If the current path isn't a directory, add directory separator
@@ -3836,24 +3836,21 @@ nsresult nsMsgDBFolder::CreateDirectoryF
path.swap(*resultFile);
return rv;
}
/* Finds the backup directory associated with this folder, stored on the temp
drive. If that path doesn't currently exist then it will create it. Path is
strictly an out parameter.
*/
-nsresult nsMsgDBFolder::CreateBackupDirectory(nsILocalFile **resultFile)
-{
- nsCOMPtr<nsIFile> pathIFile;
+nsresult nsMsgDBFolder::CreateBackupDirectory(nsIFile **resultFile)
+{
+ nsCOMPtr<nsIFile> path;
nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR,
- getter_AddRefs(pathIFile));
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsCOMPtr<nsILocalFile> path = do_QueryInterface(pathIFile, &rv);
+ getter_AddRefs(path));
NS_ENSURE_SUCCESS(rv, rv);
rv = path->Append(NS_LITERAL_STRING("MozillaMailnews"));
bool pathIsDirectory;
path->IsDirectory(&pathIsDirectory);
// If that doesn't exist, then we have to create this directory
if (!pathIsDirectory)
@@ -3865,86 +3862,86 @@ nsresult nsMsgDBFolder::CreateBackupDire
rv = pathExists ? NS_MSG_COULD_NOT_CREATE_DIRECTORY :
path->Create(nsIFile::DIRECTORY_TYPE, 0700);
}
if (NS_SUCCEEDED(rv))
path.swap(*resultFile);
return rv;
}
-nsresult nsMsgDBFolder::GetBackupSummaryFile(nsILocalFile **aBackupFile, const nsACString& newName)
-{
- nsCOMPtr<nsILocalFile> backupDir;
+nsresult nsMsgDBFolder::GetBackupSummaryFile(nsIFile **aBackupFile, const nsACString& newName)
+{
+ nsCOMPtr<nsIFile> backupDir;
nsresult rv = CreateBackupDirectory(getter_AddRefs(backupDir));
NS_ENSURE_SUCCESS(rv, rv);
// We use a dummy message folder file so we can use
// GetSummaryFileLocation to get the db file name
- nsCOMPtr<nsILocalFile> backupDBDummyFolder;
+ nsCOMPtr<nsIFile> backupDBDummyFolder;
rv = CreateBackupDirectory(getter_AddRefs(backupDBDummyFolder));
NS_ENSURE_SUCCESS(rv, rv);
if (!newName.IsEmpty())
{
rv = backupDBDummyFolder->AppendNative(newName);
}
else // if newName is null, use the folder name
{
- nsCOMPtr<nsILocalFile> folderPath;
+ nsCOMPtr<nsIFile> folderPath;
rv = GetFilePath(getter_AddRefs(folderPath));
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString folderName;
rv = folderPath->GetNativeLeafName(folderName);
NS_ENSURE_SUCCESS(rv, rv);
rv = backupDBDummyFolder->AppendNative(folderName);
}
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> backupDBFile;
+ nsCOMPtr<nsIFile> backupDBFile;
rv = GetSummaryFileLocation(backupDBDummyFolder, getter_AddRefs(backupDBFile));
NS_ENSURE_SUCCESS(rv, rv);
backupDBFile.swap(*aBackupFile);
return NS_OK;
}
NS_IMETHODIMP nsMsgDBFolder::Rename(const nsAString& aNewName, nsIMsgWindow *msgWindow)
{
- nsCOMPtr<nsILocalFile> oldPathFile;
+ nsCOMPtr<nsIFile> oldPathFile;
nsCOMPtr<nsIAtom> folderRenameAtom;
nsresult rv = GetFilePath(getter_AddRefs(oldPathFile));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIMsgFolder> parentFolder;
rv = GetParent(getter_AddRefs(parentFolder));
if (!parentFolder)
return NS_ERROR_FAILURE;
nsCOMPtr<nsISupports> parentSupport = do_QueryInterface(parentFolder);
- nsCOMPtr<nsILocalFile> oldSummaryFile;
+ nsCOMPtr<nsIFile> oldSummaryFile;
rv = GetSummaryFileLocation(oldPathFile, getter_AddRefs(oldSummaryFile));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> dirFile;
+ nsCOMPtr<nsIFile> dirFile;
PRInt32 count = mSubFolders.Count();
if (count > 0)
rv = CreateDirectoryForFolder(getter_AddRefs(dirFile));
nsAutoString newDiskName(aNewName);
NS_MsgHashIfNecessary(newDiskName);
if (mName.Equals(aNewName, nsCaseInsensitiveStringComparator()))
{
rv = ThrowAlertMsg("folderExists", msgWindow);
return NS_MSG_FOLDER_EXISTS;
}
else
{
- nsCOMPtr <nsILocalFile> parentPathFile;
+ nsCOMPtr <nsIFile> parentPathFile;
parentFolder->GetFilePath(getter_AddRefs(parentPathFile));
NS_ENSURE_SUCCESS(rv,rv);
bool isDirectory = false;
parentPathFile->IsDirectory(&isDirectory);
if (!isDirectory)
AddDirectorySeparator(parentPathFile);
rv = CheckIfFolderExists(aNewName, parentFolder, msgWindow);
@@ -4637,30 +4634,30 @@ NS_IMETHODIMP nsMsgDBFolder::GetRootFold
nsresult rv;
nsCOMPtr<nsIMsgIncomingServer> server;
rv = GetServer(getter_AddRefs(server));
NS_ENSURE_SUCCESS(rv, rv);
return server->GetRootMsgFolder(aRootFolder);
}
NS_IMETHODIMP
-nsMsgDBFolder::SetFilePath(nsILocalFile *aFile)
+nsMsgDBFolder::SetFilePath(nsIFile *aFile)
{
mPath = aFile;
return NS_OK;
}
NS_IMETHODIMP
-nsMsgDBFolder::GetFilePath(nsILocalFile * *aFile)
+nsMsgDBFolder::GetFilePath(nsIFile * *aFile)
{
NS_ENSURE_ARG_POINTER(aFile);
nsresult rv;
- // make a new nsILocalFile object in case the caller
+ // make a new nsIFile object in case the caller
// alters the underlying file object.
- nsCOMPtr <nsILocalFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr <nsIFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
if (!mPath)
parseURI(true);
rv = file->InitWithFile(mPath);
file.swap(*aFile);
return NS_OK;
}
--- a/mailnews/base/util/nsMsgDBFolder.h
+++ b/mailnews/base/util/nsMsgDBFolder.h
@@ -12,17 +12,17 @@
#include "nsIDBFolderInfo.h"
#include "nsIMsgDatabase.h"
#include "nsIMsgIncomingServer.h"
#include "nsCOMPtr.h"
#include "nsStaticAtom.h"
#include "nsIDBChangeListener.h"
#include "nsIMsgPluggableStore.h"
#include "nsIURL.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsWeakReference.h"
#include "nsIMsgFilterList.h"
#include "nsIUrlListener.h"
#include "nsIMsgHdr.h"
#include "nsIOutputStream.h"
#include "nsITransport.h"
#include "nsIStringBundle.h"
#include "nsTObserverArray.h"
@@ -72,19 +72,19 @@ public:
// These functions are called when MSG_Master::GetFolderLineById is populating a MSG_FolderLine
// struct used by the FE
PRInt32 GetNumPendingUnread();
PRInt32 GetNumPendingTotalMessages();
void ChangeNumPendingUnread(PRInt32 delta);
void ChangeNumPendingTotalMessages(PRInt32 delta);
- nsresult CreateDirectoryForFolder(nsILocalFile **result);
- nsresult CreateBackupDirectory(nsILocalFile **result);
- nsresult GetBackupSummaryFile(nsILocalFile **result, const nsACString& newName);
+ nsresult CreateDirectoryForFolder(nsIFile **result);
+ nsresult CreateBackupDirectory(nsIFile **result);
+ nsresult GetBackupSummaryFile(nsIFile **result, const nsACString& newName);
nsresult GetMsgPreviewTextFromStream(nsIMsgDBHdr *msgHdr, nsIInputStream *stream);
nsresult HandleAutoCompactEvent(nsIMsgWindow *aMsgWindow);
protected:
// this is a little helper function that is not part of the public interface.
// we use it to get the IID of the incoming server for the derived folder.
// w/out a function like this we would have to implement GetServer in each
// derived folder class.
@@ -109,25 +109,25 @@ protected:
virtual nsresult CreateChildFromURI(const nsCString &uri, nsIMsgFolder **folder) = 0;
virtual nsresult ReadDBFolderInfo(bool force);
virtual nsresult FlushToFolderCache();
virtual nsresult GetDatabase() = 0;
virtual nsresult SendFlagNotifications(nsIMsgDBHdr *item, PRUint32 oldFlags, PRUint32 newFlags);
nsresult CheckWithNewMessagesStatus(bool messageAdded);
void UpdateNewMessages();
nsresult OnHdrAddedOrDeleted(nsIMsgDBHdr *hdrChanged, bool added);
- nsresult CreateFileForDB(const nsAString& userLeafName, nsILocalFile *baseDir,
- nsILocalFile **dbFile);
+ nsresult CreateFileForDB(const nsAString& userLeafName, nsIFile *baseDir,
+ nsIFile **dbFile);
- nsresult GetFolderCacheKey(nsILocalFile **aFile, bool createDBIfMissing = false);
- nsresult GetFolderCacheElemFromFile(nsILocalFile *file, nsIMsgFolderCacheElement **cacheElement);
- nsresult AddDirectorySeparator(nsILocalFile *path);
+ nsresult GetFolderCacheKey(nsIFile **aFile, bool createDBIfMissing = false);
+ nsresult GetFolderCacheElemFromFile(nsIFile *file, nsIMsgFolderCacheElement **cacheElement);
+ nsresult AddDirectorySeparator(nsIFile *path);
nsresult CheckIfFolderExists(const nsAString& newFolderName, nsIMsgFolder *parentFolder, nsIMsgWindow *msgWindow);
- nsresult GetSummaryFile(nsILocalFile** aSummaryFile);
+ nsresult GetSummaryFile(nsIFile** aSummaryFile);
// Returns true if: a) there is no need to prompt or b) the user is already
// logged in or c) the user logged in successfully.
static bool PromptForMasterPasswordIfNecessary();
// offline support methods.
nsresult StartNewOfflineMessage();
nsresult WriteStartOfNewLocalMessage();
@@ -220,17 +220,17 @@ protected:
//
// stuff from the uri
//
bool mHaveParsedURI; // is the URI completely parsed?
bool mIsServerIsValid;
bool mIsServer;
nsString mName;
- nsCOMPtr<nsILocalFile> mPath;
+ nsCOMPtr<nsIFile> mPath;
nsCString mBaseMessageURI; //The uri with the message scheme
bool mInVFEditSearchScope ; // non persistant state used by the virtual folder UI
// static stuff for cross-instance objects like atoms
static NS_MSG_BASE_STATIC_MEMBER_(nsrefcnt) gInstanceCount;
static nsresult initializeStrings();
--- a/mailnews/base/util/nsMsgFileStream.cpp
+++ b/mailnews/base/util/nsMsgFileStream.cpp
@@ -1,13 +1,13 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsMsgFileStream.h"
#include "prerr.h"
#include "prerror.h"
/* From nsDebugImpl.cpp: */
static nsresult
ErrorAccordingToNSPR()
{
@@ -40,17 +40,17 @@ nsMsgFileStream::nsMsgFileStream()
nsMsgFileStream::~nsMsgFileStream()
{
if (mFileDesc)
PR_Close(mFileDesc);
}
NS_IMPL_ISUPPORTS3(nsMsgFileStream, nsIInputStream, nsIOutputStream, nsISeekableStream)
-nsresult nsMsgFileStream::InitWithFile(nsILocalFile *file)
+nsresult nsMsgFileStream::InitWithFile(nsIFile *file)
{
return file->OpenNSPRFileDesc(PR_RDWR|PR_CREATE_FILE, 0664, &mFileDesc);
}
NS_IMETHODIMP
nsMsgFileStream::Seek(PRInt32 whence, PRInt64 offset)
{
if (mFileDesc == nsnull)
--- a/mailnews/base/util/nsMsgFileStream.h
+++ b/mailnews/base/util/nsMsgFileStream.h
@@ -17,13 +17,13 @@ public:
NS_DECL_ISUPPORTS
NS_IMETHOD Available(PRUint32 *_retval);
NS_IMETHOD Read(char * aBuf, PRUint32 aCount, PRUint32 *_retval);
NS_IMETHOD ReadSegments(nsWriteSegmentFun aWriter, void * aClosure, PRUint32 aCount, PRUint32 *_retval);
NS_DECL_NSIOUTPUTSTREAM
NS_DECL_NSISEEKABLESTREAM
- nsresult InitWithFile(nsILocalFile *localFile);
+ nsresult InitWithFile(nsIFile *localFile);
protected:
PRFileDesc *mFileDesc;
bool mSeekedToEnd;
};
--- a/mailnews/base/util/nsMsgI18N.cpp
+++ b/mailnews/base/util/nsMsgI18N.cpp
@@ -293,17 +293,17 @@ bool nsMsgI18Ncheck_data_in_charset_rang
}
return result;
}
// Simple parser to parse META charset.
// It only supports the case when the description is within one line.
const char *
-nsMsgI18NParseMetaCharset(nsILocalFile* file)
+nsMsgI18NParseMetaCharset(nsIFile* file)
{
static char charset[nsIMimeConverter::MAX_CHARSET_NAME_LENGTH+1];
*charset = '\0';
bool isDirectory = false;
file->IsDirectory(&isDirectory);
if (isDirectory) {
--- a/mailnews/base/util/nsMsgI18N.h
+++ b/mailnews/base/util/nsMsgI18N.h
@@ -4,17 +4,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _nsMsgI18N_H_
#define _nsMsgI18N_H_
#include "nscore.h"
#include "msgCore.h"
#include "nsStringGlue.h"
-class nsILocalFile;
+class nsIFile;
/**
* Encode an input string into RFC 2047 form.
*
* @param header [IN] A header to encode.
* @param structured [IN] Specify the header is structured or non-structured field (See RFC-822).
* @param charset [IN] Charset name to convert.
* @param fieldnamelen [IN] Header field name length. (e.g. "From: " -> 6)
@@ -93,20 +93,20 @@ NS_MSG_BASE nsresult nsMsgI18NConvertFro
NS_MSG_BASE nsresult nsMsgI18NConvertToUnicode(const char* aCharset,
const nsCString& inString,
nsAString& outString,
bool aIsCharsetCanonical =
false);
/**
* Parse for META charset.
*
- * @param file [IN] A nsILocalFile.
+ * @param file [IN] A nsIFile.
* @return A charset name or empty string if not found.
*/
-NS_MSG_BASE const char *nsMsgI18NParseMetaCharset(nsILocalFile* file);
+NS_MSG_BASE const char *nsMsgI18NParseMetaCharset(nsIFile* file);
/**
* Convert from charset to unicode. Also does substitution for unconverted characters (e.g. entity, '?').
*
* @param contentType [IN] text/plain or text/html.
* @param charset [IN] Charset name to convert.
* @param inString [IN] Input unicode string to convert.
* @param outString [OUT] Allocated and converted output C string. Need PR_FREE.
--- a/mailnews/base/util/nsMsgIdentity.cpp
+++ b/mailnews/base/util/nsMsgIdentity.cpp
@@ -98,30 +98,30 @@ nsMsgIdentity::ToString(nsAString& aResu
aResult.Append(NS_ConvertASCIItoUTF16(mKey));
aResult.AppendLiteral("]");
return NS_OK;
}
/* Identity attribute accessors */
NS_IMETHODIMP
-nsMsgIdentity::GetSignature(nsILocalFile **sig)
+nsMsgIdentity::GetSignature(nsIFile **sig)
{
bool gotRelPref;
nsresult rv = NS_GetPersistentFile("sig_file" REL_FILE_PREF_SUFFIX, "sig_file", nsnull, gotRelPref, sig, mPrefBranch);
if (NS_SUCCEEDED(rv) && !gotRelPref)
{
rv = NS_SetPersistentFile("sig_file" REL_FILE_PREF_SUFFIX, "sig_file", *sig, mPrefBranch);
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to write signature file pref.");
}
return NS_OK;
}
NS_IMETHODIMP
-nsMsgIdentity::SetSignature(nsILocalFile *sig)
+nsMsgIdentity::SetSignature(nsIFile *sig)
{
nsresult rv = NS_OK;
if (sig)
rv = NS_SetPersistentFile("sig_file" REL_FILE_PREF_SUFFIX, "sig_file", sig, mPrefBranch);
return rv;
}
NS_IMETHODIMP
@@ -514,17 +514,17 @@ NS_IMETHODIMP nsMsgIdentity::GetIntAttri
mDefPrefBranch->GetIntPref(aName, val);
return NS_OK;
}
#define COPY_IDENTITY_FILE_VALUE(SRC_ID,MACRO_GETTER,MACRO_SETTER) \
{ \
nsresult macro_rv; \
- nsCOMPtr <nsILocalFile>macro_spec; \
+ nsCOMPtr <nsIFile>macro_spec; \
macro_rv = SRC_ID->MACRO_GETTER(getter_AddRefs(macro_spec)); \
if (NS_SUCCEEDED(macro_rv)) \
this->MACRO_SETTER(macro_spec); \
}
#define COPY_IDENTITY_INT_VALUE(SRC_ID,MACRO_GETTER,MACRO_SETTER) \
{ \
nsresult macro_rv; \
--- a/mailnews/base/util/nsMsgIncomingServer.cpp
+++ b/mailnews/base/util/nsMsgIncomingServer.cpp
@@ -419,34 +419,34 @@ nsMsgIncomingServer::GetIntValue(const c
mDefPrefBranch->GetIntPref(prefname, val);
return NS_OK;
}
NS_IMETHODIMP
nsMsgIncomingServer::GetFileValue(const char* aRelPrefName,
const char* aAbsPrefName,
- nsILocalFile** aLocalFile)
+ nsIFile** aLocalFile)
{
if (!mPrefBranch)
return NS_ERROR_NOT_INITIALIZED;
// Get the relative first
nsCOMPtr<nsIRelativeFilePref> relFilePref;
nsresult rv = mPrefBranch->GetComplexValue(aRelPrefName,
NS_GET_IID(nsIRelativeFilePref),
getter_AddRefs(relFilePref));
if (relFilePref) {
rv = relFilePref->GetFile(aLocalFile);
NS_ASSERTION(*aLocalFile, "An nsIRelativeFilePref has no file.");
if (NS_SUCCEEDED(rv))
(*aLocalFile)->Normalize();
} else {
rv = mPrefBranch->GetComplexValue(aAbsPrefName,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
reinterpret_cast<void**>(aLocalFile));
if (NS_FAILED(rv))
return rv;
rv = NS_NewRelativeFilePref(*aLocalFile,
NS_LITERAL_CSTRING(NS_APP_USER_PROFILE_50_DIR),
getter_AddRefs(relFilePref));
if (relFilePref)
@@ -456,34 +456,34 @@ nsMsgIncomingServer::GetFileValue(const
}
return rv;
}
NS_IMETHODIMP
nsMsgIncomingServer::SetFileValue(const char* aRelPrefName,
const char* aAbsPrefName,
- nsILocalFile* aLocalFile)
+ nsIFile* aLocalFile)
{
if (!mPrefBranch)
return NS_ERROR_NOT_INITIALIZED;
// Write the relative path.
nsCOMPtr<nsIRelativeFilePref> relFilePref;
NS_NewRelativeFilePref(aLocalFile,
NS_LITERAL_CSTRING(NS_APP_USER_PROFILE_50_DIR),
getter_AddRefs(relFilePref));
if (relFilePref) {
nsresult rv = mPrefBranch->SetComplexValue(aRelPrefName,
NS_GET_IID(nsIRelativeFilePref),
relFilePref);
if (NS_FAILED(rv))
return rv;
}
- return mPrefBranch->SetComplexValue(aAbsPrefName, NS_GET_IID(nsILocalFile), aLocalFile);
+ return mPrefBranch->SetComplexValue(aAbsPrefName, NS_GET_IID(nsIFile), aLocalFile);
}
NS_IMETHODIMP
nsMsgIncomingServer::SetIntValue(const char *prefname,
PRInt32 val)
{
if (!mPrefBranch)
return NS_ERROR_NOT_INITIALIZED;
@@ -875,44 +875,44 @@ nsMsgIncomingServer::ForgetPassword()
NS_IMETHODIMP
nsMsgIncomingServer::ForgetSessionPassword()
{
m_password.Truncate();
return NS_OK;
}
NS_IMETHODIMP
-nsMsgIncomingServer::SetDefaultLocalPath(nsILocalFile *aDefaultLocalPath)
+nsMsgIncomingServer::SetDefaultLocalPath(nsIFile *aDefaultLocalPath)
{
nsresult rv;
nsCOMPtr<nsIMsgProtocolInfo> protocolInfo;
rv = getProtocolInfo(getter_AddRefs(protocolInfo));
NS_ENSURE_SUCCESS(rv, rv);
return protocolInfo->SetDefaultLocalPath(aDefaultLocalPath);
}
NS_IMETHODIMP
-nsMsgIncomingServer::GetLocalPath(nsILocalFile **aLocalPath)
+nsMsgIncomingServer::GetLocalPath(nsIFile **aLocalPath)
{
nsresult rv;
// if the local path has already been set, use it
rv = GetFileValue("directory-rel", "directory", aLocalPath);
if (NS_SUCCEEDED(rv) && *aLocalPath)
return rv;
// otherwise, create the path using the protocol info.
// note we are using the
// hostname, unless that directory exists.
// this should prevent all collisions.
nsCOMPtr<nsIMsgProtocolInfo> protocolInfo;
rv = getProtocolInfo(getter_AddRefs(protocolInfo));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> localPath;
+ nsCOMPtr<nsIFile> localPath;
rv = protocolInfo->GetDefaultLocalPath(getter_AddRefs(localPath));
NS_ENSURE_SUCCESS(rv, rv);
localPath->Create(nsIFile::DIRECTORY_TYPE, 0755);
nsCString hostname;
rv = GetHostName(hostname);
NS_ENSURE_SUCCESS(rv, rv);
@@ -955,17 +955,17 @@ nsMsgIncomingServer::GetMsgStore(nsIMsgP
NS_ENSURE_SUCCESS(rv, rv);
}
NS_IF_ADDREF(*aMsgStore = m_msgStore);
return NS_OK;
}
NS_IMETHODIMP
-nsMsgIncomingServer::SetLocalPath(nsILocalFile *aLocalPath)
+nsMsgIncomingServer::SetLocalPath(nsIFile *aLocalPath)
{
NS_ENSURE_ARG_POINTER(aLocalPath);
aLocalPath->Create(nsIFile::DIRECTORY_TYPE, 0755);
return SetFileValue("directory-rel", "directory", aLocalPath);
}
NS_IMETHODIMP
nsMsgIncomingServer::GetLocalStoreType(nsACString& aResult)
@@ -1026,17 +1026,17 @@ nsMsgIncomingServer::RemoveFiles()
GetCharValue("deferred_to_account", deferredToAccount);
bool isDeferredTo = true;
GetIsDeferredTo(&isDeferredTo);
if (!deferredToAccount.IsEmpty() || isDeferredTo)
{
NS_ASSERTION(false, "shouldn't remove files for a deferred account");
return NS_ERROR_FAILURE;
}
- nsCOMPtr <nsILocalFile> localPath;
+ nsCOMPtr <nsIFile> localPath;
nsresult rv = GetLocalPath(getter_AddRefs(localPath));
NS_ENSURE_SUCCESS(rv, rv);
return localPath->Remove(true);
}
NS_IMETHODIMP
nsMsgIncomingServer::SetFilterList(nsIMsgFilterList *aFilterList)
{
@@ -1074,32 +1074,32 @@ nsMsgIncomingServer::GetFilterList(nsIMs
NS_ADDREF(*aResult = mFilterList);
return NS_OK;
}
// The default case, a local folder, is a bit special. It requires
// more initialization.
- nsCOMPtr<nsILocalFile> thisFolder;
+ nsCOMPtr<nsIFile> thisFolder;
rv = msgFolder->GetFilePath(getter_AddRefs(thisFolder));
NS_ENSURE_SUCCESS(rv, rv);
mFilterFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = mFilterFile->InitWithFile(thisFolder);
NS_ENSURE_SUCCESS(rv, rv);
mFilterFile->AppendNative(NS_LITERAL_CSTRING("msgFilterRules.dat"));
bool fileExists;
mFilterFile->Exists(&fileExists);
if (!fileExists)
{
- nsCOMPtr<nsILocalFile> oldFilterFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr<nsIFile> oldFilterFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = oldFilterFile->InitWithFile(thisFolder);
NS_ENSURE_SUCCESS(rv, rv);
oldFilterFile->AppendNative(NS_LITERAL_CSTRING("rules.dat"));
oldFilterFile->Exists(&fileExists);
if (fileExists) //copy rules.dat --> msgFilterRules.dat
{
@@ -1835,18 +1835,17 @@ nsMsgIncomingServer::ConfigureTemporaryS
// it's possible that we can no longer find the sfd file (i.e. the user disabled an extnsion that
// was supplying the .sfd file.
if (!file)
return NS_OK;
nsCOMPtr<nsIMsgFilterService> filterService = do_GetService(NS_MSGFILTERSERVICE_CONTRACTID, &rv);
nsCOMPtr<nsIMsgFilterList> serverFilterList;
- nsCOMPtr <nsILocalFile> localFile = do_QueryInterface(file);
- rv = filterService->OpenFilterList(localFile, NULL, NULL, getter_AddRefs(serverFilterList));
+ rv = filterService->OpenFilterList(file, NULL, NULL, getter_AddRefs(serverFilterList));
NS_ENSURE_SUCCESS(rv, rv);
rv = serverFilterList->GetFilterNamed(yesFilterName,
getter_AddRefs(newFilter));
if (newFilter && serverFilterTrustFlags & nsISpamSettings::TRUST_POSITIVES)
{
newFilter->SetTemporary(true);
// check if we're supposed to move junk mail to junk folder; if so,
--- a/mailnews/base/util/nsMsgIncomingServer.h
+++ b/mailnews/base/util/nsMsgIncomingServer.h
@@ -6,17 +6,17 @@
#ifndef nsMsgIncomingServer_h__
#define nsMsgIncomingServer_h__
#include "nsIMsgIncomingServer.h"
#include "nsIPrefBranch.h"
#include "nsIMsgFilterList.h"
#include "msgCore.h"
#include "nsIMsgFolder.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsCOMPtr.h"
#include "nsWeakReference.h"
#include "nsIMsgDatabase.h"
#include "nsISpamSettings.h"
#include "nsIMsgFilterPlugin.h"
#include "nsDataHashtable.h"
#include "nsIMsgPluggableStore.h"
@@ -65,17 +65,17 @@ protected:
nsresult CreateRootFolder();
virtual nsresult CreateRootFolderFromUri(const nsCString &serverUri,
nsIMsgFolder **rootFolder) = 0;
nsresult InternalSetHostName(const nsACString& aHostname, const char * prefName);
nsresult getProtocolInfo(nsIMsgProtocolInfo **aResult);
- nsCOMPtr <nsILocalFile> mFilterFile;
+ nsCOMPtr <nsIFile> mFilterFile;
nsCOMPtr <nsIMsgFilterList> mFilterList;
nsCOMPtr <nsIMsgFilterList> mEditableFilterList;
nsCOMPtr<nsIPrefBranch> mPrefBranch;
nsCOMPtr<nsIPrefBranch> mDefPrefBranch;
// these allow us to handle duplicate incoming messages, e.g. delete them.
nsDataHashtable<nsCStringHashKey,PRInt32> m_downloadedHdrs;
PRInt32 m_numMsgsDownloaded;
--- a/mailnews/base/util/nsMsgMailNewsUrl.cpp
+++ b/mailnews/base/util/nsMsgMailNewsUrl.cpp
@@ -925,19 +925,18 @@ nsresult nsMsgSaveAsListener::SetupMsgWr
// nsMessenger::SaveAs now opens the stream on the nsIFile
// object, thus creating an empty file. Actual save operations for
// IMAP and NNTP use this nsMsgSaveAsListener here, though, so we
// have to close the stream before deleting the file, else data
// would still be written happily into a now non-existing file.
// (Windows doesn't care, btw, just unixoids do...)
aFile->Remove(false);
- nsCOMPtr <nsILocalFile> localFile = do_QueryInterface(aFile);
nsresult rv = MsgNewBufferedFileOutputStream(getter_AddRefs(m_outputStream),
- localFile, -1, 00600);
+ aFile, -1, 00600);
NS_ENSURE_SUCCESS(rv, rv);
if (m_outputStream && addDummyEnvelope)
{
nsCAutoString result;
PRUint32 writeCount;
time_t now = time((time_t*) 0);
--- a/mailnews/base/util/nsMsgUtils.cpp
+++ b/mailnews/base/util/nsMsgUtils.cpp
@@ -926,17 +926,17 @@ GetOrCreateFolder(const nsACString &aURI
nsCOMPtr <nsIMsgFolder> msgFolder;
rv = server->GetMsgFolderFromURI(folderResource, aURI, getter_AddRefs(msgFolder));
NS_ENSURE_SUCCESS(rv,rv);
nsCOMPtr <nsIMsgFolder> parent;
rv = msgFolder->GetParent(getter_AddRefs(parent));
if (NS_FAILED(rv) || !parent)
{
- nsCOMPtr <nsILocalFile> folderPath;
+ nsCOMPtr <nsIFile> folderPath;
// for local folders, path is to the berkeley mailbox.
// for imap folders, path needs to have .msf appended to the name
msgFolder->GetFilePath(getter_AddRefs(folderPath));
nsCString type;
rv = server->GetType(type);
NS_ENSURE_SUCCESS(rv,rv);
@@ -1147,17 +1147,17 @@ nsresult MSGApopMD5(const char *text, PR
memcpy(digest, result.get(), DIGEST_LENGTH);
return rv;
}
NS_MSG_BASE nsresult NS_GetPersistentFile(const char *relPrefName,
const char *absPrefName,
const char *dirServiceProp,
bool& gotRelPref,
- nsILocalFile **aFile,
+ nsIFile **aFile,
nsIPrefBranch *prefBranch)
{
NS_ENSURE_ARG_POINTER(aFile);
*aFile = nsnull;
NS_ENSURE_ARG(relPrefName);
NS_ENSURE_ARG(absPrefName);
gotRelPref = false;
@@ -1165,56 +1165,56 @@ NS_MSG_BASE nsresult NS_GetPersistentFil
if (!prefBranch) {
nsCOMPtr<nsIPrefService> prefService(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (!prefService) return NS_ERROR_FAILURE;
prefService->GetBranch(nsnull, getter_AddRefs(mainBranch));
if (!mainBranch) return NS_ERROR_FAILURE;
prefBranch = mainBranch;
}
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
// Get the relative first
nsCOMPtr<nsIRelativeFilePref> relFilePref;
prefBranch->GetComplexValue(relPrefName,
NS_GET_IID(nsIRelativeFilePref), getter_AddRefs(relFilePref));
if (relFilePref) {
relFilePref->GetFile(getter_AddRefs(localFile));
NS_ASSERTION(localFile, "An nsIRelativeFilePref has no file.");
if (localFile)
gotRelPref = true;
}
// If not, get the old absolute
if (!localFile) {
prefBranch->GetComplexValue(absPrefName,
- NS_GET_IID(nsILocalFile), getter_AddRefs(localFile));
+ NS_GET_IID(nsIFile), getter_AddRefs(localFile));
// If not, and given a dirServiceProp, use directory service.
if (!localFile && dirServiceProp) {
nsCOMPtr<nsIProperties> dirService(do_GetService("@mozilla.org/file/directory_service;1"));
if (!dirService) return NS_ERROR_FAILURE;
- dirService->Get(dirServiceProp, NS_GET_IID(nsILocalFile), getter_AddRefs(localFile));
+ dirService->Get(dirServiceProp, NS_GET_IID(nsIFile), getter_AddRefs(localFile));
if (!localFile) return NS_ERROR_FAILURE;
}
}
if (localFile) {
localFile->Normalize();
*aFile = localFile;
NS_ADDREF(*aFile);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
NS_MSG_BASE nsresult NS_SetPersistentFile(const char *relPrefName,
const char *absPrefName,
- nsILocalFile *aFile,
+ nsIFile *aFile,
nsIPrefBranch *prefBranch)
{
NS_ENSURE_ARG(relPrefName);
NS_ENSURE_ARG(absPrefName);
NS_ENSURE_ARG(aFile);
nsCOMPtr<nsIPrefBranch> mainBranch;
if (!prefBranch) {
@@ -1222,17 +1222,17 @@ NS_MSG_BASE nsresult NS_SetPersistentFil
if (!prefService) return NS_ERROR_FAILURE;
prefService->GetBranch(nsnull, getter_AddRefs(mainBranch));
if (!mainBranch) return NS_ERROR_FAILURE;
prefBranch = mainBranch;
}
// Write the absolute for backwards compatibilty's sake.
// Or, if aPath is on a different drive than the profile dir.
- nsresult rv = prefBranch->SetComplexValue(absPrefName, NS_GET_IID(nsILocalFile), aFile);
+ nsresult rv = prefBranch->SetComplexValue(absPrefName, NS_GET_IID(nsIFile), aFile);
// Write the relative path.
nsCOMPtr<nsIRelativeFilePref> relFilePref;
NS_NewRelativeFilePref(aFile, nsDependentCString(NS_APP_USER_PROFILE_50_DIR), getter_AddRefs(relFilePref));
if (relFilePref) {
nsresult rv2 = prefBranch->SetComplexValue(relPrefName, NS_GET_IID(nsIRelativeFilePref), relFilePref);
if (NS_FAILED(rv2) && NS_SUCCEEDED(rv))
prefBranch->ClearUserPref(relPrefName);
@@ -1311,20 +1311,20 @@ void Seconds2PRTime(PRUint32 seconds, PR
{
PRInt64 microSecondsPerSecond, intermediateResult;
LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
LL_UI2L(intermediateResult, seconds);
LL_MUL((*prTime), intermediateResult, microSecondsPerSecond);
}
-nsresult GetSummaryFileLocation(nsILocalFile* fileLocation, nsILocalFile** summaryLocation)
+nsresult GetSummaryFileLocation(nsIFile* fileLocation, nsIFile** summaryLocation)
{
nsresult rv;
- nsCOMPtr <nsILocalFile> newSummaryLocation = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr <nsIFile> newSummaryLocation = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
newSummaryLocation->InitWithFile(fileLocation);
nsString fileName;
rv = newSummaryLocation->GetLeafName(fileName);
if (NS_FAILED(rv))
return rv;
@@ -1355,27 +1355,27 @@ nsresult GetSpecialDirectoryWithFileName
{
nsresult rv = NS_GetSpecialDirectory(specialDirName, result);
NS_ENSURE_SUCCESS(rv, rv);
return (*result)->AppendNative(nsDependentCString(fileName));
}
-nsresult MsgGetFileStream(nsILocalFile *file, nsIOutputStream **fileStream)
+nsresult MsgGetFileStream(nsIFile *file, nsIOutputStream **fileStream)
{
nsMsgFileStream *newFileStream = new nsMsgFileStream;
NS_ENSURE_TRUE(newFileStream, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = newFileStream->InitWithFile(file);
if (NS_SUCCEEDED(rv))
rv = newFileStream->QueryInterface(NS_GET_IID(nsIOutputStream), (void **) fileStream);
return rv;
}
-nsresult MsgReopenFileStream(nsILocalFile *file, nsIInputStream *fileStream)
+nsresult MsgReopenFileStream(nsIFile *file, nsIInputStream *fileStream)
{
nsMsgFileStream *msgFileStream = static_cast<nsMsgFileStream *>(fileStream);
if (msgFileStream)
return msgFileStream->InitWithFile(file);
else
return NS_ERROR_FAILURE;
}
@@ -1470,17 +1470,17 @@ bool MsgHostDomainIsTrusted(nsCString &h
}
}
domain = end + 1;
} while (*end);
return domainIsTrusted;
}
-nsresult MsgGetLocalFileFromURI(const nsACString &aUTF8Path, nsILocalFile **aFile)
+nsresult MsgGetLocalFileFromURI(const nsACString &aUTF8Path, nsIFile **aFile)
{
nsresult rv;
nsCOMPtr<nsIURI> argURI;
rv = NS_NewURI(getter_AddRefs(argURI), aUTF8Path);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIFileURL> argFileURL(do_QueryInterface(argURI, &rv));
NS_ENSURE_SUCCESS(rv, rv);
@@ -2215,17 +2215,17 @@ public:
private:
nsCString mCharset;
};
NS_IMPL_ISUPPORTS1(CharsetDetectionObserver, nsICharsetDetectionObserver)
NS_MSG_BASE nsresult
-MsgDetectCharsetFromFile(nsILocalFile *aFile, nsACString &aCharset)
+MsgDetectCharsetFromFile(nsIFile *aFile, nsACString &aCharset)
{
// First try the universal charset detector
nsCOMPtr<nsICharsetDetector> detector
= do_CreateInstance(NS_CHARSET_DETECTOR_CONTRACTID_BASE
"universal_charset_detector");
if (!detector) {
// No universal charset detector, try the default charset detector
nsString detectorName;
--- a/mailnews/base/util/nsMsgUtils.h
+++ b/mailnews/base/util/nsMsgUtils.h
@@ -15,19 +15,19 @@
#include "nsTArray.h"
#include "nsIInterfaceRequestor.h"
#include "nsILoadGroup.h"
#include "nsISupportsArray.h"
#include "nsIAtom.h"
#include "nsINetUtil.h"
#include "nsServiceManagerUtils.h"
#include "nsUnicharUtils.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
-class nsILocalFile;
+class nsIFile;
class nsIPrefBranch;
class nsIMsgFolder;
class nsIMsgMessageService;
class nsIUrlListener;
class nsIOutputStream;
class nsIInputStream;
class nsIMsgDatabase;
class nsIMutableArray;
@@ -114,22 +114,22 @@ NS_MSG_BASE nsresult GetExistingFolder(c
// Escape lines starting with "From ", ">From ", etc. in a buffer.
NS_MSG_BASE nsresult EscapeFromSpaceLine(nsIOutputStream *ouputStream, char *start, const char *end);
NS_MSG_BASE bool IsAFromSpaceLine(char *start, const char *end);
NS_MSG_BASE nsresult NS_GetPersistentFile(const char *relPrefName,
const char *absPrefName,
const char *dirServiceProp, // Can be NULL
bool& gotRelPref,
- nsILocalFile **aFile,
+ nsIFile **aFile,
nsIPrefBranch *prefBranch = nsnull);
NS_MSG_BASE nsresult NS_SetPersistentFile(const char *relPrefName,
const char *absPrefName,
- nsILocalFile *aFile,
+ nsIFile *aFile,
nsIPrefBranch *prefBranch = nsnull);
NS_MSG_BASE nsresult IsRFC822HeaderFieldName(const char *aHdr, bool *aResult);
NS_MSG_BASE nsresult NS_GetUnicharPreferenceWithDefault(nsIPrefBranch *prefBranch, //can be null, if so uses the root branch
const char *prefName,
const nsAString& defValue,
nsAString& prefValue);
@@ -158,39 +158,39 @@ NS_MSG_BASE nsresult MSGApopMD5(const ch
NS_MSG_BASE void PRTime2Seconds(PRTime prTime, PRUint32 *seconds);
NS_MSG_BASE void PRTime2Seconds(PRTime prTime, PRInt32 *seconds);
NS_MSG_BASE void Seconds2PRTime(PRUint32 seconds, PRTime *prTime);
// helper function to generate current date+time as a string
NS_MSG_BASE void MsgGenerateNowStr(nsACString &nowStr);
// Appends the correct summary file extension onto the supplied fileLocation
// and returns it in summaryLocation.
-NS_MSG_BASE nsresult GetSummaryFileLocation(nsILocalFile* fileLocation,
- nsILocalFile** summaryLocation);
+NS_MSG_BASE nsresult GetSummaryFileLocation(nsIFile* fileLocation,
+ nsIFile** summaryLocation);
// Gets a special directory and appends the supplied file name onto it.
NS_MSG_BASE nsresult GetSpecialDirectoryWithFileName(const char* specialDirName,
const char* fileName,
nsIFile** result);
-NS_MSG_BASE nsresult MsgGetFileStream(nsILocalFile *file, nsIOutputStream **fileStream);
+NS_MSG_BASE nsresult MsgGetFileStream(nsIFile *file, nsIOutputStream **fileStream);
-NS_MSG_BASE nsresult MsgReopenFileStream(nsILocalFile *file, nsIInputStream *fileStream);
+NS_MSG_BASE nsresult MsgReopenFileStream(nsIFile *file, nsIInputStream *fileStream);
// Automatically creates an output stream with a 4K buffer
NS_MSG_BASE nsresult MsgNewBufferedFileOutputStream(nsIOutputStream **aResult, nsIFile *aFile, PRInt32 aIOFlags = -1, PRInt32 aPerm = -1);
// fills in the position of the passed in keyword in the passed in keyword list
// and returns false if the keyword isn't present
NS_MSG_BASE bool MsgFindKeyword(const nsCString &keyword, nsCString &keywords, PRInt32 *aStartOfKeyword, PRInt32 *aLength);
NS_MSG_BASE bool MsgHostDomainIsTrusted(nsCString &host, nsCString &trustedMailDomains);
-// gets an nsILocalFile from a UTF-8 file:// path
-NS_MSG_BASE nsresult MsgGetLocalFileFromURI(const nsACString &aUTF8Path, nsILocalFile **aFile);
+// gets an nsIFile from a UTF-8 file:// path
+NS_MSG_BASE nsresult MsgGetLocalFileFromURI(const nsACString &aUTF8Path, nsIFile **aFile);
NS_MSG_BASE void MsgStripQuotedPrintable (unsigned char *src);
/*
* Utility function copied from nsReadableUtils
*/
NS_MSG_BASE bool MsgIsUTF8(const nsACString& aString);
@@ -267,20 +267,20 @@ MsgStreamMsgHeaders(nsIInputStream *aInp
* @param str conveted string
* @returns PRUint64 vaule for success, 0 for parse failure
*/
NS_MSG_BASE PRUint64 ParseUint64Str(const char *str);
/**
* Detect charset of file
*
- * @param aFile The target of nsILocalFile
+ * @param aFile The target of nsIFile
* @param[out] aCharset The charset string
*/
-NS_MSG_BASE nsresult MsgDetectCharsetFromFile(nsILocalFile *aFile, nsACString &aCharset);
+NS_MSG_BASE nsresult MsgDetectCharsetFromFile(nsIFile *aFile, nsACString &aCharset);
/*
* Converts a buffer to plain text. Some conversions may
* or may not work with certain end charsets which is why we
* need that as an argument to the function. If charset is
* unknown or deemed of no importance NULL could be passed.
* @param[in/out] aConBuf Variable with the text to convert
* @param formatFlowed Use format flowed?
--- a/mailnews/compose/public/nsIMsgSend.idl
+++ b/mailnews/compose/public/nsIMsgSend.idl
@@ -29,17 +29,17 @@
interface nsIMsgProgress;
interface nsIURI;
interface nsIRequest;
interface nsIMsgDBHdr;
interface nsIMsgHdr;
interface nsIDocShell;
interface nsIFile;
-interface nsILocalFile;
+interface nsIFile;
interface nsIOutputStream;
interface nsIMsgComposeSecure;
interface nsIMsgStatusFeedback;
interface nsIEditor;
interface nsIArray;
interface nsISupportsArray;
typedef long nsMsgDeliverMode;
@@ -95,17 +95,17 @@ interface nsIMsgAttachmentData : nsISupp
*/
[scriptable, uuid(c552345d-c74b-40b0-a673-79bb461e920b)]
interface nsIMsgAttachedFile : nsISupports
{
/// Where it came from on the network (or even elsewhere on the local disk.)
attribute nsIURI origUrl;
/// The tmp file in which the (possibly converted) data now resides.
- attribute nsILocalFile tmpFile;
+ attribute nsIFile tmpFile;
/// The type of the data in file_name (not necessarily the same as the type of orig_url.)
attribute ACString type;
/**
* The encoding of the tmp file. This will be set only if the original
* document had an encoding already; we don't do base64 encoding and so forth
* until it's time to assemble a full MIME message of all parts.
@@ -193,17 +193,17 @@ public:
NS_DECL_NSIMSGATTACHEDFILE
NS_DECL_ISUPPORTS
nsMsgAttachedFile();
~nsMsgAttachedFile();
nsCOMPtr<nsIURI> m_origUrl; // Where it came from on the network (or even elsewhere on the local disk.)
- nsCOMPtr<nsILocalFile> m_tmpFile; // The tmp file in which the (possibly converted) data now resides.
+ nsCOMPtr<nsIFile> m_tmpFile; // The tmp file in which the (possibly converted) data now resides.
nsCString m_type; // The type of the data in file_name (not necessarily the same as the type of orig_url.)
nsCString m_encoding; // Likewise, the encoding of the tmp file. This will be set only if the original
// document had an encoding already; we don't do base64 encoding and so forth until
// it's time to assemble a full MIME message of all parts.
--- a/mailnews/compose/public/nsIURLFetcher.idl
+++ b/mailnews/compose/public/nsIURLFetcher.idl
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
#include "nsIURI.idl"
#include "nsIFileStreams.idl"
-#include "nsILocalFile.idl"
+#include "nsIFile.idl"
%{ C++
//
// Callback declarations for URL completion
//
// For completion of send/message creation operations...
typedef nsresult (*nsAttachSaveCompletionCallback) (nsresult aStatus,
@@ -25,12 +25,12 @@ typedef nsresult (*nsAttachSaveCompletio
native nsAttachSaveCompletionCallback(nsAttachSaveCompletionCallback);
[noscript, uuid(4f3ad52d-888d-487d-961c-9c727c35434c)]
interface nsIURLFetcher : nsISupports
{
boolean stillRunning();
- void fireURLRequest(in nsIURI aURL, in nsILocalFile localFile, in nsIOutputStream fileStream, in nsAttachSaveCompletionCallback cb, in voidPtr tagData);
+ void fireURLRequest(in nsIURI aURL, in nsIFile localFile, in nsIOutputStream fileStream, in nsAttachSaveCompletionCallback cb, in voidPtr tagData);
- void initialize(in nsILocalFile localFile, in nsIOutputStream fileStream, in nsAttachSaveCompletionCallback cb, in voidPtr tagData);
+ void initialize(in nsIFile localFile, in nsIOutputStream fileStream, in nsAttachSaveCompletionCallback cb, in voidPtr tagData);
};
--- a/mailnews/compose/src/nsMsgAppleDouble.h
+++ b/mailnews/compose/src/nsMsgAppleDouble.h
@@ -159,17 +159,17 @@ typedef struct _appledouble_decode_objec
int uu_bytes_written; /* bytes written from the current tuple (uuencode) */
int uu_line_bytes; /* encoded bytes remaining in the current line (uuencode) */
char *inbuff; /* the outbuff by the caller. */
int s_inbuff; /* the size of the buffer. */
int pos_inbuff; /* the offset in the current buffer. */
- nsCOMPtr <nsILocalFile> tmpFile; /* the temp file to hold the decode data fork */
+ nsCOMPtr <nsIFile> tmpFile; /* the temp file to hold the decode data fork */
/* when doing the binhex exporting. */
nsCOMPtr <nsIOutputStream> tmpFileStream; /* The output File Stream */
PRInt32 data_size; /* the size of the data in the tmp file. */
} appledouble_decode_object;
/*
--- a/mailnews/compose/src/nsMsgAppleDoubleEncode.cpp
+++ b/mailnews/compose/src/nsMsgAppleDoubleEncode.cpp
@@ -23,17 +23,17 @@
#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsMimeTypes.h"
#include "prmem.h"
#include "nsNetUtil.h"
void
-MacGetFileType(nsILocalFile *fs,
+MacGetFileType(nsIFile *fs,
bool *useDefault,
char **fileType,
char **encoding)
{
if ((fs == NULL) || (fileType == NULL) || (encoding == NULL))
return;
bool exists = false;
@@ -88,17 +88,17 @@ MacGetFileType(nsILocalFile *fs,
*
* Setup the encode envirment
*/
int ap_encode_init( appledouble_encode_object *p_ap_encode_obj,
const char *fname,
char *separator)
{
- nsCOMPtr <nsILocalFile> myFile;
+ nsCOMPtr <nsIFile> myFile;
NS_NewNativeLocalFile(nsDependentCString(fname), true, getter_AddRefs(myFile));
bool exists;
if (myFile && NS_SUCCEEDED(myFile->Exists(&exists)) && !exists)
return -1;
nsCOMPtr<nsILocalFileMac> macFile = do_QueryInterface(myFile);
nsCAutoString path;
macFile->GetNativePath(path);
--- a/mailnews/compose/src/nsMsgAppleEncode.cpp
+++ b/mailnews/compose/src/nsMsgAppleEncode.cpp
@@ -119,17 +119,17 @@ int ap_encode_file_infor(
ap_header head;
ap_entry entries[NUM_ENTRIES];
ap_dates dates;
short i;
long comlen;
char comment[256];
int status;
- nsCOMPtr <nsILocalFile> resFile;
+ nsCOMPtr <nsIFile> resFile;
NS_NewNativeLocalFile(nsDependentCString(p_ap_encode_obj->fname), true,
getter_AddRefs(resFile));
if (!resFile)
return errFileOpen;
FSRef ref;
nsCOMPtr <nsILocalFileMac> macFile = do_QueryInterface(resFile);
if (NS_FAILED(macFile->GetFSRef(&ref)))
@@ -294,17 +294,17 @@ int ap_encode_header(
status = ap_encode_file_infor(p_ap_encode_obj);
if (status != noErr)
return status;
/*
** preparing to encode the resource fork.
*/
- nsCOMPtr <nsILocalFile> myFile;
+ nsCOMPtr <nsIFile> myFile;
NS_NewNativeLocalFile(nsDependentCString(p_ap_encode_obj->fname), true, getter_AddRefs(myFile));
if (!myFile)
return errFileOpen;
FSRef ref;
nsCOMPtr <nsILocalFileMac> macFile = do_QueryInterface(myFile);
if (NS_FAILED(macFile->GetFSRef(&ref)))
return errFileOpen;
@@ -437,17 +437,17 @@ int ap_encode_data(
if (firstime)
{
char* magic_type;
/*
** preparing to encode the data fork.
*/
- nsCOMPtr <nsILocalFile> resFile;
+ nsCOMPtr <nsIFile> resFile;
NS_NewNativeLocalFile(nsDependentCString(p_ap_encode_obj->fname), true,
getter_AddRefs(resFile));
if (!resFile)
return errFileOpen;
FSRef ref;
nsCOMPtr <nsILocalFileMac> macFile = do_QueryInterface(resFile);
if (NS_FAILED(macFile->GetFSRef(&ref)))
--- a/mailnews/compose/src/nsMsgAttachment.cpp
+++ b/mailnews/compose/src/nsMsgAttachment.cpp
@@ -1,15 +1,15 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsMsgAttachment.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsNetUtil.h"
NS_IMPL_ISUPPORTS1(nsMsgAttachment, nsIMsgAttachment)
nsMsgAttachment::nsMsgAttachment()
{
mTemporary = false;
mSendViaCloud = false;
--- a/mailnews/compose/src/nsMsgAttachmentHandler.cpp
+++ b/mailnews/compose/src/nsMsgAttachmentHandler.cpp
@@ -37,17 +37,17 @@
///////////////////////////////////////////////////////////////////////////
// Mac Specific Attachment Handling for AppleDouble Encoded Files
///////////////////////////////////////////////////////////////////////////
#ifdef XP_MACOSX
#define AD_WORKING_BUFF_SIZE 8192
-extern void MacGetFileType(nsILocalFile *fs, bool *useDefault, char **type, char **encoding);
+extern void MacGetFileType(nsIFile *fs, bool *useDefault, char **type, char **encoding);
#include "nsILocalFileMac.h"
/* static */
nsresult nsSimpleZipper::Zip(nsIFile *aInputFile, nsIFile *aOutputFile)
{
// create zipwriter object
nsresult rv;
@@ -426,17 +426,17 @@ DONE:
}
nsresult
nsMsgAttachmentHandler::PickCharset()
{
if (!m_charset.IsEmpty() || !m_type.LowerCaseEqualsLiteral(TEXT_PLAIN))
return NS_OK;
- nsCOMPtr<nsILocalFile> tmpFile =
+ nsCOMPtr<nsIFile> tmpFile =
do_QueryInterface(mTmpFile);
if (!tmpFile)
return NS_OK;
return MsgDetectCharsetFromFile(tmpFile, m_charset);
}
static nsresult
@@ -639,17 +639,17 @@ nsMsgAttachmentHandler::SnarfAttachment(
if (!m_bogus_attachment && StringBeginsWith(sourceURISpec, NS_LITERAL_CSTRING("file://")))
{
// Unescape the path (i.e. un-URLify it) before making a FSSpec
nsCAutoString filePath;
filePath.Adopt(nsMsgGetLocalFileFromURL(sourceURISpec.get()));
nsCAutoString unescapedFilePath;
MsgUnescapeString(filePath, 0, unescapedFilePath);
- nsCOMPtr<nsILocalFile> sourceFile;
+ nsCOMPtr<nsIFile> sourceFile;
NS_NewNativeLocalFile(unescapedFilePath, true, getter_AddRefs(sourceFile));
if (!sourceFile)
return NS_ERROR_FAILURE;
// check if it is a bundle. if it is, we'll zip it.
// if not, we'll apple encode it (applesingle or appledouble)
nsCOMPtr<nsILocalFileMac> macFile(do_QueryInterface(sourceFile));
bool isPackage;
@@ -916,17 +916,17 @@ nsMsgAttachmentHandler::ConvertToAppleEn
// don't bother to set the types if we failed in getting the file info.
}
return NS_OK;
}
#endif // XP_MACOSX
nsresult
-nsMsgAttachmentHandler::LoadDataFromFile(nsILocalFile *file, nsString &sigData, bool charsetConversion)
+nsMsgAttachmentHandler::LoadDataFromFile(nsIFile *file, nsString &sigData, bool charsetConversion)
{
PRInt32 readSize;
char *readBuf;
nsCOMPtr <nsIInputStream> inputFile;
nsresult rv = NS_NewLocalFileInputStream(getter_AddRefs(inputFile), file);
if (NS_FAILED(rv))
return NS_MSG_ERROR_WRITING_FILE;
@@ -993,17 +993,17 @@ nsMsgAttachmentHandler::UrlExit(nsresult
NS_ASSERTION(m_mime_delivery_state != nsnull, "not-null m_mime_delivery_state");
// Close the file, but don't delete the disk file (or the file spec.)
if (mOutFile)
{
mOutFile->Close();
mOutFile = nsnull;
}
- // this silliness is because Windows nsILocalFile caches its file size
+ // this silliness is because Windows nsIFile caches its file size
// so if an output stream writes to it, it will still return the original
// cached size.
if (mTmpFile)
{
nsCOMPtr <nsIFile> tmpFile;
mTmpFile->Clone(getter_AddRefs(tmpFile));
mTmpFile = do_QueryInterface(tmpFile);
}
@@ -1131,17 +1131,17 @@ nsMsgAttachmentHandler::UrlExit(nsresult
if (NS_FAILED(ConvertFromUnicode(m_charset.get(), conData, tData)))
LossyCopyUTF16toASCII(conData, tData);
if (!tData.IsEmpty())
{
PRUint32 bytesWritten;
(void) outputStream->Write(tData.get(), tData.Length(), &bytesWritten);
}
outputStream->Close();
- // this silliness is because Windows nsILocalFile caches its file size
+ // this silliness is because Windows nsIFile caches its file size
// so if an output stream writes to it, it will still return the original
// cached size.
if (mTmpFile)
{
nsCOMPtr <nsIFile> tmpFile;
mTmpFile->Clone(getter_AddRefs(tmpFile));
mTmpFile = do_QueryInterface(tmpFile);
}
--- a/mailnews/compose/src/nsMsgAttachmentHandler.h
+++ b/mailnews/compose/src/nsMsgAttachmentHandler.h
@@ -77,39 +77,39 @@ public:
void CleanupTempFile();
private:
// use when a message (e.g. original message in a reply) is attached as a rfc822 attachment.
nsresult SnarfMsgAttachment(nsMsgCompFields *compFields);
bool UseUUEncode_p(void);
void AnalyzeDataChunk (const char *chunk, PRInt32 chunkSize);
- nsresult LoadDataFromFile(nsILocalFile *file, nsString &sigData, bool charsetConversion); //A similar function already exist in nsMsgCompose!
+ nsresult LoadDataFromFile(nsIFile *file, nsString &sigData, bool charsetConversion); //A similar function already exist in nsMsgCompose!
#ifdef XP_MACOSX
nsresult ConvertToAppleEncoding(const nsCString &aFileSpecURI,
const nsCString &aFilePath,
nsILocalFileMac *aSourceFile);
// zips this attachment and does the work to make this attachment handler handle it properly.
nsresult ConvertToZipFile(nsILocalFileMac *aSourceFile);
bool HasResourceFork(FSRef *fsRef);
#endif
//
public:
nsCOMPtr<nsIURI> mURL;
- nsCOMPtr<nsILocalFile> mTmpFile; // The temp file to which we save it
+ nsCOMPtr<nsIFile> mTmpFile; // The temp file to which we save it
nsCOMPtr<nsIOutputStream> mOutFile;
nsCOMPtr<nsIRequest> mRequest; // The live request used while fetching an attachment
nsMsgCompFields *mCompFields; // Message composition fields for the sender
bool m_bogus_attachment; // This is to catch problem children...
#ifdef XP_MACOSX
// if we need to encode this file into for example an appledouble, or zip file,
// this file is our working file. currently only needed on mac.
- nsCOMPtr<nsILocalFile> mEncodedWorkingFile;
+ nsCOMPtr<nsIFile> mEncodedWorkingFile;
#endif
nsCString m_xMacType; // Mac file type
nsCString m_xMacCreator; // Mac file creator
bool m_done;
nsCString m_charset; // charset name
nsCString m_contentId; // This is for mutipart/related Content-ID's
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -4001,30 +4001,30 @@ NS_IMETHODIMP nsMsgComposeSendListener::
/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */
NS_IMETHODIMP nsMsgComposeSendListener::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, PRUint32 state)
{
/* Ignore this call */
return NS_OK;
}
nsresult
-nsMsgCompose::ConvertHTMLToText(nsILocalFile *aSigFile, nsString &aSigData)
+nsMsgCompose::ConvertHTMLToText(nsIFile *aSigFile, nsString &aSigData)
{
nsAutoString origBuf;
nsresult rv = LoadDataFromFile(aSigFile, origBuf);
NS_ENSURE_SUCCESS (rv, rv);
ConvertBufToPlainText(origBuf, false, true);
aSigData = origBuf;
return NS_OK;
}
nsresult
-nsMsgCompose::ConvertTextToHTML(nsILocalFile *aSigFile, nsString &aSigData)
+nsMsgCompose::ConvertTextToHTML(nsIFile *aSigFile, nsString &aSigData)
{
nsresult rv;
nsAutoString origBuf;
rv = LoadDataFromFile(aSigFile, origBuf);
if (NS_FAILED(rv))
return rv;
@@ -4038,17 +4038,17 @@ nsMsgCompose::ConvertTextToHTML(nsILocal
NS_Free(escaped);
}
else
aSigData.Append(origBuf);
return NS_OK;
}
nsresult
-nsMsgCompose::LoadDataFromFile(nsILocalFile *file, nsString &sigData,
+nsMsgCompose::LoadDataFromFile(nsIFile *file, nsString &sigData,
bool aAllowUTF8, bool aAllowUTF16)
{
PRInt32 readSize;
PRUint32 nGot;
char *readBuf;
char *ptr;
bool isDirectory = false;
@@ -4179,17 +4179,17 @@ nsMsgCompose::ProcessSignature(nsIMsgIde
bool htmlSig = false;
bool imageSig = false;
nsAutoString sigData;
nsAutoString sigOutput;
PRInt32 reply_on_top = 0;
bool sig_bottom = true;
bool suppressSigSep = false;
- nsCOMPtr<nsILocalFile> sigFile;
+ nsCOMPtr<nsIFile> sigFile;
if (identity)
{
if (!CheckIncludeSignaturePrefs(identity))
return NS_OK;
identity->GetReplyOnTop(&reply_on_top);
identity->GetSigBottom(&sig_bottom);
identity->GetSuppressSigSep(&suppressSigSep);
--- a/mailnews/compose/src/nsMsgCompose.h
+++ b/mailnews/compose/src/nsMsgCompose.h
@@ -45,31 +45,31 @@ class nsMsgCompose : public nsIMsgCompos
/* nsIMsgSendListener interface */
NS_DECL_NSIMSGSENDLISTENER
private:
// Deal with quoting issues...
nsresult QuoteOriginalMessage(); // New template
nsresult SetQuotingToFollow(bool aVal);
- nsresult ConvertHTMLToText(nsILocalFile *aSigFile, nsString &aSigData);
- nsresult ConvertTextToHTML(nsILocalFile *aSigFile, nsString &aSigData);
+ nsresult ConvertHTMLToText(nsIFile *aSigFile, nsString &aSigData);
+ nsresult ConvertTextToHTML(nsIFile *aSigFile, nsString &aSigData);
bool IsEmbeddedObjectSafe(const char * originalScheme,
const char * originalHost,
const char * originalPath,
nsIDOMNode * object);
nsresult ResetUrisForEmbeddedObjects();
nsresult TagEmbeddedObjects(nsIEditorMailSupport *aMailEditor);
nsCString mQuoteCharset;
nsCString mOriginalMsgURI; // used so we can mark message disposition flags after we send the message
PRInt32 mWhatHolder;
- nsresult LoadDataFromFile(nsILocalFile *file,
+ nsresult LoadDataFromFile(nsIFile *file,
nsString &sigData,
bool aAllowUTF8 = true,
bool aAllowUTF16 = true);
bool CheckIncludeSignaturePrefs(nsIMsgIdentity *identity);
//m_folderName to store the value of the saved drafts folder.
nsCString m_folderName;
void InsertDivWrappedTextAtSelection(const nsAString &aText,
--- a/mailnews/compose/src/nsMsgCopy.cpp
+++ b/mailnews/compose/src/nsMsgCopy.cpp
@@ -364,17 +364,17 @@ nsMsgCopy::CreateIfMissing(nsIMsgFolder
{
nsresult ret = NS_OK;
if (folder && *folder)
{
nsCOMPtr <nsIMsgFolder> parent;
(*folder)->GetParent(getter_AddRefs(parent));
if (!parent)
{
- nsCOMPtr <nsILocalFile> folderPath;
+ nsCOMPtr <nsIFile> folderPath;
// for local folders, path is to the berkeley mailbox.
// for imap folders, path needs to have .msf appended to the name
(*folder)->GetFilePath(getter_AddRefs(folderPath));
bool isImapFolder = !PL_strncasecmp(mSavePref, "imap:", 5);
// if we can't get the path from the folder, then try to create the storage.
// for imap, it doesn't matter if the .msf file exists - it still might not
// exist on the server, so we should try to create it
bool exists = false;
--- a/mailnews/compose/src/nsMsgSend.cpp
+++ b/mailnews/compose/src/nsMsgSend.cpp
@@ -1428,43 +1428,39 @@ nsMsgComposeAndSend::GetEmbeddedObjectIn
if (fileUrl)
{
bool isAValidFile = false;
nsCOMPtr<nsIFile> aFile;
rv = fileUrl->GetFile(getter_AddRefs(aFile));
if (NS_SUCCEEDED(rv) && aFile)
{
- nsCOMPtr<nsILocalFile> aLocalFile (do_QueryInterface(aFile));
- if (aLocalFile)
+ rv = aFile->IsFile(&isAValidFile);
+ if (NS_FAILED(rv))
+ isAValidFile = false;
+ else
{
- rv = aLocalFile->IsFile(&isAValidFile);
- if (NS_FAILED(rv))
- isAValidFile = false;
- else
+ if (anchor)
{
- if (anchor)
- {
- // One more test, if the anchor points to a local network server, let's check what the pref
- // mail.compose.dont_attach_source_of_local_network_links tells us to do.
- nsCAutoString urlSpec;
- rv = attachment->m_url->GetSpec(urlSpec);
- if (NS_SUCCEEDED(rv))
- if (StringBeginsWith(urlSpec, NS_LITERAL_CSTRING("file://///")))
+ // One more test, if the anchor points to a local network server, let's check what the pref
+ // mail.compose.dont_attach_source_of_local_network_links tells us to do.
+ nsCAutoString urlSpec;
+ rv = attachment->m_url->GetSpec(urlSpec);
+ if (NS_SUCCEEDED(rv))
+ if (StringBeginsWith(urlSpec, NS_LITERAL_CSTRING("file://///")))
+ {
+ nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
+ if (pPrefBranch)
{
- nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
- if (pPrefBranch)
- {
- bool dontSend = false;
- rv = pPrefBranch->GetBoolPref(PREF_MAIL_DONT_ATTACH_SOURCE, &dontSend);
- if (dontSend)
- isAValidFile = false;
- }
+ bool dontSend = false;
+ rv = pPrefBranch->GetBoolPref(PREF_MAIL_DONT_ATTACH_SOURCE, &dontSend);
+ if (dontSend)
+ isAValidFile = false;
}
- }
+ }
}
}
}
if (! isAValidFile)
return NS_OK;
}
}
@@ -2435,17 +2431,17 @@ nsMsgComposeAndSend::HackAttachments(nsI
// If we still don't have a content type, we should really try sniff one out!
if (m_attachments[i].m_type.IsEmpty())
m_attachments[i].PickEncoding(mCompFields->GetCharacterSet(), this);
// For local files, if they are HTML docs and we don't have a charset, we should
// sniff the file and see if we can figure it out.
if (!m_attachments[i].m_type.IsEmpty())
{
- nsCOMPtr<nsILocalFile> tmpFile;
+ nsCOMPtr<nsIFile> tmpFile;
attachedFile->GetTmpFile(getter_AddRefs(tmpFile));
if (m_attachments[i].m_type.LowerCaseEqualsLiteral(TEXT_HTML) && tmpFile)
{
char *tmpCharset = (char *)nsMsgI18NParseMetaCharset(tmpFile);
if (tmpCharset[0] != '\0')
m_attachments[i].m_charset = tmpCharset;
}
}
@@ -5163,24 +5159,24 @@ NS_IMETHODIMP nsMsgAttachedFile::GetOrig
}
NS_IMETHODIMP nsMsgAttachedFile::SetOrigUrl(nsIURI *aOrigUrl)
{
m_origUrl = aOrigUrl;
return NS_OK;
}
-NS_IMETHODIMP nsMsgAttachedFile::GetTmpFile(nsILocalFile **aTmpFile)
+NS_IMETHODIMP nsMsgAttachedFile::GetTmpFile(nsIFile **aTmpFile)
{
NS_ENSURE_ARG_POINTER(aTmpFile);
NS_IF_ADDREF(*aTmpFile = m_tmpFile);
return NS_OK;
}
-NS_IMETHODIMP nsMsgAttachedFile::SetTmpFile(nsILocalFile *aTmpFile)
+NS_IMETHODIMP nsMsgAttachedFile::SetTmpFile(nsIFile *aTmpFile)
{
m_tmpFile = aTmpFile;
return NS_OK;
}
NS_IMETHODIMP nsMsgAttachedFile::GetType(nsACString &aType)
{
aType = m_type;
--- a/mailnews/compose/src/nsMsgSendPart.cpp
+++ b/mailnews/compose/src/nsMsgSendPart.cpp
@@ -75,17 +75,17 @@ int nsMsgSendPart::CopyString(char** des
*dest = PL_strdup("");
else
*dest = PL_strdup(src);
return *dest? 0 : NS_ERROR_OUT_OF_MEMORY;
}
-nsresult nsMsgSendPart::SetFile(nsILocalFile *file)
+nsresult nsMsgSendPart::SetFile(nsIFile *file)
{
m_file = file;
return NS_OK;
}
int nsMsgSendPart::SetBuffer(const char* buffer)
{
--- a/mailnews/compose/src/nsMsgSendPart.h
+++ b/mailnews/compose/src/nsMsgSendPart.h
@@ -16,18 +16,18 @@ typedef int (*MSG_SendPartWriteFunc)(con
class nsMsgSendPart {
public:
nsMsgSendPart(nsIMsgSend* state, const char *part_charset = NULL);
virtual ~nsMsgSendPart(); // Note that the destructor also destroys
// any children that were added.
virtual int Write();
- virtual nsresult SetFile(nsILocalFile *filename);
- const nsILocalFile *GetFile() {return m_file;}
+ virtual nsresult SetFile(nsIFile *filename);
+ const nsIFile *GetFile() {return m_file;}
virtual int SetBuffer(const char* buffer);
const char *GetBuffer() {return m_buffer;}
virtual int SetType(const char* type);
const char *GetType() {return m_type;}
const char *GetCharsetName() {return m_charset_name;}
@@ -65,17 +65,17 @@ public:
}
nsCString m_partNum;
protected:
int CopyString(char** dest, const char* src);
int PushBody(const char* buffer, PRInt32 length);
nsCOMPtr<nsIMsgSend> m_state;
nsMsgSendPart *m_parent;
- nsCOMPtr <nsILocalFile> m_file;
+ nsCOMPtr <nsIFile> m_file;
char *m_buffer;
char *m_type;
char *m_other;
char m_charset_name[64+1]; // charset name associated with this part
bool m_strip_sensitive_headers;
MimeEncoderData *m_encoder_data; /* Opaque state for base64/qp encoder. */
nsMsgSendPart **m_children;
--- a/mailnews/compose/src/nsURLFetcher.cpp
+++ b/mailnews/compose/src/nsURLFetcher.cpp
@@ -284,33 +284,33 @@ nsURLFetcher::OnStopRequest(nsIRequest *
if (mCallback)
mCallback (aStatus, mContentType, mCharset, mTotalWritten, nsnull, mTagData);
// Time to return...
return NS_OK;
}
nsresult
-nsURLFetcher::Initialize(nsILocalFile *localFile,
+nsURLFetcher::Initialize(nsIFile *localFile,
nsIOutputStream *outputStream,
nsAttachSaveCompletionCallback cb,
void *tagData)
{
if (!outputStream || !localFile)
return NS_ERROR_INVALID_ARG;
mOutStream = outputStream;
mLocalFile = localFile;
mCallback = cb; //JFD: Please, no more callback, use a listener...
mTagData = tagData; //JFD: TODO, WE SHOULD USE A NSCOMPTR to hold this stuff!!!
return NS_OK;
}
nsresult
-nsURLFetcher::FireURLRequest(nsIURI *aURL, nsILocalFile *localFile, nsIOutputStream *outputStream,
+nsURLFetcher::FireURLRequest(nsIURI *aURL, nsIFile *localFile, nsIOutputStream *outputStream,
nsAttachSaveCompletionCallback cb, void *tagData)
{
nsresult rv;
rv = Initialize(localFile, outputStream, cb, tagData);
NS_ENSURE_SUCCESS(rv, rv);
//check to see if aURL is a local file or not
--- a/mailnews/compose/src/nsURLFetcher.h
+++ b/mailnews/compose/src/nsURLFetcher.h
@@ -51,17 +51,17 @@ public:
// Methods for nsIWebProgressListener
NS_DECL_NSIWEBPROGRESSLISTENER
protected:
nsresult InsertConverter(const char * aContentType);
private:
nsCOMPtr<nsIOutputStream> mOutStream; // the output file stream
- nsCOMPtr<nsILocalFile> mLocalFile; // the output file itself
+ nsCOMPtr<nsIFile> mLocalFile; // the output file itself
nsCOMPtr<nsIStreamListener> mConverter; // the stream converter, if needed
nsCString mConverterContentType; // The content type of the converter
bool mStillRunning; // Are we still running?
PRInt32 mTotalWritten; // Size counter variable
char *mBuffer; // Buffer used for reading the data
PRUint32 mBufferSize; // Buffer size;
nsCString mContentType; // The content type retrieved from the server
nsCString mCharset; // The charset retrieved from the server
--- a/mailnews/db/msgdb/public/nsIMsgDatabase.idl
+++ b/mailnews/db/msgdb/public/nsIMsgDatabase.idl
@@ -34,17 +34,17 @@ interface nsIMsgDBHdr;
interface nsISimpleEnumerator;
interface nsIMsgThread;
interface nsIDBFolderInfo;
interface nsIMsgOfflineImapOperation;
interface nsIMsgFolder;
interface nsIMsgKeyArray;
interface nsIOutputStream;
interface nsIUrlListener;
-interface nsILocalFile;
+interface nsIFile;
interface nsIArray;
typedef unsigned long nsMsgRetainByPreference;
[scriptable, uuid(b01d6b3b-78c2-4958-b836-2259c76dbc24)]
interface nsIMsgRetentionSettings : nsISupports
@@ -193,17 +193,17 @@ interface nsIMsgDBService : nsISupports
* is invalid.
* @return A new nsIMsgDatabase object encapsulating the file
* passed in.
* @exception NS_ERROR_FILE_TARGET_DOES_NOT_EXIST
* The file could not be created.
* @see nsIMsgDBService::openFolderDB
* @see nsIMsgDatabase::Open
*/
- nsIMsgDatabase openMailDBFromFile(in nsILocalFile aFile,
+ nsIMsgDatabase openMailDBFromFile(in nsIFile aFile,
in nsIMsgFolder aFolder,
in boolean aCreate,
in boolean aLeaveInvalidDB);
/**
* Adds the given listener to the listener set for the folder.
*
* Since the message database will likely be opened and closed many times, by
* registering using this method, one will be guaranteed to see all subsequent
--- a/mailnews/db/msgdb/public/nsMailDatabase.h
+++ b/mailnews/db/msgdb/public/nsMailDatabase.h
@@ -3,36 +3,36 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _nsMailDatabase_H_
#define _nsMailDatabase_H_
#include "nsMsgDatabase.h"
#include "nsMsgMessageFlags.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsTArray.h"
// This is the subclass of nsMsgDatabase that handles local mail messages.
class nsIOFileStream;
-class nsILocalFile;
+class nsIFile;
class nsOfflineImapOperation;
class nsMailDatabase : public nsMsgDatabase
{
public:
nsMailDatabase();
virtual ~nsMailDatabase();
NS_IMETHOD ForceClosed();
NS_IMETHOD DeleteMessages(PRUint32 aNumKeys, nsMsgKey* nsMsgKeys, nsIDBChangeListener *instigator);
NS_IMETHOD StartBatch();
NS_IMETHOD EndBatch();
- nsresult Open(nsILocalFile *aSummaryFile, bool create, bool upgrading);
+ nsresult Open(nsIFile *aSummaryFile, bool create, bool upgrading);
virtual nsMailDatabase *GetMailDB() {return this;}
virtual PRUint32 GetCurVersion() {return kMsgDBVersion;}
NS_IMETHOD GetOfflineOpForKey(nsMsgKey opKey, bool create, nsIMsgOfflineImapOperation **op);
NS_IMETHOD RemoveOfflineOp(nsIMsgOfflineImapOperation *op);
NS_IMETHOD SetSummaryValid(bool valid);
--- a/mailnews/db/msgdb/public/nsMsgDatabase.h
+++ b/mailnews/db/msgdb/public/nsMsgDatabase.h
@@ -119,24 +119,24 @@ public:
* The file could not be created.
* @exception NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE
* The database is present (and was opened), but the
* summary file is out of date.
* @exception NS_MSG_ERROR_FOLDER_SUMMARY_MISSING
* The database is present (and was opened), but the
* summary file is missing.
*/
- virtual nsresult Open(nsILocalFile *aFolderName, bool aCreate,
+ virtual nsresult Open(nsIFile *aFolderName, bool aCreate,
bool aLeaveInvalidDB);
virtual nsresult IsHeaderRead(nsIMsgDBHdr *hdr, bool *pRead);
virtual nsresult MarkHdrReadInDB(nsIMsgDBHdr *msgHdr, bool bRead,
nsIDBChangeListener *instigator);
- nsresult OpenInternal(nsILocalFile *aFolderName, bool aCreate,
+ nsresult OpenInternal(nsIFile *aFolderName, bool aCreate,
bool aLeaveInvalidDB, bool sync);
- nsresult CheckForErrors(nsresult err, bool sync, nsILocalFile *summaryFile);
+ nsresult CheckForErrors(nsresult err, bool sync, nsIFile *summaryFile);
virtual nsresult OpenMDB(const char *dbName, bool create, bool sync);
virtual nsresult CloseMDB(bool commit);
virtual nsresult CreateMsgHdr(nsIMdbRow* hdrRow, nsMsgKey key, nsIMsgDBHdr **result);
virtual nsresult GetThreadForMsgKey(nsMsgKey msgKey, nsIMsgThread **result);
virtual nsresult EnumerateMessagesWithFlag(nsISimpleEnumerator* *result, PRUint32 *pFlag);
nsresult GetSearchResultsTable(const char *searchFolderUri, bool createIfMissing, nsIMdbTable **table);
// this might just be for debugging - we'll see.
@@ -152,17 +152,17 @@ public:
virtual PRUint32 GetCurVersion();
nsIMsgHeaderParser *GetHeaderParser();
nsresult GetCollationKeyGenerator();
nsIMimeConverter * GetMimeConverter();
nsresult GetTableCreateIfMissing(const char *scope, const char *kind, nsIMdbTable **table,
mdb_token &scopeToken, mdb_token &kindToken);
- static nsMsgDatabase* FindInCache(nsILocalFile *dbName);
+ static nsMsgDatabase* FindInCache(nsIFile *dbName);
static nsIMsgDatabase* FindInCache(nsIMsgFolder *folder);
//helper function to fill in nsStrings from hdr row cell contents.
nsresult RowCellColumnTonsString(nsIMdbRow *row, mdb_token columnToken, nsAString &resultStr);
nsresult RowCellColumnToUInt32(nsIMdbRow *row, mdb_token columnToken, PRUint32 *uint32Result, PRUint32 defaultValue = 0);
nsresult RowCellColumnToUInt32(nsIMdbRow *row, mdb_token columnToken, PRUint32 &uint32Result, PRUint32 defaultValue = 0);
nsresult RowCellColumnToUInt64(nsIMdbRow *row, mdb_token columnToken, PRUint64 *uint64Result, PRUint64 defaultValue = 0);
nsresult RowCellColumnToMime2DecodedString(nsIMdbRow *row, mdb_token columnToken, nsAString &resultStr);
@@ -250,17 +250,17 @@ protected:
#ifdef DEBUG
nsCOMPtr<nsIMsgDatabase> msgDB = pMessageDB->m_folder ?
dont_AddRef(FindInCache(pMessageDB->m_folder)) : nsnull;
NS_ASSERTION(!msgDB, "shouldn't have db in cache");
#endif
GetDBCache()->AppendElement(pMessageDB);
}
static void RemoveFromCache(nsMsgDatabase* pMessageDB);
- bool MatchDbName(nsILocalFile *dbName); // returns TRUE if they match
+ bool MatchDbName(nsIFile *dbName); // returns TRUE if they match
// Flag handling routines
virtual nsresult SetKeyFlag(nsMsgKey key, bool set, PRUint32 flag,
nsIDBChangeListener *instigator = NULL);
virtual nsresult SetMsgHdrFlag(nsIMsgDBHdr *msgHdr, bool set, PRUint32 flag,
nsIDBChangeListener *instigator);
virtual bool SetHdrFlag(nsIMsgDBHdr *, bool bSet, nsMsgMessageFlagType flag);
--- a/mailnews/db/msgdb/src/nsMailDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMailDatabase.cpp
@@ -30,17 +30,17 @@ nsMailDatabase::nsMailDatabase() : m_rep
nsMailDatabase::~nsMailDatabase()
{
}
// caller passes in upgrading==true if they want back a db even if the db is out of date.
// If so, they'll extract out the interesting info from the db, close it, delete it, and
// then try to open the db again, prior to reparsing.
-nsresult nsMailDatabase::Open(nsILocalFile *aSummaryFile, bool aCreate,
+nsresult nsMailDatabase::Open(nsIFile *aSummaryFile, bool aCreate,
bool aUpgrading)
{
#ifdef DEBUG
nsString leafName;
aSummaryFile->GetLeafName(leafName);
if (!StringEndsWith(leafName, NS_LITERAL_STRING(".msf"),
nsCaseInsensitiveStringComparator()))
NS_ERROR("non summary file passed into open\n");
--- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp
@@ -87,17 +87,17 @@ nsMsgDBService::~nsMsgDBService()
NS_IMETHODIMP nsMsgDBService::OpenFolderDB(nsIMsgFolder *aFolder,
bool aLeaveInvalidDB,
nsIMsgDatabase **_retval)
{
NS_ENSURE_ARG(aFolder);
nsCOMPtr<nsIMsgPluggableStore> msgStore;
nsCOMPtr<nsIMsgIncomingServer> incomingServer;
- nsCOMPtr <nsILocalFile> summaryFilePath;
+ nsCOMPtr <nsIFile> summaryFilePath;
nsresult rv = aFolder->GetServer(getter_AddRefs(incomingServer));
NS_ENSURE_SUCCESS(rv, rv);
rv = aFolder->GetMsgStore(getter_AddRefs(msgStore));
NS_ENSURE_SUCCESS(rv, rv);
rv = msgStore->GetSummaryFile(aFolder, getter_AddRefs(summaryFilePath));
NS_ENSURE_SUCCESS(rv, rv);
@@ -170,17 +170,17 @@ NS_IMETHODIMP nsMsgDBService::AsyncOpenF
// We don't care if an other consumer is thumbing the store. In that
// case, they'll both thumb the store.
return NS_OK;
}
nsCOMPtr<nsIMsgPluggableStore> msgStore;
nsresult rv = aFolder->GetMsgStore(getter_AddRefs(msgStore));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr <nsILocalFile> summaryFilePath;
+ nsCOMPtr <nsIFile> summaryFilePath;
rv = msgStore->GetSummaryFile(aFolder, getter_AddRefs(summaryFilePath));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr <nsIMsgIncomingServer> incomingServer;
rv = aFolder->GetServer(getter_AddRefs(incomingServer));
NS_ENSURE_SUCCESS(rv, rv);
nsCString localStoreType;
incomingServer->GetLocalStoreType(localStoreType);
@@ -246,19 +246,19 @@ NS_IMETHODIMP nsMsgDBService::OpenMore(n
break;
if (outDone)
{
nsCOMPtr<nsIMdbFactory> mdbFactory;
msgDatabase->GetMDBFactory(getter_AddRefs(mdbFactory));
NS_ENSURE_TRUE(mdbFactory, NS_ERROR_FAILURE);
ret = mdbFactory->ThumbToOpenStore(msgDatabase->m_mdbEnv, msgDatabase->m_thumb, &msgDatabase->m_mdbStore);
msgDatabase->m_thumb = nsnull;
- nsCOMPtr<nsILocalFile> folderPath;
+ nsCOMPtr<nsIFile> folderPath;
nsresult rv = msgDatabase->m_folder->GetFilePath(getter_AddRefs(folderPath));
- nsCOMPtr <nsILocalFile> summaryFile;
+ nsCOMPtr <nsIFile> summaryFile;
rv = GetSummaryFileLocation(folderPath, getter_AddRefs(summaryFile));
if (NS_SUCCEEDED(ret))
ret = (msgDatabase->m_mdbStore) ? msgDatabase->InitExistingDB() : NS_ERROR_FAILURE;
if (NS_SUCCEEDED(ret))
ret = msgDatabase->CheckForErrors(ret, false, summaryFile);
FinishDBOpen(msgDatabase->m_folder, msgDatabase);
@@ -308,26 +308,26 @@ void nsMsgDBService::FinishDBOpen(nsIMsg
HookupPendingListeners(aMsgDB, aFolder);
aMsgDB->RememberLastUseTime();
}
// This method is called when the caller is trying to create a db without
// having a corresponding nsIMsgFolder object. This happens in a few
// situations, including imap folder discovery, compacting local folders,
// and copying local folders.
-NS_IMETHODIMP nsMsgDBService::OpenMailDBFromFile(nsILocalFile *aFolderName,
+NS_IMETHODIMP nsMsgDBService::OpenMailDBFromFile(nsIFile *aFolderName,
nsIMsgFolder *aFolder,
bool aCreate,
bool aLeaveInvalidDB,
nsIMsgDatabase** pMessageDB)
{
if (!aFolderName)
return NS_ERROR_NULL_POINTER;
- nsCOMPtr <nsILocalFile> dbPath;
+ nsCOMPtr <nsIFile> dbPath;
nsresult rv = GetSummaryFileLocation(aFolderName, getter_AddRefs(dbPath));
NS_ENSURE_SUCCESS(rv, rv);
*pMessageDB = (nsMsgDatabase *) nsMsgDatabase::FindInCache(dbPath);
if (*pMessageDB)
return NS_OK;
nsRefPtr<nsMailDatabase> msgDB = new nsMailDatabase;
@@ -350,17 +350,17 @@ NS_IMETHODIMP nsMsgDBService::CreateNewD
nsCOMPtr <nsIMsgIncomingServer> incomingServer;
nsresult rv = aFolder->GetServer(getter_AddRefs(incomingServer));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMsgPluggableStore> msgStore;
rv = aFolder->GetMsgStore(getter_AddRefs(msgStore));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> summaryFilePath;
+ nsCOMPtr<nsIFile> summaryFilePath;
rv = msgStore->GetSummaryFile(aFolder, getter_AddRefs(summaryFilePath));
NS_ENSURE_SUCCESS(rv, rv);
nsCString localStoreType;
incomingServer->GetLocalStoreType(localStoreType);
nsCAutoString dbContractID(NS_MSGDB_CONTRACTID);
dbContractID.Append(localStoreType.get());
@@ -921,17 +921,17 @@ nsMsgDatabase::CleanupCache()
delete m_dbCache;
m_dbCache = nsnull;
}
}
//----------------------------------------------------------------------
// FindInCache - this addrefs the db it finds.
//----------------------------------------------------------------------
-nsMsgDatabase* nsMsgDatabase::FindInCache(nsILocalFile *dbName)
+nsMsgDatabase* nsMsgDatabase::FindInCache(nsIFile *dbName)
{
nsTArray<nsMsgDatabase*>* dbCache = GetDBCache();
PRUint32 length = dbCache->Length();
for (PRUint32 i = 0; i < length; i++)
{
nsMsgDatabase* pMessageDB = dbCache->ElementAt(i);
if (pMessageDB->MatchDbName(dbName))
{
@@ -945,29 +945,29 @@ nsMsgDatabase* nsMsgDatabase::FindInCach
return nsnull;
}
//----------------------------------------------------------------------
// FindInCache(nsIMsgFolder) - this addrefs the db it finds.
//----------------------------------------------------------------------
nsIMsgDatabase* nsMsgDatabase::FindInCache(nsIMsgFolder *folder)
{
- nsCOMPtr<nsILocalFile> folderPath;
+ nsCOMPtr<nsIFile> folderPath;
nsresult rv = folder->GetFilePath(getter_AddRefs(folderPath));
NS_ENSURE_SUCCESS(rv, nsnull);
- nsCOMPtr <nsILocalFile> summaryFile;
+ nsCOMPtr <nsIFile> summaryFile;
rv = GetSummaryFileLocation(folderPath, getter_AddRefs(summaryFile));
NS_ENSURE_SUCCESS(rv, nsnull);
return (nsIMsgDatabase *) FindInCache(summaryFile);
}
-bool nsMsgDatabase::MatchDbName(nsILocalFile *dbName) // returns true if they match
+bool nsMsgDatabase::MatchDbName(nsIFile *dbName) // returns true if they match
{
nsCString dbPath;
dbName->GetNativePath(dbPath);
return dbPath.Equals(m_dbName);
}
//----------------------------------------------------------------------
// RemoveFromCache
@@ -1101,24 +1101,24 @@ void nsMsgDatabase::GetMDBFactory(nsIMdb
mdbFactoryService->GetMdbFactory(getter_AddRefs(mMdbFactory));
}
NS_IF_ADDREF(*aMdbFactory = mMdbFactory);
}
// aLeaveInvalidDB: true if caller wants back a db even out of date.
// If so, they'll extract out the interesting info from the db, close it,
// delete it, and then try to open the db again, prior to reparsing.
-nsresult nsMsgDatabase::Open(nsILocalFile *aFolderName, bool aCreate,
+nsresult nsMsgDatabase::Open(nsIFile *aFolderName, bool aCreate,
bool aLeaveInvalidDB)
{
return nsMsgDatabase::OpenInternal(aFolderName, aCreate, aLeaveInvalidDB,
true /* open synchronously */);
}
-nsresult nsMsgDatabase::OpenInternal(nsILocalFile *summaryFile, bool aCreate,
+nsresult nsMsgDatabase::OpenInternal(nsIFile *summaryFile, bool aCreate,
bool aLeaveInvalidDB, bool sync)
{
nsCAutoString summaryFilePath;
summaryFile->GetNativePath(summaryFilePath);
PR_LOG(DBLog, PR_LOG_ALWAYS, ("nsMsgDatabase::Open(%s, %s, %p, %s)\n",
(const char*)summaryFilePath.get(), aCreate ? "TRUE":"FALSE",
this, aLeaveInvalidDB ? "TRUE":"FALSE"));
@@ -1141,17 +1141,17 @@ nsresult nsMsgDatabase::OpenInternal(nsI
AddToCache(this);
// remember open options for when the parsing is complete.
return rv;
}
return CheckForErrors(rv, true, summaryFile);
}
nsresult nsMsgDatabase::CheckForErrors(nsresult err, bool sync,
- nsILocalFile *summaryFile)
+ nsIFile *summaryFile)
{
nsCOMPtr<nsIDBFolderInfo> folderInfo;
bool summaryFileExists;
bool newFile = false;
bool deleteInvalidDB = false;
bool exists;
PRInt64 fileSize;
@@ -1344,21 +1344,21 @@ nsresult nsMsgDatabase::CloseMDB(bool co
Commit(nsMsgDBCommitType::kSessionCommit);
return(NS_OK);
}
NS_IMETHODIMP nsMsgDatabase::ForceFolderDBClosed(nsIMsgFolder *aFolder)
{
NS_ENSURE_ARG(aFolder);
- nsCOMPtr<nsILocalFile> folderPath;
+ nsCOMPtr<nsIFile> folderPath;
nsresult rv = aFolder->GetFilePath(getter_AddRefs(folderPath));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr <nsILocalFile> dbPath;
+ nsCOMPtr <nsIFile> dbPath;
rv = GetSummaryFileLocation(folderPath, getter_AddRefs(dbPath));
NS_ENSURE_SUCCESS(rv, rv);
nsIMsgDatabase *mailDB = (nsMsgDatabase *) FindInCache(dbPath);
if (mailDB)
{
mailDB->ForceClosed();
//FindInCache AddRef's
--- a/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp
+++ b/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp
@@ -2191,17 +2191,17 @@ NS_IMETHODIMP nsBayesianFilter::CorpusCo
}
NS_IMETHODIMP nsBayesianFilter::ClearTrait(PRUint32 aTrait)
{
return mCorpus.ClearTrait(aTrait);
}
NS_IMETHODIMP
-nsBayesianFilter::UpdateData(nsILocalFile *aFile,
+nsBayesianFilter::UpdateData(nsIFile *aFile,
bool aIsAdd,
PRUint32 aRemapCount,
PRUint32 *aFromTraits,
PRUint32 *aToTraits)
{
return mCorpus.UpdateData(aFile, aIsAdd, aRemapCount, aFromTraits, aToTraits);
}
@@ -2389,41 +2389,41 @@ bool CorpusStore::readTokens(FILE* strea
remove(buffer, aTraitId, count);
}
delete[] buffer;
return true;
}
-nsresult CorpusStore::getTrainingFile(nsILocalFile ** aTrainingFile)
+nsresult CorpusStore::getTrainingFile(nsIFile ** aTrainingFile)
{
// should we cache the profile manager's directory?
nsCOMPtr<nsIFile> profileDir;
nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileDir));
NS_ENSURE_SUCCESS(rv, rv);
rv = profileDir->Append(NS_LITERAL_STRING("training.dat"));
NS_ENSURE_SUCCESS(rv, rv);
- return profileDir->QueryInterface(NS_GET_IID(nsILocalFile), (void **) aTrainingFile);
+ return profileDir->QueryInterface(NS_GET_IID(nsIFile), (void **) aTrainingFile);
}
-nsresult CorpusStore::getTraitFile(nsILocalFile ** aTraitFile)
+nsresult CorpusStore::getTraitFile(nsIFile ** aTraitFile)
{
// should we cache the profile manager's directory?
nsCOMPtr<nsIFile> profileDir;
nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileDir));
NS_ENSURE_SUCCESS(rv, rv);
rv = profileDir->Append(NS_LITERAL_STRING("traits.dat"));
NS_ENSURE_SUCCESS(rv, rv);
- return profileDir->QueryInterface(NS_GET_IID(nsILocalFile), (void **) aTraitFile);
+ return profileDir->QueryInterface(NS_GET_IID(nsIFile), (void **) aTraitFile);
}
static const char kMagicCookie[] = { '\xFE', '\xED', '\xFA', '\xCE' };
// random string used to identify trait file and version (last byte is version)
static const char kTraitCookie[] = { '\xFC', '\xA9', '\x36', '\x01' };
void CorpusStore::writeTrainingData(PRUint32 aMaximumTokenCount)
@@ -2735,17 +2735,17 @@ void CorpusStore::setMessageCount(PRUint
}
else
{
mMessageCounts[index] = aCount;
}
}
nsresult
-CorpusStore::UpdateData(nsILocalFile *aFile,
+CorpusStore::UpdateData(nsIFile *aFile,
bool aIsAdd,
PRUint32 aRemapCount,
PRUint32 *aFromTraits,
PRUint32 *aToTraits)
{
NS_ENSURE_ARG_POINTER(aFile);
if (aRemapCount)
{
--- a/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.h
+++ b/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.h
@@ -272,38 +272,38 @@ public:
* trait ids that are not in this array, they are not
* remapped, but assummed to be local trait ids.
*
* @param aToTraits array of trait ids, corresponding to elements of
* aFromTraits, that represent the local trait ids to be
* used in storing data from aFile into the local corpus.
*
*/
- nsresult UpdateData(nsILocalFile *aFile, bool aIsAdd,
+ nsresult UpdateData(nsIFile *aFile, bool aIsAdd,
PRUint32 aRemapCount, PRUint32 *aFromTraits,
PRUint32 *aToTraits);
/**
* remove all counts (message and tokens) for a trait id
*
* @param aTrait trait id for the trait to remove
*/
nsresult ClearTrait(PRUint32 aTrait);
protected:
/**
* return the local corpus storage file for junk traits
*/
- nsresult getTrainingFile(nsILocalFile ** aFile);
+ nsresult getTrainingFile(nsIFile ** aFile);
/**
* return the local corpus storage file for non-junk traits
*/
- nsresult getTraitFile(nsILocalFile ** aFile);
+ nsresult getTraitFile(nsIFile ** aFile);
/**
* read token strings from the data file
*
* @param stream file stream with token data
* @param fileSize file size
* @param aTraitId id for the trait whose counts will be read
* @param aIsAdd true to add the counts, false to remove them
@@ -328,18 +328,18 @@ protected:
*/
CorpusToken* add(const char* word, PRUint32 aTraitId, PRUint32 aCount);
/**
* change counts in a trait in the traits array, adding the trait if needed
*/
nsresult updateTrait(CorpusToken* token, PRUint32 aTraitId,
PRInt32 aCountChange);
- nsCOMPtr<nsILocalFile> mTrainingFile; // file used to store junk training data
- nsCOMPtr<nsILocalFile> mTraitFile; // file used to store non-junk
+ nsCOMPtr<nsIFile> mTrainingFile; // file used to store junk training data
+ nsCOMPtr<nsIFile> mTraitFile; // file used to store non-junk
// training data
nsTArray<TraitPerToken> mTraitStore; // memory for linked-list of counts
PRUint32 mNextTraitIndex; // index in mTraitStore to first empty
// TraitPerToken
nsTArray<PRUint32> mMessageCounts; // count of messages per trait
// represented in the store
nsTArray<PRUint32> mMessageCountsId; // Parallel array to mMessageCounts, with
// the corresponding trait ID
--- a/mailnews/extensions/mailviews/src/nsMsgMailViewList.cpp
+++ b/mailnews/extensions/mailviews/src/nsMsgMailViewList.cpp
@@ -6,17 +6,17 @@
#include "nsMsgMailViewList.h"
#include "nsISupportsArray.h"
#include "nsIFileChannel.h"
#include "nsIMsgFilterService.h"
#include "nsIMsgMailSession.h"
#include "nsMsgBaseCID.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsComponentManagerUtils.h"
#include "mozilla/Services.h"
#define kDefaultViewPeopleIKnow "People I Know"
#define kDefaultViewRecent "Recent Mail"
#define kDefaultViewFiveDays "Last 5 Days"
#define kDefaultViewNotJunk "Not Junk"
#define kDefaultViewHasAttachments "Has Attachments"
@@ -253,25 +253,24 @@ nsresult nsMsgMailViewList::LoadMailView
// get the profile directory
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileDir));
// now copy the file over to the profile directory
defaultMessagesFile->CopyToNative(profileDir, EmptyCString());
}
// this is kind of a hack but I think it will be an effective hack. The filter service already knows how to
- // take a nsILocalFile and parse the contents into filters which are very similar to mail views. Intead of
+ // take a nsIFile and parse the contents into filters which are very similar to mail views. Intead of
// re-writing all of that dirty parsing code, let's just re-use it then convert the results into a data strcuture
// we wish to give to our consumers.
nsCOMPtr<nsIMsgFilterService> filterService = do_GetService(NS_MSGFILTERSERVICE_CONTRACTID, &rv);
nsCOMPtr<nsIMsgFilterList> mfilterList;
- nsCOMPtr <nsILocalFile> localFile = do_QueryInterface(file);
- rv = filterService->OpenFilterList(localFile, NULL, NULL, getter_AddRefs(mFilterList));
+ rv = filterService->OpenFilterList(file, NULL, NULL, getter_AddRefs(mFilterList));
NS_ENSURE_SUCCESS(rv, rv);
// now convert the filter list into our mail view objects, stripping out just the info we need
ConvertFilterListToMailView(mFilterList, getter_AddRefs(m_mailViews));
return rv;
}
nsresult nsMsgMailViewList::ConvertFilterListToMailView(nsIMsgFilterList * aFilterList, nsISupportsArray ** aMailViewList)
--- a/mailnews/extensions/mdn/src/nsMsgMdnGenerator.cpp
+++ b/mailnews/extensions/mdn/src/nsMsgMdnGenerator.cpp
@@ -367,20 +367,19 @@ nsresult nsMsgMdnGenerator::CreateMdnMsg
nsCOMPtr<nsIFile> tmpFile;
rv = GetSpecialDirectoryWithFileName(NS_OS_TEMP_DIR,
"mdnmsg",
getter_AddRefs(m_file));
NS_ENSURE_SUCCESS(rv, rv);
rv = m_file->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 00600);
- nsCOMPtr <nsILocalFile> localFile = do_QueryInterface(m_file);
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewLocalFileOutputStream(getter_AddRefs(m_outputStream),
- localFile,
+ m_file,
PR_CREATE_FILE | PR_WRONLY | PR_TRUNCATE,
0664);
NS_ASSERTION(NS_SUCCEEDED(rv),"creating mdn: failed to output stream");
if (NS_FAILED(rv))
return NS_OK;
rv = CreateFirstPart();
if (NS_SUCCEEDED(rv))
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -7,17 +7,17 @@
// sorry, this has to be before the pre-compiled header
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif
#include "msgCore.h"
#include "prmem.h"
#include "nsMsgImapCID.h"
#include "nsImapMailFolder.h"
#include "nsIEnumerator.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIFolderListener.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsIRDFService.h"
#include "nsRDFCID.h"
#include "nsMsgDBCID.h"
#include "nsMsgFolderFlags.h"
#include "nsImapFlagAndUidState.h"
@@ -143,21 +143,20 @@ nsresult RecursiveCopy(nsIFile* srcDir,
rv = dirIterator->GetNext((nsISupports**)getter_AddRefs(dirEntry));
if (NS_SUCCEEDED(rv))
{
rv = dirEntry->IsDirectory(&isDir);
if (NS_SUCCEEDED(rv))
{
if (isDir)
{
- nsCOMPtr<nsIFile> destClone;
- rv = destDir->Clone(getter_AddRefs(destClone));
+ nsCOMPtr<nsIFile> newChild;
+ rv = destDir->Clone(getter_AddRefs(newChild));
if (NS_SUCCEEDED(rv))
{
- nsCOMPtr<nsILocalFile> newChild(do_QueryInterface(destClone));
nsAutoString leafName;
dirEntry->GetLeafName(leafName);
newChild->AppendRelativePath(leafName);
rv = newChild->Exists(&exists);
if (NS_SUCCEEDED(rv) && !exists)
rv = newChild->Create(nsIFile::DIRECTORY_TYPE, 0775);
rv = RecursiveCopy(dirEntry, newChild);
}
@@ -230,17 +229,17 @@ NS_IMPL_QUERY_HEAD(nsImapMailFolder)
NS_IMPL_QUERY_BODY(nsIMsgImapMailFolder)
NS_IMPL_QUERY_BODY(nsICopyMessageListener)
NS_IMPL_QUERY_BODY(nsIImapMailFolderSink)
NS_IMPL_QUERY_BODY(nsIImapMessageSink)
NS_IMPL_QUERY_BODY(nsIUrlListener)
NS_IMPL_QUERY_BODY(nsIMsgFilterHitNotify)
NS_IMPL_QUERY_TAIL_INHERITING(nsMsgDBFolder)
-nsresult nsImapMailFolder::AddDirectorySeparator(nsILocalFile *path)
+nsresult nsImapMailFolder::AddDirectorySeparator(nsIFile *path)
{
if (mURI.Equals(kImapRootURI))
{
// don't concat the full separator with .sbd
}
else
{
// see if there's a dir with the same name ending with .sbd
@@ -304,17 +303,17 @@ NS_IMETHODIMP nsImapMailFolder::AddSubfo
nsCOMPtr<nsIRDFResource> res;
rv = rdf->GetResource(uri, getter_AddRefs(res));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr <nsILocalFile> path;
+ nsCOMPtr <nsIFile> path;
rv = CreateDirectoryForFolder(getter_AddRefs(path));
NS_ENSURE_SUCCESS(rv, rv);
folder->GetFlags((PRUint32 *)&flags);
flags |= nsMsgFolderFlags::Mail;
nsCOMPtr<nsIImapIncomingServer> imapServer;
@@ -339,17 +338,17 @@ NS_IMETHODIMP nsImapMailFolder::AddSubfo
{
imapChild->SetOnlineName(NS_LossyConvertUTF16toASCII(aName));
imapChild->SetHierarchyDelimiter(m_hierarchyDelimiter);
}
NotifyItemAdded(*aChild);
return rv;
}
-nsresult nsImapMailFolder::AddSubfolderWithPath(nsAString& name, nsILocalFile *dbPath,
+nsresult nsImapMailFolder::AddSubfolderWithPath(nsAString& name, nsIFile *dbPath,
nsIMsgFolder **child, bool brandNew)
{
NS_ENSURE_ARG_POINTER(child);
nsresult rv;
nsCOMPtr<nsIRDFService> rdf(do_GetService(kRDFServiceCID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 flags = 0;
@@ -425,17 +424,17 @@ nsresult nsImapMailFolder::AddSubfolderW
rv = NS_OK;
if (folder)
mSubFolders.AppendObject(folder);
folder.swap(*child);
return rv;
}
-nsresult nsImapMailFolder::CreateSubFolders(nsILocalFile *path)
+nsresult nsImapMailFolder::CreateSubFolders(nsIFile *path)
{
nsresult rv = NS_OK;
nsAutoString currentFolderNameStr; // online name
nsAutoString currentFolderDBNameStr; // possibly munged name
nsCOMPtr<nsIMsgFolder> child;
nsCOMPtr<nsIMsgIncomingServer> server;
rv = GetServer(getter_AddRefs(server));
NS_ENSURE_SUCCESS(rv, rv);
@@ -450,27 +449,27 @@ nsresult nsImapMailFolder::CreateSubFold
while (more)
{
rv = children->GetNext((nsISupports**) getter_AddRefs(dirEntry));
if (NS_FAILED(rv))
break;
rv = children->HasMoreElements(&more);
if (NS_FAILED(rv)) return rv;
- nsCOMPtr <nsILocalFile> currentFolderPath = do_QueryInterface(dirEntry);
+ nsCOMPtr <nsIFile> currentFolderPath = do_QueryInterface(dirEntry);
currentFolderPath->GetLeafName(currentFolderNameStr);
if (nsShouldIgnoreFile(currentFolderNameStr))
continue;
// OK, here we need to get the online name from the folder cache if we can.
// If we can, use that to create the sub-folder
nsCOMPtr <nsIMsgFolderCacheElement> cacheElement;
- nsCOMPtr <nsILocalFile> curFolder = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr <nsIFile> curFolder = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr <nsILocalFile> dbFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr <nsIFile> dbFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
dbFile->InitWithFile(currentFolderPath);
curFolder->InitWithFile(currentFolderPath);
// don't strip off the .msf in currentFolderPath.
currentFolderPath->SetLeafName(currentFolderNameStr);
currentFolderDBNameStr = currentFolderNameStr;
nsAutoString utf7LeafName = currentFolderNameStr;
@@ -506,17 +505,17 @@ nsresult nsImapMailFolder::CreateSubFold
CopyASCIItoUTF16(onlineFullUtf7Name, utf7LeafName);
leafPos = utf7LeafName.RFindChar(delimiter);
if (leafPos > 0)
utf7LeafName.Cut(0, leafPos + 1);
}
}
}
// make the imap folder remember the file spec it was created with.
- nsCOMPtr <nsILocalFile> msfFilePath = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr <nsIFile> msfFilePath = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
msfFilePath->InitWithFile(currentFolderPath);
if (NS_SUCCEEDED(rv) && msfFilePath)
{
// leaf name is the db name w/o .msf (nsShouldIgnoreFile strips it off)
// so this trims the .msf off the file spec.
msfFilePath->SetLeafName(currentFolderDBNameStr);
}
@@ -537,17 +536,17 @@ nsresult nsImapMailFolder::CreateSubFold
NS_IMETHODIMP nsImapMailFolder::GetSubFolders(nsISimpleEnumerator **aResult)
{
bool isServer;
nsresult rv = GetIsServer(&isServer);
NS_ENSURE_SUCCESS(rv, rv);
if (!m_initialized)
{
- nsCOMPtr<nsILocalFile> pathFile;
+ nsCOMPtr<nsIFile> pathFile;
rv = GetFilePath(getter_AddRefs(pathFile));
if (NS_FAILED(rv)) return rv;
// host directory does not need .sbd tacked on
if (!isServer)
{
rv = AddDirectorySeparator(pathFile);
if(NS_FAILED(rv)) return rv;
@@ -883,17 +882,17 @@ NS_IMETHODIMP nsImapMailFolder::CreateSu
NS_IMETHODIMP nsImapMailFolder::CreateClientSubfolderInfo(const nsACString& folderName,
char hierarchyDelimiter,
PRInt32 flags,
bool suppressNotification)
{
nsresult rv = NS_OK;
//Get a directory based on our current path.
- nsCOMPtr <nsILocalFile> path;
+ nsCOMPtr <nsIFile> path;
rv = CreateDirectoryForFolder(getter_AddRefs(path));
if(NS_FAILED(rv))
return rv;
NS_ConvertASCIItoUTF16 leafName(folderName);
nsAutoString folderNameStr;
nsAutoString parentName = leafName;
// use RFind, because folder can start with a delimiter and
@@ -929,17 +928,17 @@ NS_IMETHODIMP nsImapMailFolder::CreateCl
// Create an empty database for this mail folder, set its name from the user
nsCOMPtr<nsIMsgDatabase> mailDBFactory;
nsCOMPtr<nsIMsgFolder> child;
nsCOMPtr<nsIMsgDBService> msgDBService = do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMsgDatabase> unusedDB;
- nsCOMPtr <nsILocalFile> dbFile;
+ nsCOMPtr <nsIFile> dbFile;
// warning, path will be changed
rv = CreateFileForDB(folderNameStr, path, getter_AddRefs(dbFile));
NS_ENSURE_SUCCESS(rv,rv);
//Now let's create the actual new folder
rv = AddSubfolderWithPath(folderNameStr, dbFile, getter_AddRefs(child), true);
NS_ENSURE_SUCCESS(rv, rv);
@@ -1593,21 +1592,21 @@ NS_IMETHODIMP nsImapMailFolder::Delete()
msgDBService->CachedDBForFolder(this, getter_AddRefs(mDatabase));
}
if (mDatabase)
{
mDatabase->ForceClosed();
mDatabase = nsnull;
}
- nsCOMPtr<nsILocalFile> path;
+ nsCOMPtr<nsIFile> path;
rv = GetFilePath(getter_AddRefs(path));
if (NS_SUCCEEDED(rv))
{
- nsCOMPtr<nsILocalFile> summaryLocation;
+ nsCOMPtr<nsIFile> summaryLocation;
rv = GetSummaryFileLocation(path, getter_AddRefs(summaryLocation));
if (NS_SUCCEEDED(rv))
{
bool exists = false;
rv = summaryLocation->Exists(&exists);
if (NS_SUCCEEDED(rv) && exists)
{
rv = summaryLocation->Remove(false);
@@ -1709,36 +1708,36 @@ NS_IMETHODIMP nsImapMailFolder::RenameLo
PRInt32 leafpos = leafname.RFindChar('/');
if (leafpos >0)
leafname.Cut(0, leafpos+1);
m_msgParser = nsnull;
PrepareToRename();
CloseAndBackupFolderDB(leafname);
nsresult rv = NS_OK;
- nsCOMPtr<nsILocalFile> oldPathFile;
+ nsCOMPtr<nsIFile> oldPathFile;
rv = GetFilePath(getter_AddRefs(oldPathFile));
if (NS_FAILED(rv)) return rv;
- nsCOMPtr<nsILocalFile> parentPathFile;
+ nsCOMPtr<nsIFile> parentPathFile;
rv = parent->GetFilePath(getter_AddRefs(parentPathFile));
NS_ENSURE_SUCCESS(rv,rv);
bool isDirectory = false;
parentPathFile->IsDirectory(&isDirectory);
if (!isDirectory)
AddDirectorySeparator(parentPathFile);
- nsCOMPtr <nsILocalFile> dirFile;
+ nsCOMPtr <nsIFile> dirFile;
PRInt32 count = mSubFolders.Count();
if (count > 0)
rv = CreateDirectoryForFolder(getter_AddRefs(dirFile));
- nsCOMPtr <nsILocalFile> oldSummaryFile;
+ nsCOMPtr <nsIFile> oldSummaryFile;
rv = GetSummaryFileLocation(oldPathFile, getter_AddRefs(oldSummaryFile));
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString newNameStr;
oldSummaryFile->Remove(false);
if (count > 0)
{
newNameStr = leafname;
@@ -2703,17 +2702,17 @@ NS_IMETHODIMP nsImapMailFolder::UpdateIm
SetSupportedUserFlags(supportedUserFlags);
m_uidValidity = folderValidity;
if (imapUIDValidity != folderValidity)
{
NS_ASSERTION(imapUIDValidity == kUidUnknown,
"uid validity seems to have changed, blowing away db");
- nsCOMPtr<nsILocalFile> pathFile;
+ nsCOMPtr<nsIFile> pathFile;
rv = GetFilePath(getter_AddRefs(pathFile));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIMsgDBService> msgDBService = do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr <nsIDBFolderInfo> transferInfo;
if (dbFolderInfo)
@@ -2735,17 +2734,17 @@ NS_IMETHODIMP nsImapMailFolder::UpdateIm
mBackupDatabase = nsnull;
}
}
else
mDatabase->ForceClosed();
}
mDatabase = nsnull;
- nsCOMPtr <nsILocalFile> summaryFile;
+ nsCOMPtr <nsIFile> summaryFile;
rv = GetSummaryFileLocation(pathFile, getter_AddRefs(summaryFile));
// Remove summary file.
if (NS_SUCCEEDED(rv) && summaryFile)
summaryFile->Remove(false);
// Create a new summary file, update the folder message counts, and
// Close the summary file db.
bool created;
@@ -3241,18 +3240,18 @@ NS_IMETHODIMP nsImapMailFolder::BeginCop
PR_LOG(IMAP, PR_LOG_ALWAYS, ("couldn't create temp nscpmsg.txt:%lx\n", rv));
OnCopyCompleted(m_copyState->m_srcSupport, rv);
return rv;
}
}
}
nsCOMPtr<nsIOutputStream> fileOutputStream;
- nsCOMPtr <nsILocalFile> localFile = do_QueryInterface(m_copyState->m_tmpFile);
- rv = MsgNewBufferedFileOutputStream(getter_AddRefs(m_copyState->m_msgFileStream), localFile, -1, 00600);
+ rv = MsgNewBufferedFileOutputStream(getter_AddRefs(m_copyState->m_msgFileStream),
+ m_copyState->m_tmpFile, -1, 00600);
if (NS_FAILED(rv))
PR_LOG(IMAP, PR_LOG_ALWAYS, ("couldn't create output file stream:%lx\n", rv));
if (!m_copyState->m_dataBuffer)
m_copyState->m_dataBuffer = (char*) PR_CALLOC(COPY_BUFFER_SIZE+1);
NS_ENSURE_TRUE(m_copyState->m_dataBuffer, NS_ERROR_OUT_OF_MEMORY);
m_copyState->m_dataBufferSize = COPY_BUFFER_SIZE;
return NS_OK;
@@ -4451,19 +4450,17 @@ void nsImapMailFolder::TweakHeaderFlags(
}
}
NS_IMETHODIMP
nsImapMailFolder::SetupMsgWriteStream(nsIFile * aFile, bool addDummyEnvelope)
{
nsresult rv;
aFile->Remove(false);
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(aFile, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
- rv = MsgNewBufferedFileOutputStream(getter_AddRefs(m_tempMessageStream), localFile, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 00700);
+ rv = MsgNewBufferedFileOutputStream(getter_AddRefs(m_tempMessageStream), aFile, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 00700);
if (m_tempMessageStream && addDummyEnvelope)
{
nsCAutoString result;
char *ct;
PRUint32 writeCount;
time_t now = time ((time_t*) 0);
ct = ctime(&now);
ct[24] = 0;
@@ -6590,24 +6587,24 @@ nsresult nsMsgIMAPFolderACL::CreateACLRi
if (!aRightsString.IsEmpty()) aRightsString.AppendLiteral(", ");
bundle->GetStringFromID(IMAP_ACL_ADMINISTER_RIGHT, getter_Copies(curRight));
aRightsString.Append(curRight);
}
}
return rv;
}
-NS_IMETHODIMP nsImapMailFolder::GetFilePath(nsILocalFile ** aPathName)
+NS_IMETHODIMP nsImapMailFolder::GetFilePath(nsIFile ** aPathName)
{
// this will return a copy of mPath, which is what we want.
// this will also initialize mPath using parseURI if it isn't already done
return nsMsgDBFolder::GetFilePath(aPathName);
}
-NS_IMETHODIMP nsImapMailFolder::SetFilePath(nsILocalFile * aPathName)
+NS_IMETHODIMP nsImapMailFolder::SetFilePath(nsIFile * aPathName)
{
return nsMsgDBFolder::SetFilePath(aPathName); // call base class so mPath will get set
}
nsresult nsImapMailFolder::DisplayStatusMsg(nsIImapUrl *aImapUrl, const nsAString& msg)
{
nsCOMPtr<nsIImapMockChannel> mockChannel;
aImapUrl->GetMockChannel(getter_AddRefs(mockChannel));
@@ -7856,24 +7853,24 @@ nsImapMailFolder::CopyFolder(nsIMsgFolde
nsString folderName;
srcFolder->GetName(folderName);
nsAutoString safeFolderName(folderName);
NS_MsgHashIfNecessary(safeFolderName);
srcFolder->ForceDBClosed();
- nsCOMPtr<nsILocalFile> oldPathFile;
+ nsCOMPtr<nsIFile> oldPathFile;
rv = srcFolder->GetFilePath(getter_AddRefs(oldPathFile));
NS_ENSURE_SUCCESS(rv,rv);
- nsCOMPtr <nsILocalFile> summaryFile;
+ nsCOMPtr <nsIFile> summaryFile;
GetSummaryFileLocation(oldPathFile, getter_AddRefs(summaryFile));
- nsCOMPtr<nsILocalFile> newPathFile;
+ nsCOMPtr<nsIFile> newPathFile;
rv = GetFilePath(getter_AddRefs(newPathFile));
NS_ENSURE_SUCCESS(rv,rv);
bool isDirectory = false;
newPathFile->IsDirectory(&isDirectory);
if (!isDirectory)
{
AddDirectorySeparator(newPathFile);
@@ -7905,17 +7902,17 @@ nsImapMailFolder::CopyFolder(nsIMsgFolde
srcFolder->SetParent(nsnull);
if (msgParent)
{
msgParent->PropagateDelete(srcFolder, false, msgWindow); // The files have already been moved, so delete storage false
oldPathFile->Remove(false); //berkeley mailbox
nsCOMPtr <nsIMsgDatabase> srcDB; // we need to force closed the source db
srcFolder->Delete();
- nsCOMPtr<nsILocalFile> parentPathFile;
+ nsCOMPtr<nsIFile> parentPathFile;
rv = msgParent->GetFilePath(getter_AddRefs(parentPathFile));
NS_ENSURE_SUCCESS(rv,rv);
AddDirectorySeparator(parentPathFile);
nsCOMPtr <nsISimpleEnumerator> children;
parentPathFile->GetDirectoryEntries(getter_AddRefs(children));
bool more;
// checks if the directory is empty or not
@@ -8213,17 +8210,17 @@ nsImapMailFolder::InitCopyState(nsISuppo
m_copyState->m_selectedState = selectedState;
m_copyState->m_msgWindow = msgWindow;
if (listener)
m_copyState->m_listener = do_QueryInterface(listener, &rv);
return rv;
}
nsresult
-nsImapMailFolder::CopyFileToOfflineStore(nsILocalFile *srcFile, nsMsgKey msgKey)
+nsImapMailFolder::CopyFileToOfflineStore(nsIFile *srcFile, nsMsgKey msgKey)
{
nsCOMPtr<nsIMsgDatabase> db;
nsresult rv = GetMsgDatabase(getter_AddRefs(db));
if (mDatabase)
{
if (msgKey == nsMsgKey_None)
mDatabase->GetNextFakeOfflineMsgKey(&msgKey);
@@ -8326,17 +8323,17 @@ nsImapMailFolder::CopyFileToOfflineStore
nsresult
nsImapMailFolder::OnCopyCompleted(nsISupports *srcSupport, nsresult rv)
{
// if it's a file, and the copy succeeded, then fcc the offline
// store, and add a kMoveResult offline op.
if (NS_SUCCEEDED(rv) && m_copyState)
{
- nsCOMPtr<nsILocalFile> srcFile(do_QueryInterface(srcSupport));
+ nsCOMPtr<nsIFile> srcFile(do_QueryInterface(srcSupport));
if (srcFile && (mFlags & nsMsgFolderFlags::Offline) && !WeAreOffline())
(void) CopyFileToOfflineStore(srcFile, m_copyState->m_appendUID);
}
m_copyState = nsnull;
nsresult result;
nsCOMPtr<nsIMsgCopyService> copyService = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID, &result);
NS_ENSURE_SUCCESS(result, result);
return copyService->NotifyCompletion(srcSupport, this, rv);
@@ -8596,17 +8593,17 @@ NS_IMETHODIMP nsImapMailFolder::PerformE
rv = imapService->DiscoverChildren( this, this, m_onlineFolderName, nsnull);
}
return rv;
}
NS_IMETHODIMP nsImapMailFolder::RenameClient(nsIMsgWindow *msgWindow, nsIMsgFolder *msgFolder, const nsACString& oldName, const nsACString& newName)
{
nsresult rv;
- nsCOMPtr<nsILocalFile> pathFile;
+ nsCOMPtr<nsIFile> pathFile;
rv = GetFilePath(getter_AddRefs(pathFile));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIMsgImapMailFolder> oldImapFolder = do_QueryInterface(msgFolder, &rv);
if (NS_FAILED(rv)) return rv;
char hierarchyDelimiter = '/';
oldImapFolder->GetHierarchyDelimiter(&hierarchyDelimiter);
@@ -8634,17 +8631,17 @@ NS_IMETHODIMP nsImapMailFolder::RenameCl
nsCOMPtr<nsIMsgDatabase> mailDBFactory;
nsCOMPtr<nsIMsgFolder> child;
nsCOMPtr <nsIMsgImapMailFolder> imapFolder;
nsCOMPtr<nsIMsgDBService> msgDBService = do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMsgDatabase> unusedDB;
- nsCOMPtr <nsILocalFile> dbFile;
+ nsCOMPtr <nsIFile> dbFile;
// warning, path will be changed
rv = CreateFileForDB(newLeafName, pathFile, getter_AddRefs(dbFile));
NS_ENSURE_SUCCESS(rv,rv);
// Use openMailDBFromFile() and not OpenFolderDB() here, since we don't use the DB.
rv = msgDBService->OpenMailDBFromFile(dbFile, nsnull, true, true,
getter_AddRefs(unusedDB));
@@ -8735,37 +8732,37 @@ NS_IMETHODIMP nsImapMailFolder::RenameSu
folder->GetHierarchyDelimiter(&hierarchyDelimiter);
PRInt32 boxflags;
folder->GetBoxFlags(&boxflags);
bool verified;
folder->GetVerifiedAsOnlineFolder(&verified);
- nsCOMPtr<nsILocalFile> oldPathFile;
+ nsCOMPtr<nsIFile> oldPathFile;
rv = msgFolder->GetFilePath(getter_AddRefs(oldPathFile));
if (NS_FAILED(rv)) return rv;
- nsCOMPtr<nsILocalFile> newParentPathFile;
+ nsCOMPtr<nsIFile> newParentPathFile;
rv = GetFilePath(getter_AddRefs(newParentPathFile));
if (NS_FAILED(rv)) return rv;
rv = AddDirectorySeparator(newParentPathFile);
nsCAutoString oldLeafName;
oldPathFile->GetNativeLeafName(oldLeafName);
newParentPathFile->AppendNative(oldLeafName);
nsCString newPathStr;
newParentPathFile->GetNativePath(newPathStr);
- nsCOMPtr<nsILocalFile> newPathFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr<nsIFile> newPathFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
newPathFile->InitWithFile(newParentPathFile);
- nsCOMPtr<nsILocalFile> dbFilePath = newPathFile;
+ nsCOMPtr<nsIFile> dbFilePath = newPathFile;
nsCOMPtr<nsIMsgFolder> child;
nsString folderName;
rv = msgFolder->GetName(folderName);
if (folderName.IsEmpty() || NS_FAILED(rv)) return rv;
nsCString utf7LeafName;
--- a/mailnews/imap/src/nsImapMailFolder.h
+++ b/mailnews/imap/src/nsImapMailFolder.h
@@ -264,18 +264,18 @@ public:
nsIMsgDBHdr* msgToReplace,
bool isDraftOrTemplate,
PRUint32 aNewMsgFlags,
const nsACString &aNewMsgKeywords,
nsIMsgWindow *msgWindow,
nsIMsgCopyServiceListener* listener);
NS_IMETHOD GetNewMessages(nsIMsgWindow *aWindow, nsIUrlListener *aListener);
- NS_IMETHOD GetFilePath(nsILocalFile** aPathName);
- NS_IMETHOD SetFilePath(nsILocalFile * aPath);
+ NS_IMETHOD GetFilePath(nsIFile** aPathName);
+ NS_IMETHOD SetFilePath(nsIFile * aPath);
NS_IMETHOD Shutdown(bool shutdownChildren);
NS_IMETHOD DownloadMessagesForOffline(nsIArray *messages, nsIMsgWindow *msgWindow);
NS_IMETHOD DownloadAllForOffline(nsIUrlListener *listener, nsIMsgWindow *msgWindow);
NS_IMETHOD GetCanFileMessages(bool *aCanFileMessages);
NS_IMETHOD GetCanDeleteMessages(bool *aCanDeleteMessages);
@@ -300,17 +300,17 @@ public:
NS_DECL_NSIMSGFILTERHITNOTIFY
NS_DECL_NSIJUNKMAILCLASSIFICATIONLISTENER
NS_IMETHOD IsCommandEnabled(const nsACString& command, bool *result);
NS_IMETHOD SetFilterList(nsIMsgFilterList *aMsgFilterList);
NS_IMETHOD GetCustomIdentity(nsIMsgIdentity **aIdentity);
- nsresult AddSubfolderWithPath(nsAString& name, nsILocalFile *dbPath, nsIMsgFolder **child, bool brandNew = false);
+ nsresult AddSubfolderWithPath(nsAString& name, nsIFile *dbPath, nsIMsgFolder **child, bool brandNew = false);
nsresult MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
nsIMsgDatabase *sourceDB,
const nsACString& destFolder,
nsIMsgFilter *filter,
nsIMsgWindow *msgWindow);
// send notification to copy service listener.
nsresult OnCopyCompleted(nsISupports *srcSupport, nsresult exitCode);
@@ -342,17 +342,17 @@ protected:
nsresult NotifyMessageFlagsFromHdr(nsIMsgDBHdr *dbHdr, nsMsgKey msgKey,
PRUint32 flags);
nsresult SetupHeaderParseStream(PRUint32 size, const nsACString& content_type, nsIMailboxSpec *boxSpec);
nsresult ParseAdoptedHeaderLine(const char *messageLine, PRUint32 msgKey);
nsresult NormalEndHeaderParseStream(nsIImapProtocol *aProtocol, nsIImapUrl *imapUrl);
void EndOfflineDownload();
- nsresult CopyFileToOfflineStore(nsILocalFile *srcFile, nsMsgKey msgKey);
+ nsresult CopyFileToOfflineStore(nsIFile *srcFile, nsMsgKey msgKey);
nsresult MarkMessagesImapDeleted(nsTArray<nsMsgKey> *keyArray, bool deleted, nsIMsgDatabase *db);
// Notifies imap autosync that it should update this folder when it
// gets a chance.
void NotifyHasPendingMsgs();
void UpdatePendingCounts();
void SetIMAPDeletedFlag(nsIMsgDatabase *mailDB, const nsTArray<nsMsgKey> &msgids, bool markDeleted);
@@ -361,18 +361,18 @@ protected:
nsresult GetFolder(const nsACString& name, nsIMsgFolder **pFolder);
nsresult GetTrashFolder(nsIMsgFolder **pTrashFolder);
bool TrashOrDescendentOfTrash(nsIMsgFolder* folder);
static bool ShouldCheckAllFolders(nsIImapIncomingServer *imapServer);
nsresult GetServerKey(nsACString& serverKey);
nsresult DisplayStatusMsg(nsIImapUrl *aImapUrl, const nsAString& msg);
//nsresult RenameLocal(const char *newName);
- nsresult AddDirectorySeparator(nsILocalFile *path);
- nsresult CreateSubFolders(nsILocalFile *path);
+ nsresult AddDirectorySeparator(nsIFile *path);
+ nsresult CreateSubFolders(nsIFile *path);
nsresult GetDatabase();
virtual void GetIncomingServerType(nsCString& serverType) { serverType.AssignLiteral("imap");}
nsresult GetFolderOwnerUserName(nsACString& userName);
nsIMAPNamespace *GetNamespaceForFolder();
void SetNamespaceForFolder(nsIMAPNamespace *ns);
nsMsgIMAPFolderACL * GetFolderACL();
--- a/mailnews/imap/src/nsImapOfflineSync.h
+++ b/mailnews/imap/src/nsImapOfflineSync.h
@@ -60,17 +60,17 @@ protected:
nsCOMPtr <nsIMsgFolder> m_currentFolder;
nsCOMPtr <nsIMsgFolder> m_singleFolderToUpdate;
nsCOMPtr <nsIMsgWindow> m_window;
nsCOMPtr <nsISupportsArray> m_allServers;
nsCOMPtr <nsISupportsArray> m_allFolders;
nsCOMPtr <nsIMsgIncomingServer> m_currentServer;
nsCOMPtr <nsIEnumerator> m_serverEnumerator;
- nsCOMPtr <nsILocalFile> m_curTempFile;
+ nsCOMPtr <nsIFile> m_curTempFile;
nsTArray<nsMsgKey> m_CurrentKeys;
nsCOMArray<nsIMsgOfflineImapOperation> m_currentOpsToClear;
PRUint32 m_KeyIndex;
nsCOMPtr <nsIMsgDatabase> m_currentDB;
nsCOMPtr <nsIUrlListener> m_listener;
PRInt32 mCurrentUIDValidity;
PRInt32 mCurrentPlaybackOpType; // kFlagsChanged -> kMsgCopy -> kMsgMoved
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -5964,18 +5964,17 @@ void nsImapProtocol::UploadMessageFromFi
}
command.Append(" {");
dataBuffer = (char*) PR_CALLOC(COPY_BUFFER_SIZE+1);
if (!dataBuffer) goto done;
rv = file->GetFileSize(&fileSize);
NS_ASSERTION(fileSize, "got empty file in UploadMessageFromFile");
if (NS_FAILED(rv) || !fileSize) goto done;
- nsCOMPtr <nsILocalFile> localFile = do_QueryInterface(file);
- rv = NS_NewLocalFileInputStream(getter_AddRefs(fileInputStream), localFile);
+ rv = NS_NewLocalFileInputStream(getter_AddRefs(fileInputStream), file);
if (NS_FAILED(rv) || !fileInputStream) goto done;
command.AppendInt((PRInt32)fileSize);
if (hasLiteralPlus)
command.Append("+}" CRLF);
else
command.Append("}" CRLF);
rv = SendData(command.get());
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -2044,19 +2044,17 @@ nsresult nsImapService::OfflineAppendFro
NS_ERROR("needs to be a random store!");
return NS_ERROR_FAILURE;
}
nsCOMPtr <nsIInputStream> inputStream;
nsCOMPtr <nsIMsgParseMailMsgState> msgParser = do_CreateInstance(NS_PARSEMAILMSGSTATE_CONTRACTID, &rv);
msgParser->SetMailDB(destDB);
- nsCOMPtr <nsILocalFile> localFile = do_QueryInterface(aFile);
- if (NS_SUCCEEDED(rv))
- rv = NS_NewLocalFileInputStream(getter_AddRefs(inputStream), localFile);
+ rv = NS_NewLocalFileInputStream(getter_AddRefs(inputStream), aFile);
if (NS_SUCCEEDED(rv) && inputStream)
{
// now, copy the temp file to the offline store for the dest folder.
PRInt32 inputBufferSize = 10240;
nsMsgLineStreamBuffer *inputStreamBuffer = new nsMsgLineStreamBuffer(inputBufferSize,
true, // allocate new lines
false); // leave CRLFs on the returned string
PRInt64 fileSize;
@@ -2831,30 +2829,30 @@ NS_IMETHODIMP nsImapService::NewChannel(
}
}
}
if (NS_SUCCEEDED(rv))
NS_IF_ADDREF(*aRetVal = channel);
return rv;
}
-NS_IMETHODIMP nsImapService::SetDefaultLocalPath(nsILocalFile *aPath)
+NS_IMETHODIMP nsImapService::SetDefaultLocalPath(nsIFile *aPath)
{
NS_ENSURE_ARG_POINTER(aPath);
return NS_SetPersistentFile(PREF_MAIL_ROOT_IMAP_REL, PREF_MAIL_ROOT_IMAP, aPath);
}
-NS_IMETHODIMP nsImapService::GetDefaultLocalPath(nsILocalFile **aResult)
+NS_IMETHODIMP nsImapService::GetDefaultLocalPath(nsIFile **aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nsnull;
bool havePref;
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
nsresult rv = NS_GetPersistentFile(PREF_MAIL_ROOT_IMAP_REL,
PREF_MAIL_ROOT_IMAP,
NS_APP_IMAP_MAIL_50_DIR,
havePref,
getter_AddRefs(localFile));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(localFile, NS_ERROR_FAILURE);
--- a/mailnews/import/applemail/src/nsAppleMailImport.cpp
+++ b/mailnews/import/applemail/src/nsAppleMailImport.cpp
@@ -9,17 +9,17 @@
#endif
#include "nsStringGlue.h"
#include "nsCOMPtr.h"
#include "nsISupportsPrimitives.h"
#include "nsIImportService.h"
#include "nsIImportMailboxDescriptor.h"
#include "nsIImportGeneric.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIStringBundle.h"
#include "nsIMsgFolder.h"
#include "nsIMsgHdr.h"
#include "nsIMsgPluggableStore.h"
#include "nsNetUtil.h"
#include "nsMsgUtils.h"
#include "mozilla/Services.h"
@@ -160,17 +160,17 @@ NS_IMETHODIMP nsAppleMailImportMail::Get
NS_ENSURE_ARG_POINTER(aLocation);
NS_ENSURE_ARG_POINTER(aUserVerify);
*aLocation = nsnull;
*aFound = false;
*aUserVerify = true;
// try to find current user's top-level Mail folder
- nsCOMPtr<nsILocalFile> mailFolder(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
+ nsCOMPtr<nsIFile> mailFolder(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
if (mailFolder) {
nsresult rv = mailFolder->InitWithNativePath(NS_LITERAL_CSTRING(DEFAULT_MAIL_FOLDER));
if (NS_SUCCEEDED(rv)) {
*aFound = true;
*aUserVerify = false;
CallQueryInterface(mailFolder, aLocation);
}
}
@@ -204,30 +204,27 @@ NS_IMETHODIMP nsAppleMailImportMail::Fin
// 1. look for accounts with mailboxes
FindAccountMailDirs(aMailboxFile, resultsArray, importService);
mCurDepth--;
if (NS_SUCCEEDED(rv)) {
// 2. look for "global" mailboxes, that don't belong to any specific account. they are inside the
// root's Mailboxes/ folder
- nsCOMPtr<nsILocalFile> mailboxesDir(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
+ nsCOMPtr<nsIFile> mailboxesDir(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv)) {
- nsCOMPtr<nsILocalFile> loc(do_QueryInterface(aMailboxFile, &rv));
- if (NS_SUCCEEDED(rv)) {
- mailboxesDir->InitWithFile(loc);
+ mailboxesDir->InitWithFile(aMailboxFile);
rv = mailboxesDir->Append(NS_LITERAL_STRING("Mailboxes"));
if (NS_SUCCEEDED(rv)) {
IMPORT_LOG0("Looking for global Apple mailboxes");
mCurDepth++;
rv = FindMboxDirs(mailboxesDir, resultsArray, importService);
mCurDepth--;
}
- }
}
}
if (NS_SUCCEEDED(rv) && resultsArray)
resultsArray.swap(*aResult);
return rv;
}
@@ -240,17 +237,17 @@ void nsAppleMailImportMail::FindAccountM
nsresult rv = aRoot->GetDirectoryEntries(getter_AddRefs(directoryEnumerator));
if (NS_FAILED(rv))
return;
bool hasMore = false;
while (NS_SUCCEEDED(directoryEnumerator->HasMoreElements(&hasMore)) && hasMore) {
// get the next file entry
- nsCOMPtr<nsILocalFile> currentEntry;
+ nsCOMPtr<nsIFile> currentEntry;
{
nsCOMPtr<nsISupports> rawSupports;
directoryEnumerator->GetNext(getter_AddRefs(rawSupports));
if (!rawSupports)
continue;
currentEntry = do_QueryInterface(rawSupports);
if (!currentEntry)
continue;
@@ -283,17 +280,17 @@ void nsAppleMailImportMail::FindAccountM
// create a mailbox for this account, so we get a parent for "Inbox", "Sent Messages", etc.
nsCOMPtr<nsIImportMailboxDescriptor> desc;
nsresult rv = aImportService->CreateNewMailboxDescriptor(getter_AddRefs(desc));
desc->SetSize(1);
desc->SetDepth(mCurDepth);
desc->SetDisplayName(folderName.get());
desc->SetIdentifier(kAccountMailboxID);
- nsCOMPtr<nsILocalFile> mailboxDescFile;
+ nsCOMPtr<nsIFile> mailboxDescFile;
rv = desc->GetFile(getter_AddRefs(mailboxDescFile));
if (!mailboxDescFile)
continue;
mailboxDescFile->InitWithFile(currentEntry);
// add this mailbox descriptor to the list
aMailboxDescs->AppendElement(desc);
@@ -303,17 +300,17 @@ void nsAppleMailImportMail::FindAccountM
FindMboxDirs(currentEntry, aMailboxDescs, aImportService);
mCurDepth--;
}
}
}
}
// adds the specified file as a mailboxdescriptor to the array
-nsresult nsAppleMailImportMail::AddMboxDir(nsILocalFile *aFolder, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService)
+nsresult nsAppleMailImportMail::AddMboxDir(nsIFile *aFolder, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService)
{
nsAutoString folderName;
aFolder->GetLeafName(folderName);
// cut off the suffix, if any, or prefix if this is an account folder.
if (StringEndsWith(folderName, NS_LITERAL_STRING(POP_MBOX_SUFFIX)))
folderName.SetLength(folderName.Length()-5);
else if (StringEndsWith(folderName, NS_LITERAL_STRING(IMAP_MBOX_SUFFIX)))
@@ -342,17 +339,17 @@ nsresult nsAppleMailImportMail::AddMboxD
if (dirEnumerator) {
bool hasMore = false;
while (NS_SUCCEEDED(dirEnumerator->HasMoreElements(&hasMore)) && hasMore) {
nsCOMPtr<nsISupports> rawSupports;
dirEnumerator->GetNext(getter_AddRefs(rawSupports));
if (!rawSupports)
continue;
- nsCOMPtr<nsILocalFile> file(do_QueryInterface(rawSupports));
+ nsCOMPtr<nsIFile> file(do_QueryInterface(rawSupports));
if (file) {
bool isFile = false;
file->IsFile(&isFile);
if (isFile)
numMessages++;
}
}
}
@@ -360,17 +357,17 @@ nsresult nsAppleMailImportMail::AddMboxD
desc->SetSize(numMessages);
desc->SetDisplayName(folderName.get());
desc->SetDepth(mCurDepth);
IMPORT_LOG3("Will import %s with approx %d messages, depth is %d", NS_ConvertUTF16toUTF8(folderName).get(), numMessages, mCurDepth);
// XXX: this is silly. there's no setter for the mailbox descriptor's file, so we need to get it, and then modify it.
- nsCOMPtr<nsILocalFile> mailboxDescFile;
+ nsCOMPtr<nsIFile> mailboxDescFile;
rv = desc->GetFile(getter_AddRefs(mailboxDescFile));
NS_ENSURE_SUCCESS(rv, rv);
if (mailboxDescFile)
mailboxDescFile->InitWithFile(aFolder);
// add this mailbox descriptor to the list
aMailboxDescs->AppendElement(desc);
@@ -384,17 +381,17 @@ nsresult nsAppleMailImportMail::AddMboxD
//
// If a mailbox has sub-mailboxes, they are contained in a sibling folder with the same name without the ".mbox" part.
// example:
// MyParentMailbox.mbox/
// MyParentMailbox/
// MyChildMailbox.mbox/
// MyOtherChildMailbox.mbox/
//
-nsresult nsAppleMailImportMail::FindMboxDirs(nsILocalFile *aFolder, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService)
+nsresult nsAppleMailImportMail::FindMboxDirs(nsIFile *aFolder, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService)
{
NS_ENSURE_ARG_POINTER(aFolder);
NS_ENSURE_ARG_POINTER(aMailboxDescs);
NS_ENSURE_ARG_POINTER(aImportService);
// make sure this is a directory.
bool isDir = false;
if (NS_FAILED(aFolder->IsDirectory(&isDir)) || !isDir)
@@ -405,17 +402,17 @@ nsresult nsAppleMailImportMail::FindMbox
nsresult rv = aFolder->GetDirectoryEntries(getter_AddRefs(directoryEnumerator));
if (NS_FAILED(rv) || !directoryEnumerator)
return rv;
bool hasMore = false;
while (NS_SUCCEEDED(directoryEnumerator->HasMoreElements(&hasMore)) && hasMore) {
// get the next file entry
- nsCOMPtr<nsILocalFile> currentEntry;
+ nsCOMPtr<nsIFile> currentEntry;
{
nsCOMPtr<nsISupports> rawSupports;
directoryEnumerator->GetNext(getter_AddRefs(rawSupports));
if (!rawSupports)
continue;
currentEntry = do_QueryInterface(rawSupports);
if (!currentEntry)
continue;
@@ -445,17 +442,17 @@ nsresult nsAppleMailImportMail::FindMbox
// cut off suffix
if (StringEndsWith(siblingMailboxDirPath, NS_LITERAL_STRING(IMAP_MBOX_SUFFIX)))
siblingMailboxDirPath.SetLength(siblingMailboxDirPath.Length()-9);
else if (StringEndsWith(siblingMailboxDirPath, NS_LITERAL_STRING(POP_MBOX_SUFFIX)))
siblingMailboxDirPath.SetLength(siblingMailboxDirPath.Length()-5);
IMPORT_LOG1("trying to locate a '%s'", NS_ConvertUTF16toUTF8(siblingMailboxDirPath).get());
- nsCOMPtr<nsILocalFile> siblingMailboxDir(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
+ nsCOMPtr<nsIFile> siblingMailboxDir(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
if (NS_FAILED(rv))
continue;
rv = siblingMailboxDir->InitWithPath(siblingMailboxDirPath);
bool reallyExists = false;
siblingMailboxDir->Exists(&reallyExists);
if (NS_SUCCEEDED(rv) && reallyExists) {
@@ -481,17 +478,17 @@ nsAppleMailImportMail::ImportMailbox(nsI
nsAutoString errorLog, successLog;
// reset progress
mProgress = 0;
nsAutoString mailboxName;
aMailbox->GetDisplayName(getter_Copies(mailboxName));
- nsCOMPtr<nsILocalFile> mboxFolder;
+ nsCOMPtr<nsIFile> mboxFolder;
nsresult rv = aMailbox->GetFile(getter_AddRefs(mboxFolder));
if (NS_FAILED(rv) || !mboxFolder) {
ReportStatus(APPLEMAILIMPORT_MAILBOX_CONVERTERROR, mailboxName, errorLog);
SetLogs(successLog, errorLog, aSuccessLog, aErrorLog);
return NS_ERROR_FAILURE;
}
// if we're an account mailbox, nothing do. if we're a real mbox
@@ -538,17 +535,17 @@ nsAppleMailImportMail::ImportMailbox(nsI
return NS_ERROR_FAILURE;
}
bool hasMore = false;
nsCOMPtr<nsIOutputStream> outStream;
while (NS_SUCCEEDED(directoryEnumerator->HasMoreElements(&hasMore)) && hasMore) {
// get the next file entry
- nsCOMPtr<nsILocalFile> currentEntry;
+ nsCOMPtr<nsIFile> currentEntry;
{
nsCOMPtr<nsISupports> rawSupports;
directoryEnumerator->GetNext(getter_AddRefs(rawSupports));
if (!rawSupports)
continue;
currentEntry = do_QueryInterface(rawSupports);
if (!currentEntry)
continue;
--- a/mailnews/import/applemail/src/nsAppleMailImport.h
+++ b/mailnews/import/applemail/src/nsAppleMailImport.h
@@ -58,18 +58,18 @@ class nsAppleMailImportMail : public nsI
NS_DECL_ISUPPORTS
NS_DECL_NSIIMPORTMAIL
nsresult Initialize();
private:
void FindAccountMailDirs(nsIFile *aRoot, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService);
- nsresult FindMboxDirs(nsILocalFile *aFolder, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService);
- nsresult AddMboxDir(nsILocalFile *aFolder, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService);
+ nsresult FindMboxDirs(nsIFile *aFolder, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService);
+ nsresult AddMboxDir(nsIFile *aFolder, nsISupportsArray *aMailboxDescs, nsIImportService *aImportService);
// aInfoString is the format to a "foo %s" string. It may be NULL if the error string needs no such format.
void ReportStatus(PRInt32 aErrorNum, nsString &aName, nsAString &aStream);
static void SetLogs(const nsAString& success, const nsAString& error, PRUnichar **aOutErrorLog, PRUnichar **aSuccessLog);
nsCOMPtr<nsIStringBundle> mBundle;
PRUint32 mProgress;
PRUint16 mCurDepth;
--- a/mailnews/import/applemail/src/nsEmlxHelperUtils.h
+++ b/mailnews/import/applemail/src/nsEmlxHelperUtils.h
@@ -5,17 +5,17 @@
#ifndef nsEmlxHelperUtils_h___
#define nsEmlxHelperUtils_h___
#include "nscore.h"
#include "nsStringGlue.h"
class nsIOutputStream;
-class nsILocalFile;
+class nsIFile;
class nsEmlxHelperUtils {
/* All emlx messages have a "flags" number in the metadata.
These are the masks to decode that, found via http://jwz.livejournal.com/505711.html */
enum EmlxMetadataMask {
kRead = 1 << 0, // read
// 1 << 1, // deleted
kAnswered = 1 << 2, // answered
@@ -43,13 +43,13 @@ class nsEmlxHelperUtils {
static nsresult ConvertToMboxRD(const char *aMessageBufferStart, const char *aMessageBufferEnd, nsCString &aOutBuffer);
// returns an int representing the X-Mozilla-Status flags set (e.g. "read", "flagged") converted from EMLX flags.
static nsresult ConvertToMozillaStatusFlags(const char *aXMLBufferStart, const char *aXMLBufferEnd, PRUint32 *aMozillaStatusFlags);
public:
// add an .emlx message to the mbox output
- static nsresult AddEmlxMessageToStream(nsILocalFile *aEmlxFile, nsIOutputStream *aOutoutStream);
+ static nsresult AddEmlxMessageToStream(nsIFile *aEmlxFile, nsIOutputStream *aOutoutStream);
};
#endif // nsEmlxHelperUtils_h___
--- a/mailnews/import/applemail/src/nsEmlxHelperUtils.mm
+++ b/mailnews/import/applemail/src/nsEmlxHelperUtils.mm
@@ -100,17 +100,17 @@ nsresult nsEmlxHelperUtils::ConvertToMbo
chunkStart = foundFromLines[i];
}
aOutBuffer.Append(chunkStart, (aMessageBufferEnd - chunkStart));
}
return NS_OK;
}
-nsresult nsEmlxHelperUtils::AddEmlxMessageToStream(nsILocalFile *aMessage, nsIOutputStream *aOut)
+nsresult nsEmlxHelperUtils::AddEmlxMessageToStream(nsIFile *aMessage, nsIOutputStream *aOut)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
// needed to be sure autoreleased objects are released too, which they might not
// in a C++ environment where the main event loop has no autorelease pool (e.g on a XPCOM thread)
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
nsresult rv = NS_ERROR_FAILURE;
--- a/mailnews/import/eudora/src/nsEudoraAddress.h
+++ b/mailnews/import/eudora/src/nsEudoraAddress.h
@@ -5,17 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsEudoraAddress_h__
#define nsEudoraAddress_h__
#include "nscore.h"
#include "nsStringGlue.h"
#include "nsVoidArray.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsISupportsArray.h"
#include "nsCOMPtr.h"
#include "nsIImportService.h"
class nsIAddrDatabase;
class CAliasEntry;
class CAliasData;
--- a/mailnews/import/eudora/src/nsEudoraCompose.cpp
+++ b/mailnews/import/eudora/src/nsEudoraCompose.cpp
@@ -516,17 +516,17 @@ nsresult nsEudoraCompose::GetLocalAttach
for (PRInt32 i = 0; i < count; i++) {
nsCOMPtr<nsIMsgAttachedFile> a(do_CreateInstance(NS_MSGATTACHEDFILE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
// nsMsgNewURL(&url, "file://C:/boxster.jpg");
// a[i].orig_url = url;
pAttach = (ImportAttachment *) m_pAttachments->ElementAt(i);
- nsCOMPtr<nsILocalFile> tmpFile = do_QueryInterface(pAttach->pAttachment);
+ nsCOMPtr<nsIFile> tmpFile = do_QueryInterface(pAttach->pAttachment);
a->SetTmpFile(tmpFile);
urlStr.Adopt(0);
nsCOMPtr <nsIURI> uri;
nsresult rv = NS_NewFileURI(getter_AddRefs(uri), pAttach->pAttachment);
NS_ENSURE_SUCCESS(rv, nsnull);
uri->GetSpec(urlStr);
if (urlStr.IsEmpty())
--- a/mailnews/import/eudora/src/nsEudoraFilters.h
+++ b/mailnews/import/eudora/src/nsEudoraFilters.h
@@ -2,17 +2,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsEudoraFilters_h___
#define nsEudoraFilters_h___
#include "nsIImportFilters.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsCOMPtr.h"
#include "nsMsgFilterCore.h"
class nsIMsgFolder;
class nsEudoraFilters : public nsIImportFilters {
public:
nsEudoraFilters();
--- a/mailnews/import/eudora/src/nsEudoraImport.cpp
+++ b/mailnews/import/eudora/src/nsEudoraImport.cpp
@@ -511,17 +511,17 @@ ImportEudoraMailImpl::ImportMailbox(nsII
{
IMPORT_LOG0("Mailbox size is 0, skipping mailbox.\n");
ReportSuccess(name, 0, &success);
SetLogs(success, error, pErrorLog, pSuccessLog);
return NS_OK;
}
- nsCOMPtr <nsILocalFile> inFile;
+ nsCOMPtr <nsIFile> inFile;
if (NS_FAILED(pSource->GetFile(getter_AddRefs(inFile))))
{
ReportError(EUDORAIMPORT_MAILBOX_BADSOURCEFILE, name, &error);
SetLogs(success, error, pErrorLog, pSuccessLog);
return NS_ERROR_FAILURE;
}
#ifdef IMPORT_DEBUG
--- a/mailnews/import/eudora/src/nsEudoraMac.cpp
+++ b/mailnews/import/eudora/src/nsEudoraMac.cpp
@@ -138,17 +138,17 @@ bool nsEudoraMac::VerifyEudoraLocation(n
nsCOMPtr <nsIFile> prefFile;
int count = 0;
OSType type, creator;
while (hasMore && NS_SUCCEEDED(rv) && count < 2)
{
nsCOMPtr<nsISupports> aSupport;
rv = directoryEnumerator->GetNext(getter_AddRefs(aSupport));
- nsCOMPtr<nsILocalFile> entry(do_QueryInterface(aSupport, &rv));
+ nsCOMPtr<nsIFile> entry(do_QueryInterface(aSupport, &rv));
directoryEnumerator->HasMoreElements(&hasMore);
// find a file with TEXT, CSOm that isn't the nicknames file
// or just cheat and look for more than 1 file?
{
nsCOMPtr<nsILocalFileMac> macFile = do_QueryInterface(entry, &rv);
if (NS_SUCCEEDED(rv))
@@ -255,17 +255,17 @@ nsresult nsEudoraMac::IterateMailDir(nsI
NS_ENSURE_SUCCESS(rv, rv);
directoryEnumerator->HasMoreElements(&hasMore);
while (hasMore && NS_SUCCEEDED(rv))
{
nsCOMPtr<nsISupports> aSupport;
rv = directoryEnumerator->GetNext(getter_AddRefs(aSupport));
- nsCOMPtr<nsILocalFile> entry(do_QueryInterface(aSupport, &rv));
+ nsCOMPtr<nsIFile> entry(do_QueryInterface(aSupport, &rv));
directoryEnumerator->HasMoreElements(&hasMore);
bool isFolder;
bool isFile;
nsCString fName;
nsCString ext;
nsCString name;
OSType type;
@@ -332,33 +332,32 @@ nsresult nsEudoraMac::FoundMailbox(nsIFi
nsresult rv = pImport->CreateNewMailboxDescriptor(getter_AddRefs(desc));
if (NS_SUCCEEDED(rv))
{
PRInt64 sz = 0;
mailFile->GetFileSize(&sz);
desc->SetDisplayName(displayName.get());
desc->SetDepth(m_depth);
- nsCOMPtr <nsILocalFile> pLocalFile;
+ nsCOMPtr <nsIFile> pLocalFile;
desc->GetFile(getter_AddRefs(pLocalFile));
if (pLocalFile)
{
- nsCOMPtr <nsILocalFile> localMailFile = do_QueryInterface(mailFile);
- pLocalFile->InitWithFile(localMailFile);
+ pLocalFile->InitWithFile(mailFile);
}
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
pArray->AppendElement(pInterface);
pInterface->Release();
}
return NS_OK;
}
-nsresult nsEudoraMac::FoundMailFolder(nsILocalFile *mailFolder, const char *pName, nsISupportsArray *pArray, nsIImportService *pImport)
+nsresult nsEudoraMac::FoundMailFolder(nsIFile *mailFolder, const char *pName, nsISupportsArray *pArray, nsIImportService *pImport)
{
nsAutoString displayName;
nsCOMPtr<nsIImportMailboxDescriptor> desc;
nsISupports * pInterface;
NS_CopyNativeToUnicode(nsDependentCString(pName), displayName);
#ifdef IMPORT_DEBUG
@@ -373,17 +372,17 @@ nsresult nsEudoraMac::FoundMailFolder(ns
nsresult rv = pImport->CreateNewMailboxDescriptor(getter_AddRefs(desc));
if (NS_SUCCEEDED(rv))
{
PRInt64 sz = 0;
desc->SetDisplayName(displayName.get());
desc->SetDepth(m_depth);
desc->SetSize(sz);
- nsCOMPtr <nsILocalFile> pFile;
+ nsCOMPtr <nsIFile> pFile;
desc->GetFile(getter_AddRefs(pFile));
if (pFile)
pFile->InitWithFile(mailFolder);
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
pArray->AppendElement(pInterface);
pInterface->Release();
}
@@ -984,19 +983,17 @@ nsresult nsEudoraMac::GetAttachmentInfo(
typeStr.Append((const char *)&type, 4);
IMPORT_LOG3("\tAttachment type: %s, creator: %s, fileNum: %ld\n", typeStr.get(), creatStr.get(), fNum);
IMPORT_LOG1("\tAttachment file name: %s\n", str.get());
#endif
FSRef fsRef;
memset(&fsRef, 0, sizeof(fsRef));
{
nsresult rv;
- nsCOMPtr <nsILocalFile> pLocalFile = do_QueryInterface(pFile, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
- pLocalFile->InitWithNativePath(str);
+ rv = pFile->InitWithNativePath(str);
if (NS_FAILED(rv))
{
IMPORT_LOG0("\tfailed to set native path\n");
return rv;
}
pFile->GetNativeLeafName(aAttachment);
@@ -1106,20 +1103,19 @@ bool nsEudoraMac::FindAddressFolder(nsIF
}
nsresult nsEudoraMac::FindAddressBooks(nsIFile *pRoot, nsISupportsArray **ppArray)
{
// Look for the nicknames file in this folder and then
// additional files in the Nicknames folder
// Try and find the nickNames file
nsresult rv;
- nsCOMPtr<nsILocalFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr<nsIFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> localRoot = do_QueryInterface(pRoot);
- rv = file->InitWithFile(localRoot);
+ rv = file->InitWithFile(pRoot);
if (NS_FAILED(rv))
return rv;
rv = NS_NewISupportsArray(ppArray);
if (NS_FAILED(rv))
{
IMPORT_LOG0("FAILED to allocate the nsISupportsArray\n");
return rv;
}
@@ -1163,17 +1159,17 @@ nsresult nsEudoraMac::FindAddressBooks(n
if (NS_FAILED(rv))
{
IMPORT_LOG0("*** Error creating address book descriptor for eudora nicknames\n");
return rv;
}
}
// Now try the directory of address books!
- rv = file->InitWithFile(localRoot);
+ rv = file->InitWithFile(pRoot);
if (NS_SUCCEEDED(rv))
rv = file->AppendNative(NS_LITERAL_CSTRING("Nicknames Folder"));
exists = false;
bool isDir = false;
if (NS_SUCCEEDED(rv))
rv = file->Exists(&exists);
if (NS_SUCCEEDED(rv) && exists)
rv = file->IsDirectory(&isDir);
@@ -1191,17 +1187,17 @@ nsresult nsEudoraMac::FindAddressBooks(n
nsCString name;
OSType type;
OSType creator;
while (hasMore && NS_SUCCEEDED(rv))
{
nsCOMPtr<nsISupports> aSupport;
rv = directoryEnumerator->GetNext(getter_AddRefs(aSupport));
- nsCOMPtr<nsILocalFile> entry(do_QueryInterface(aSupport, &rv));
+ nsCOMPtr<nsIFile> entry(do_QueryInterface(aSupport, &rv));
directoryEnumerator->HasMoreElements(&hasMore);
if (NS_SUCCEEDED(rv))
{
isFile = false;
rv = entry->IsFile(&isFile);
rv = entry->GetLeafName(displayName);
if (NS_SUCCEEDED(rv) && !displayName.IsEmpty() && isFile)
--- a/mailnews/import/eudora/src/nsEudoraMac.h
+++ b/mailnews/import/eudora/src/nsEudoraMac.h
@@ -65,17 +65,17 @@ private:
nsresult ScanMailDir(nsIFile *pFolder,
nsISupportsArray *pArray,
nsIImportService *pImport);
nsresult IterateMailDir(nsIFile *pFolder,
nsISupportsArray *pArray,
nsIImportService *pImport);
- nsresult FoundMailFolder(nsILocalFile *mailFolder,
+ nsresult FoundMailFolder(nsIFile *mailFolder,
const char *pName,
nsISupportsArray *pArray,
nsIImportService *pImport);
nsresult FoundMailbox(nsIFile *mailFile,
const char *pName,
nsISupportsArray *pArray,
nsIImportService *pImport);
@@ -108,15 +108,15 @@ private:
static bool GetSettingsFromResource(nsIFile *pSettings,
short resId,
nsCString **pStrs,
bool *pIMAP);
private:
PRUint32 m_depth;
- nsCOMPtr <nsILocalFile> m_mailImportLocation;
+ nsCOMPtr <nsIFile> m_mailImportLocation;
bool HasResourceFork(FSRef *fsRef);
};
#endif /* nsEudoraMac_h__ */
--- a/mailnews/import/eudora/src/nsEudoraMailbox.cpp
+++ b/mailnews/import/eudora/src/nsEudoraMailbox.cpp
@@ -1308,17 +1308,17 @@ nsresult nsEudoraMailbox::ExamineAttachm
return NS_OK;
}
bool nsEudoraMailbox::AddAttachment(nsCString& fileName)
{
IMPORT_LOG1("Found attachment: %s\n", fileName.get());
nsresult rv;
- nsCOMPtr <nsILocalFile> pFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr <nsIFile> pFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
if (NS_FAILED(rv))
return false;
nsCString mimeType;
nsCString attachmentName;
if (NS_FAILED(GetAttachmentInfo(fileName.get(), pFile, mimeType, attachmentName)))
return false;
--- a/mailnews/import/eudora/src/nsEudoraMailbox.h
+++ b/mailnews/import/eudora/src/nsEudoraMailbox.h
@@ -182,17 +182,17 @@ private:
nsresult ExamineAttachment(SimpleBufferTonyRCopiedOnce& data);
bool AddAttachment(nsCString& fileName);
static PRInt32 AsciiToLong(const char *pChar, PRInt32 len);
static int IsWeekDayStr(const char *pStr);
static int IsMonthStr(const char *pStr);
protected:
- nsCOMPtr <nsILocalFile> m_mailImportLocation;
+ nsCOMPtr <nsIFile> m_mailImportLocation;
private:
PRInt64 m_mailSize;
PRUint32 m_fromLen;
nsVoidArray m_attachments;
};
--- a/mailnews/import/eudora/src/nsEudoraSettings.h
+++ b/mailnews/import/eudora/src/nsEudoraSettings.h
@@ -3,17 +3,17 @@
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsEudoraSettings_h___
#define nsEudoraSettings_h___
#include "nsIImportSettings.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsCOMPtr.h"
class nsEudoraSettings : public nsIImportSettings {
public:
nsEudoraSettings();
virtual ~nsEudoraSettings();
static nsresult Create(nsIImportSettings** aImport);
--- a/mailnews/import/eudora/src/nsEudoraWin32.cpp
+++ b/mailnews/import/eudora/src/nsEudoraWin32.cpp
@@ -69,17 +69,17 @@ bool nsEudoraWin32::FindMailFolder(nsIFi
{
return FindEudoraLocation(pFolder);
}
bool nsEudoraWin32::FindEudoraLocation(nsIFile **pFolder, bool findIni)
{
bool result = false;
bool exists = false;
- nsCOMPtr <nsILocalFile> eudoraPath = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
+ nsCOMPtr <nsIFile> eudoraPath = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
// look in the registry to see where eudora is installed?
HKEY sKey;
if (::RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Qualcomm\\Eudora\\CommandLine", 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS)
{
// get the value of "Current"
BYTE *pBytes = GetValueBytes(sKey, "Current");
if (pBytes)
{
@@ -244,17 +244,17 @@ nsresult nsEudoraWin32::IterateMailDir(n
nsCString fName;
nsCString ext;
nsCString name;
while (hasMore && NS_SUCCEEDED(rv))
{
nsCOMPtr<nsISupports> aSupport;
rv = directoryEnumerator->GetNext(getter_AddRefs(aSupport));
- nsCOMPtr<nsILocalFile> entry(do_QueryInterface(aSupport, &rv));
+ nsCOMPtr<nsIFile> entry(do_QueryInterface(aSupport, &rv));
directoryEnumerator->HasMoreElements(&hasMore);
if (NS_SUCCEEDED(rv))
{
rv = entry->GetNativeLeafName(fName);
if (NS_SUCCEEDED(rv) && !fName.IsEmpty())
{
if (fName.Length() > 4)
@@ -445,22 +445,21 @@ nsresult nsEudoraWin32::FoundMailbox(nsI
nsresult rv = pImport->CreateNewMailboxDescriptor(getter_AddRefs(desc));
if (NS_SUCCEEDED(rv))
{
PRInt64 sz = 0;
mailFile->GetFileSize(&sz);
desc->SetDisplayName(displayName.get());
desc->SetDepth(m_depth);
desc->SetSize(sz);
- nsCOMPtr <nsILocalFile> pFile = nsnull;
+ nsCOMPtr <nsIFile> pFile = nsnull;
desc->GetFile(getter_AddRefs(pFile));
if (pFile)
{
- nsCOMPtr <nsILocalFile> localMailFile = do_QueryInterface(mailFile);
- pFile->InitWithFile(localMailFile);
+ pFile->InitWithFile(mailFile);
}
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
pArray->AppendElement(pInterface);
pInterface->Release();
}
return NS_OK;
}
@@ -486,22 +485,21 @@ nsresult nsEudoraWin32::FoundMailFolder(
nsresult rv = pImport->CreateNewMailboxDescriptor(getter_AddRefs(desc));
if (NS_SUCCEEDED(rv))
{
PRUint32 sz = 0;
desc->SetDisplayName(displayName.get());
desc->SetDepth(m_depth);
desc->SetSize(sz);
- nsCOMPtr <nsILocalFile> pFile = nsnull;
+ nsCOMPtr <nsIFile> pFile = nsnull;
desc->GetFile(getter_AddRefs(pFile));
if (pFile)
{
- nsCOMPtr <nsILocalFile> localMailFile = do_QueryInterface(mailFolder);
- pFile->InitWithFile(localMailFile);
+ pFile->InitWithFile(mailFolder);
}
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
pArray->AppendElement(pInterface);
pInterface->Release();
}
return NS_OK;
}
@@ -663,17 +661,17 @@ bool nsEudoraWin32::FindFiltersFile(nsIF
}
bool nsEudoraWin32::GetMailboxNameHierarchy(const nsACString& pEudoraLocation, const char* pEudoraFilePath, nsCString& nameHierarchy)
{
if (pEudoraLocation.IsEmpty() || !pEudoraFilePath || !*pEudoraFilePath)
return false;
nsresult rv;
- nsCOMPtr <nsILocalFile> descMap = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
+ nsCOMPtr <nsIFile> descMap = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
rv = descMap->InitWithNativePath(pEudoraLocation);
NS_ENSURE_SUCCESS(rv, false);
rv = descMap->AppendNative(NS_LITERAL_CSTRING("descmap.pce"));
NS_ENSURE_SUCCESS(rv, false);
nsCOMPtr <nsIInputStream> inputStream;
rv = NS_NewLocalFileInputStream(getter_AddRefs(inputStream), descMap);
@@ -981,19 +979,17 @@ void nsEudoraWin32::SetSmtpServer(nsIMsg
}
}
}
nsresult nsEudoraWin32::GetAttachmentInfo(const char *pFileName, nsIFile *pFile, nsCString& mimeType, nsCString& aAttachmentName)
{
nsresult rv;
mimeType.Truncate();
- nsCOMPtr <nsILocalFile> pLocalFile = do_QueryInterface(pFile, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
- pLocalFile->InitWithNativePath(nsDependentCString(pFileName));
+ pFile->InitWithNativePath(nsDependentCString(pFileName));
bool isFile = false;
bool exists = false;
if (NS_FAILED(rv = pFile->Exists(&exists)))
return rv;
if (exists && NS_FAILED(rv = pFile->IsFile(&isFile)))
return rv;
if (!exists || !isFile)
@@ -1035,17 +1031,17 @@ nsresult nsEudoraWin32::GetAttachmentInf
if (exists && NS_FAILED(rv = altFile->IsFile(&isFile)))
return rv;
// Keep the new path if it helped us.
if (exists && isFile)
{
nsCString nativePath;
altFile->GetNativePath(nativePath);
- pLocalFile->InitWithNativePath(nativePath);
+ pFile->InitWithNativePath(nativePath);
}
}
}
if (exists && isFile)
{
nsCAutoString name;
pFile->GetNativeLeafName(name);
@@ -1080,33 +1076,30 @@ nsresult nsEudoraWin32::GetAttachmentInf
bool nsEudoraWin32::FindMimeIniFile(nsIFile *pFile)
{
bool hasMore;
nsCOMPtr<nsISimpleEnumerator> directoryEnumerator;
nsresult rv = pFile->GetDirectoryEntries(getter_AddRefs(directoryEnumerator));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr <nsILocalFile> pLocalFile = do_QueryInterface(pFile, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
directoryEnumerator->HasMoreElements(&hasMore);
bool isFile;
nsCOMPtr<nsIFile> entry;
nsCString fName;
nsCString ext;
nsCString name;
bool found = false;
while (hasMore && NS_SUCCEEDED(rv))
{
nsCOMPtr<nsISupports> aSupport;
rv = directoryEnumerator->GetNext(getter_AddRefs(aSupport));
- nsCOMPtr<nsILocalFile> entry(do_QueryInterface(aSupport, &rv));
+ nsCOMPtr<nsIFile> entry(do_QueryInterface(aSupport, &rv));
directoryEnumerator->HasMoreElements(&hasMore);
if (NS_SUCCEEDED(rv))
{
rv = entry->GetNativeLeafName(fName);
if (NS_SUCCEEDED(rv) && !fName.IsEmpty())
{
@@ -1129,21 +1122,21 @@ bool nsEudoraWin32::FindMimeIniFile(nsIF
{
if (found)
{
// which one of these files is newer?
PRInt64 modDate1, modDate2;
entry->GetLastModifiedTime(&modDate2);
pFile->GetLastModifiedTime(&modDate1);
if (modDate2 > modDate1)
- pLocalFile->InitWithFile(entry);
+ pFile->InitWithFile(entry);
}
else
{
- pLocalFile->InitWithFile(entry);
+ pFile->InitWithFile(entry);
found = true;
}
}
}
}
}
}
return found;
@@ -1170,17 +1163,17 @@ void nsEudoraWin32::GetMimeTypeFromExten
// TLR: FIXME: We should/could cache the extension to mime type maps we find
// and check the cache first before scanning all of eudora's mappings?
// It's not in the registry, try and find the .ini file for Eudora's private
// mime type list
if (!m_pMimeSection)
{
- nsCOMPtr <nsILocalFile> pFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
+ nsCOMPtr <nsIFile> pFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
if (!pFile)
return;
pFile->InitWithFile(m_mailImportLocation);
pFile->AppendNative(NS_LITERAL_CSTRING("eudora.ini"));
bool exists = false;
bool isFile = false;
@@ -1320,20 +1313,19 @@ bool nsEudoraWin32::FindAddressFolder(ns
IMPORT_LOG0("*** Looking for Eudora address folder\n");
return FindEudoraLocation(pFolder);
}
nsresult nsEudoraWin32::FindAddressBooks(nsIFile *pRoot, nsISupportsArray **ppArray)
{
nsresult rv;
- nsCOMPtr<nsILocalFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr<nsIFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> localRoot = do_QueryInterface(pRoot);
- rv = file->InitWithFile(localRoot);
+ rv = file->InitWithFile(pRoot);
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewISupportsArray(ppArray);
if (NS_FAILED(rv))
{
IMPORT_LOG0("FAILED to allocate the nsISupportsArray\n");
return rv;
}
@@ -1372,47 +1364,47 @@ nsresult nsEudoraWin32::FindAddressBooks
if (exists && isFile)
{
if (NS_FAILED(rv = FoundAddressBook(file, displayName.get(), *ppArray, impSvc)))
return rv;
}
// Try the default directory
- rv = rv = file->InitWithFile(localRoot);
+ rv = file->InitWithFile(pRoot);
if (NS_FAILED(rv))
return rv;
rv = file->AppendNative(NS_LITERAL_CSTRING("Nickname"));
bool isDir = false;
exists = false;
if (NS_SUCCEEDED(rv))
rv = file->Exists(&exists);
if (NS_SUCCEEDED(rv) && exists)
rv = file->IsDirectory(&isDir);
if (exists && isDir)
{
if (NS_FAILED(rv = ScanAddressDir(file, *ppArray, impSvc)))
return rv;
}
// Try the ini file to find other directories!
- rv = rv = file->InitWithFile(localRoot);
+ rv = file->InitWithFile(pRoot);
if (NS_FAILED(rv))
return rv;
rv = file->AppendNative(NS_LITERAL_CSTRING("eudora.ini"));
exists = false;
isFile = false;
if (NS_SUCCEEDED(rv))
rv = file->Exists(&exists);
if (NS_SUCCEEDED(rv) && exists)
rv = file->IsFile(&isFile);
if (!isFile || !exists)
{
- rv = file->InitWithFile(localRoot);
+ rv = file->InitWithFile(pRoot);
if (NS_FAILED(rv))
return NS_OK;
if (!FindMimeIniFile(file))
return NS_OK;
}
nsCString fileName;
file->GetNativePath(fileName);
@@ -1476,33 +1468,30 @@ nsresult nsEudoraWin32::FindAddressBooks
nsresult nsEudoraWin32::ScanAddressDir(nsIFile *pDir, nsISupportsArray *pArray, nsIImportService *impSvc)
{
bool hasMore;
nsCOMPtr<nsISimpleEnumerator> directoryEnumerator;
nsresult rv = pDir->GetDirectoryEntries(getter_AddRefs(directoryEnumerator));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr <nsILocalFile> pLocalFile = do_QueryInterface(pDir, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
directoryEnumerator->HasMoreElements(&hasMore);
bool isFile;
nsCOMPtr<nsIFile> entry;
nsCString fName;
nsCString ext;
nsCString name;
bool found = false;
while (hasMore && NS_SUCCEEDED(rv))
{
nsCOMPtr<nsISupports> aSupport;
rv = directoryEnumerator->GetNext(getter_AddRefs(aSupport));
- nsCOMPtr<nsILocalFile> entry(do_QueryInterface(aSupport, &rv));
+ nsCOMPtr<nsIFile> entry(do_QueryInterface(aSupport, &rv));
directoryEnumerator->HasMoreElements(&hasMore);
if (NS_SUCCEEDED(rv))
{
rv = entry->GetNativeLeafName(fName);
if (NS_SUCCEEDED(rv) && !fName.IsEmpty())
{
if (fName.Length() > 4)
@@ -1552,27 +1541,24 @@ nsresult nsEudoraWin32::FoundAddressBook
if (leaf.IsEmpty())
return NS_ERROR_FAILURE;
nsString tStr;
tStr = StringTail(leaf, 4);
if (tStr.LowerCaseEqualsLiteral(".txt") || tStr.LowerCaseEqualsLiteral(".nnt"))
leaf.SetLength(leaf.Length() - 4);
}
- nsCOMPtr<nsILocalFile> fileLoc = do_QueryInterface(file, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
rv = impSvc->CreateNewABDescriptor(getter_AddRefs(desc));
if (NS_SUCCEEDED(rv))
{
PRInt64 sz = 0;
file->GetFileSize(&sz);
desc->SetPreferredName(name);
desc->SetSize((PRUint32) sz);
- desc->SetAbFile(fileLoc);
+ desc->SetAbFile(file);
rv = desc->QueryInterface(kISupportsIID, (void **) &pInterface);
pArray->AppendElement(pInterface);
pInterface->Release();
}
if (NS_FAILED(rv))
{
IMPORT_LOG0("*** Error creating address book descriptor for eudora\n");
return rv;
--- a/mailnews/import/eudora/src/nsEudoraWin32.h
+++ b/mailnews/import/eudora/src/nsEudoraWin32.h
@@ -4,17 +4,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsEudoraWin32_h__
#define nsEudoraWin32_h__
#include "nscore.h"
#include "nsStringGlue.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsISupportsArray.h"
#include "nsEudoraMailbox.h"
#include "nsEudoraAddress.h"
#include <windows.h>
class nsIImportService;
class nsIMsgAccountManager;
--- a/mailnews/import/oexpress/WabObject.cpp
+++ b/mailnews/import/oexpress/WabObject.cpp
@@ -74,17 +74,17 @@ AddrImportField extraUserFields[kExtr
/*********************************************************************************/
// contructor for CWAB object
//
// pszFileName - FileName of WAB file to open
// if no file name is specified, opens the default
//
-CWAB::CWAB(nsILocalFile *file)
+CWAB::CWAB(nsIFile *file)
{
// Here we load the WAB Object and initialize it
m_pUniBuff = NULL;
m_uniBuffLen = 0;
m_bInitialized = false;
m_lpAdrBook = NULL;
m_lpWABObject = NULL;
--- a/mailnews/import/oexpress/WabObject.h
+++ b/mailnews/import/oexpress/WabObject.h
@@ -4,33 +4,33 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef WabObject_h___
#define WabObject_h___
#include "nscore.h"
#include "prtypes.h"
#include "nsStringGlue.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include <windows.h>
#include <wab.h>
class CWabIterator {
public:
virtual nsresult EnumUser(const PRUnichar *pName, LPENTRYID pEid, ULONG cbEid) = 0;
virtual nsresult EnumList(const PRUnichar *pName, LPENTRYID pEid, ULONG cbEid, LPMAPITABLE lpTable) = 0;
};
class CWAB
{
public:
- CWAB(nsILocalFile *fileName);
+ CWAB(nsIFile *fileName);
~CWAB();
bool Loaded(void) { return m_bInitialized;}
HRESULT IterateWABContents(CWabIterator *pIter, int *pDone);
// Methods for User entries
LPDISTLIST GetDistList(ULONG cbEid, LPENTRYID pEid);
--- a/mailnews/import/oexpress/nsOEImport.cpp
+++ b/mailnews/import/oexpress/nsOEImport.cpp
@@ -304,17 +304,17 @@ NS_IMETHODIMP ImportOEMailImpl::GetDefau
NS_PRECONDITION(ppLoc != nsnull, "null ptr");
NS_PRECONDITION(found != nsnull, "null ptr");
NS_PRECONDITION(userVerify != nsnull, "null ptr");
if (!ppLoc || !found || !userVerify)
return NS_ERROR_NULL_POINTER;
// use scanboxes to find the location.
nsresult rv;
- nsCOMPtr <nsILocalFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr <nsIFile> file = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
if (nsOEScanBoxes::FindMail(file)) {
*found = true;
NS_IF_ADDREF(*ppLoc = file);
}
else {
@@ -408,17 +408,17 @@ NS_IMETHODIMP ImportOEMailImpl::ImportMa
PRUint32 mailSize = 0;
pSource->GetSize(&mailSize);
if (mailSize == 0) {
ReportSuccess(name, 0, &success);
SetLogs(success, error, pErrorLog, pSuccessLog);
return NS_OK;
}
- nsCOMPtr <nsILocalFile> inFile;
+ nsCOMPtr <nsIFile> inFile;
if (NS_FAILED(pSource->GetFile(getter_AddRefs(inFile)))) {
ReportError(OEIMPORT_MAILBOX_BADSOURCEFILE, name, &error);
SetLogs(success, error, pErrorLog, pSuccessLog);
return NS_ERROR_FAILURE;
}
nsCString pPath;
inFile->GetNativePath(pPath);
--- a/mailnews/import/oexpress/nsOEMailbox.cpp
+++ b/mailnews/import/oexpress/nsOEMailbox.cpp
@@ -88,20 +88,19 @@ private:
bool CImportMailbox::ImportMailbox(PRUint32 *pDone, bool *pAbort,
nsString& name, nsIFile * inFile,
nsIMsgFolder *outFolder, PRUint32 *pCount)
{
bool done = false;
nsresult rv;
- nsCOMPtr <nsILocalFile> localInFile = do_QueryInterface(inFile, &rv);
- nsCOMPtr <nsILocalFile> idxFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr <nsIFile> idxFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
- rv = idxFile->InitWithFile(localInFile);
+ rv = idxFile->InitWithFile(inFile);
if (NS_FAILED(rv)) {
IMPORT_LOG0("New file spec failed!\n");
return false;
}
if (GetIndexFile(idxFile)) {
IMPORT_LOG1("Using index file for: %S\n", name.get());
--- a/mailnews/import/oexpress/nsOEScanBoxes.cpp
+++ b/mailnews/import/oexpress/nsOEScanBoxes.cpp
@@ -2,17 +2,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsOEScanBoxes.h"
#include "nsMsgUtils.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsIImportService.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIImportMailboxDescriptor.h"
#include "nsOERegUtil.h"
#include "nsOE5File.h"
#include "nsNetUtil.h"
#include "OEDebugLog.h"
#include "nsIInputStream.h"
#include "nsISeekableStream.h"
#include "plstr.h"
@@ -65,30 +65,29 @@ nsOEScanBoxes::~nsOEScanBoxes()
Identities/{GUID}/Software/Microsoft/Outlook Express/5.0/
*/
bool nsOEScanBoxes::Find50Mail(nsIFile *pWhere)
{
nsresult rv;
bool success = false;
HKEY sKey;
- nsCOMPtr <nsILocalFile> localWhere = do_QueryInterface(pWhere);
if (::RegOpenKeyEx(HKEY_CURRENT_USER, "Identities", 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) {
BYTE * pBytes = nsOERegUtil::GetValueBytes(sKey, "Default User ID");
::RegCloseKey(sKey);
if (pBytes) {
nsCString key("Identities\\");
key += (const char *)pBytes;
nsOERegUtil::FreeValueBytes(pBytes);
key += "\\Software\\Microsoft\\Outlook Express\\5.0";
if (::RegOpenKeyEx(HKEY_CURRENT_USER, key.get(), 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) {
pBytes = nsOERegUtil::GetValueBytes(sKey, "Store Root");
if (pBytes) {
- localWhere->InitWithNativePath(nsDependentCString((const char *)pBytes));
+ pWhere->InitWithNativePath(nsDependentCString((const char *)pBytes));
IMPORT_LOG1("Setting native path: %s\n", pBytes);
nsOERegUtil::FreeValueBytes(pBytes);
bool isDir = false;
rv = pWhere->IsDirectory(&isDir);
if (isDir && NS_SUCCEEDED(rv))
success = true;
@@ -101,25 +100,24 @@ bool nsOEScanBoxes::Find50Mail(nsIFile *
return success;
}
bool nsOEScanBoxes::FindMail(nsIFile *pWhere)
{
nsresult rv;
bool success = false;
HKEY sKey;
- nsCOMPtr <nsILocalFile> localWhere = do_QueryInterface(pWhere);
if (Find50Mail(pWhere))
return true;
if (::RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\Outlook Express", 0, KEY_QUERY_VALUE, &sKey) == ERROR_SUCCESS) {
LPBYTE pBytes = nsOERegUtil::GetValueBytes(sKey, "Store Root");
if (pBytes) {
- localWhere->InitWithNativePath(nsDependentCString((const char *) pBytes));
+ pWhere->InitWithNativePath(nsDependentCString((const char *) pBytes));
pWhere->AppendNative(NS_LITERAL_CSTRING("Mail"));
bool isDir = false;
rv = pWhere->IsDirectory(&isDir);
if (isDir && NS_SUCCEEDED(rv))
success = true;
delete [] pBytes;
}
::RegCloseKey(sKey);
@@ -547,17 +545,17 @@ bool nsOEScanBoxes::Scan50MailboxDir(nsI
bool isFile;
nsCOMPtr<nsIFile> entry;
nsCString fName;
while (hasMore && NS_SUCCEEDED(rv))
{
nsCOMPtr<nsISupports> aSupport;
rv = directoryEnumerator->GetNext(getter_AddRefs(aSupport));
- nsCOMPtr<nsILocalFile> entry(do_QueryInterface(aSupport, &rv));
+ nsCOMPtr<nsIFile> entry(do_QueryInterface(aSupport, &rv));
directoryEnumerator->HasMoreElements(&hasMore);
isFile = false;
rv = entry->IsFile(&isFile);
if (NS_SUCCEEDED(rv) && isFile) {
pLeaf = nsnull;
rv = entry->GetNativeLeafName(fName);
if (NS_SUCCEEDED(rv) &&
@@ -614,17 +612,17 @@ void nsOEScanBoxes::ScanMailboxDir(nsIFi
nsCString fName;
nsCString ext;
nsCString name;
while (hasMore && NS_SUCCEEDED(rv))
{
nsCOMPtr<nsISupports> aSupport;
rv = directoryEnumerator->GetNext(getter_AddRefs(aSupport));
- nsCOMPtr<nsILocalFile> entry(do_QueryInterface(aSupport, &rv));
+ nsCOMPtr<nsIFile> entry(do_QueryInterface(aSupport, &rv));
directoryEnumerator->HasMoreElements(&hasMore);
isFile = false;
rv = entry->IsFile(&isFile);
if (NS_SUCCEEDED(rv) && isFile)
{
rv = entry->GetNativeLeafName(pLeaf);
if (NS_SUCCEEDED(rv) && !pLeaf.IsEmpty() &&
@@ -715,17 +713,17 @@ void nsOEScanBoxes::BuildMailboxList(Mai
if (pBox == nsnull) {
IMPORT_LOG0("ERROR ASSIGNING STARTING MAILBOX\n");
}
}
nsresult rv;
- nsCOMPtr <nsILocalFile> file;
+ nsCOMPtr <nsIFile> file;
MailboxEntry * pChild;
nsIImportMailboxDescriptor * pID;
nsISupports * pInterface;
PRInt64 size;
nsCOMPtr<nsIImportService> impSvc(do_GetService(NS_IMPORTSERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
return;
@@ -733,18 +731,17 @@ void nsOEScanBoxes::BuildMailboxList(Mai
while (pBox) {
rv = impSvc->CreateNewMailboxDescriptor(&pID);
if (NS_SUCCEEDED(rv)) {
pID->SetDepth(depth);
pID->SetIdentifier(pBox->index);
pID->SetDisplayName((PRUnichar *)pBox->mailName.get());
if (!pBox->fileName.IsEmpty()) {
pID->GetFile(getter_AddRefs(file));
- nsCOMPtr <nsILocalFile> localRoot = do_QueryInterface(root);
- file->InitWithFile(localRoot);
+ file->InitWithFile(root);
file->AppendNative(pBox->fileName);
size = 0;
file->GetFileSize(&size);
pID->SetSize(size);
}
rv = pID->QueryInterface(kISupportsIID, (void **) &pInterface);
pArray->AppendElement(pInterface);
pInterface->Release();
--- a/mailnews/import/outlook/src/MapiMessage.cpp
+++ b/mailnews/import/outlook/src/MapiMessage.cpp
@@ -824,33 +824,33 @@ bool CMapiMessage::IterateAttachTable(LP
CMapiApi::FreeProws(lpRow);
}
} while (SUCCEEDED(hr) && cNumRows && lpRow);
return bResult;
}
-bool CMapiMessage::GetTmpFile(/*out*/ nsILocalFile **aResult)
+bool CMapiMessage::GetTmpFile(/*out*/ nsIFile **aResult)
{
nsCOMPtr<nsIFile> tmpFile;
nsresult rv = GetSpecialDirectoryWithFileName(NS_OS_TEMP_DIR,
"mapiattach.tmp",
getter_AddRefs(tmpFile));
if (NS_FAILED(rv))
return false;
rv = tmpFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 00600);
if (NS_FAILED(rv))
return false;
return NS_SUCCEEDED(CallQueryInterface(tmpFile, aResult));
}
-bool CMapiMessage::CopyMsgAttachToFile(LPATTACH lpAttach, /*out*/ nsILocalFile **tmp_file)
+bool CMapiMessage::CopyMsgAttachToFile(LPATTACH lpAttach, /*out*/ nsIFile **tmp_file)
{
bool bResult = true;
LPMESSAGE lpMsg;
HRESULT hr = lpAttach->OpenProperty(PR_ATTACH_DATA_OBJ, &IID_IMessage, 0, 0,
reinterpret_cast<LPUNKNOWN *>(&lpMsg));
NS_ENSURE_SUCCESS(hr, false);
if (!GetTmpFile(tmp_file))
@@ -866,17 +866,17 @@ bool CMapiMessage::CopyMsgAttachToFile(L
(*tmp_file)->Release();
*tmp_file = 0;
}
return NS_SUCCEEDED(rv);
}
bool CMapiMessage::CopyBinAttachToFile(LPATTACH lpAttach,
- nsILocalFile **tmp_file)
+ nsIFile **tmp_file)
{
nsCOMPtr<nsIFile> _tmp_file;
nsresult rv = GetSpecialDirectoryWithFileName(NS_OS_TEMP_DIR,
"mapiattach.tmp",
getter_AddRefs(_tmp_file));
NS_ENSURE_SUCCESS(rv, false);
rv = _tmp_file->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 00600);
--- a/mailnews/import/outlook/src/MapiMessage.h
+++ b/mailnews/import/outlook/src/MapiMessage.h
@@ -2,17 +2,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef MapiMessage_h___
#define MapiMessage_h___
#include "nsTArray.h"
#include "nsStringGlue.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "MapiApi.h"
#include "nsIMsgSend.h"
#include <vector>
#ifndef PR_LAST_VERB_EXECUTED
#define PR_LAST_VERB_EXECUTED PROP_TAG(PT_LONG, 0x1081)
#endif
@@ -195,17 +195,17 @@ public:
// The only required part of a message is its header
inline bool ValidState() const { return !m_headers.IsEmpty(); }
inline bool FullMessageDownloaded() const { return !m_dldStateHeadersOnly; }
private:
struct attach_data {
nsCOMPtr<nsIURI> orig_url;
- nsCOMPtr<nsILocalFile> tmp_file;
+ nsCOMPtr<nsIFile> tmp_file;
char *type;
char *encoding;
char *real_name;
char *cid;
bool delete_file;
attach_data() : type(0), encoding(0), real_name(0), cid(0), delete_file(false) {}
};
@@ -238,19 +238,19 @@ private:
// PR_DISPLAY_TO, _CC, _BCC
// PR_SUBJECT
// PR_MESSAGE_RECIPIENTS
// and PR_CREATION_TIME if needed?
bool FetchHeaders(void);
bool FetchBody(void);
void FetchFlags(void);
- static bool GetTmpFile(/*out*/ nsILocalFile **aResult);
- static bool CopyMsgAttachToFile(LPATTACH lpAttach, /*out*/ nsILocalFile **tmp_file);
- static bool CopyBinAttachToFile(LPATTACH lpAttach, nsILocalFile **tmp_file);
+ static bool GetTmpFile(/*out*/ nsIFile **aResult);
+ static bool CopyMsgAttachToFile(LPATTACH lpAttach, /*out*/ nsIFile **tmp_file);
+ static bool CopyBinAttachToFile(LPATTACH lpAttach, nsIFile **tmp_file);
static void ClearAttachment(attach_data* data);
void ClearAttachments();
bool AddAttachment(DWORD aNum);
bool IterateAttachTable(LPMAPITABLE tbl);
bool GetURL(nsIFile *aFile, nsIURI **url);
void ProcessAttachments();
--- a/mailnews/import/outlook/src/nsOutlookImport.cpp
+++ b/mailnews/import/outlook/src/nsOutlookImport.cpp
@@ -321,17 +321,17 @@ NS_IMETHODIMP ImportOutlookMailImpl::Get
if (!mapi.IterateStores(store))
return NS_OK;
if (store.GetSize() == 0)
return NS_OK;
nsresult rv;
- nsCOMPtr <nsILocalFile> resultFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
+ nsCOMPtr <nsIFile> resultFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
if (NS_FAILED(rv))
return rv;
*found = true;
NS_IF_ADDREF(*ppLoc = resultFile);
*userVerify = false;
return NS_OK;
--- a/mailnews/import/public/nsIImportMailboxDescriptor.idl
+++ b/mailnews/import/public/nsIImportMailboxDescriptor.idl
@@ -8,30 +8,30 @@
Interface for importing mail - ui provided by the import module. If
you wish to provide your own UI then implement the nsIImportGeneric
interface.
*/
#include "nsISupports.idl"
-interface nsILocalFile;
+interface nsIFile;
[scriptable, uuid(69eba744-9c4f-4f79-a964-2134746b3656)]
interface nsIImportMailboxDescriptor : nsISupports
{
attribute unsigned long identifier;
attribute unsigned long depth;
attribute unsigned long size;
wstring GetDisplayName();
void SetDisplayName( [const] in wstring name);
attribute boolean import;
- readonly attribute nsILocalFile file;
+ readonly attribute nsIFile file;
};
%{ C++
/*
The default implementation can be obtained from
--- a/mailnews/import/src/nsImportAddressBooks.cpp
+++ b/mailnews/import/src/nsImportAddressBooks.cpp
@@ -9,17 +9,17 @@
#include "nsMsgUtils.h"
#include "nsIImportService.h"
#include "nsIImportAddressBooks.h"
#include "nsIImportGeneric.h"
#include "nsISupportsPrimitives.h"
#include "nsIImportABDescriptor.h"
#include "nsIImportFieldMap.h"
#include "nsStringGlue.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIAddrDatabase.h"
#include "nsIAbManager.h"
#include "nsIAbLDIFService.h"
#include "nsAbBaseCID.h"
#include "nsIStringBundle.h"
#include "nsImportStringBundle.h"
#include "nsTextFormatter.h"
#include "nsServiceManagerUtils.h"
@@ -518,17 +518,17 @@ already_AddRefed<nsIAddrDatabase> GetAdd
// specific name. Major bogosity!
// For now, assume we didn't find anything with that name
}
IMPORT_LOG0("In GetAddressBook\n");
nsresult rv;
nsIAddrDatabase *pDatabase = nsnull;
- nsCOMPtr<nsILocalFile> dbPath;
+ nsCOMPtr<nsIFile> dbPath;
nsCOMPtr<nsIAbManager> abManager = do_GetService(NS_ABMANAGER_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv))
{
/* Get the profile directory */
rv = abManager->GetUserProfileDirectory(getter_AddRefs(dbPath));
if (NS_SUCCEEDED(rv))
{
// Create a new address book file - we don't care what the file
--- a/mailnews/import/src/nsImportEncodeScan.h
+++ b/mailnews/import/src/nsImportEncodeScan.h
@@ -21,17 +21,17 @@ public:
virtual bool Scan(bool *pDone);
protected:
void FillInEntries(int numEntries);
bool AddEntries(void);
protected:
bool m_isAppleSingle;
- nsCOMPtr<nsILocalFile> m_pInputFile;
+ nsCOMPtr<nsIFile> m_pInputFile;
nsCOMPtr<nsIInputStream> m_inputStream;
int m_encodeScanState;
long m_resourceForkSize;
long m_dataForkSize;
nsCString m_useFileName;
};
#endif /* nsImportEncodeScan_h__ */
--- a/mailnews/import/src/nsImportMail.cpp
+++ b/mailnews/import/src/nsImportMail.cpp
@@ -285,17 +285,17 @@ NS_IMETHODIMP nsImportGenericMail::SetDa
item->QueryInterface(NS_GET_IID(nsISupportsArray), (void **) &m_pMailboxes);
}
if (!PL_strcasecmp(dataId, "mailLocation")) {
NS_IF_RELEASE(m_pMailboxes);
m_pSrcLocation = nsnull;
if (item) {
nsresult rv;
- nsCOMPtr <nsILocalFile> location = do_QueryInterface(item, &rv);
+ nsCOMPtr <nsIFile> location = do_QueryInterface(item, &rv);
NS_ENSURE_SUCCESS(rv,rv);
m_pSrcLocation = location;
}
}
if (!PL_strcasecmp(dataId, "mailDestination")) {
NS_IF_RELEASE(m_pDestFolder);
if (item)
--- a/mailnews/import/src/nsImportMailboxDescriptor.h
+++ b/mailnews/import/src/nsImportMailboxDescriptor.h
@@ -4,17 +4,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsImportMailboxDescriptor_h___
#define nsImportMailboxDescriptor_h___
#include "nscore.h"
#include "nsStringGlue.h"
#include "nsIImportMailboxDescriptor.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsCOMPtr.h"
////////////////////////////////////////////////////////////////////////
class nsImportMailboxDescriptor : public nsIImportMailboxDescriptor
{
public:
@@ -34,29 +34,29 @@ public:
/* attribute wstring displayName; */
NS_IMETHOD GetDisplayName(PRUnichar **pName) { *pName = ToNewUnicode(m_displayName); return NS_OK;}
NS_IMETHOD SetDisplayName(const PRUnichar * pName) { m_displayName = pName; return NS_OK;}
/* attribute boolean import; */
NS_IMETHOD GetImport(bool *pImport) { *pImport = m_import; return NS_OK;}
NS_IMETHOD SetImport(bool doImport) { m_import = doImport; return NS_OK;}
- /* readonly attribute nsILocalFile file; */
- NS_IMETHOD GetFile(nsILocalFile * *aFile) { if (m_pFile) { NS_ADDREF(*aFile = m_pFile); return NS_OK;} else return NS_ERROR_FAILURE; }
+ /* readonly attribute nsIFile file; */
+ NS_IMETHOD GetFile(nsIFile * *aFile) { if (m_pFile) { NS_ADDREF(*aFile = m_pFile); return NS_OK;} else return NS_ERROR_FAILURE; }
nsImportMailboxDescriptor();
virtual ~nsImportMailboxDescriptor() {}
static NS_METHOD Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
private:
PRUint32 m_id; // used by creator of the structure
PRUint32 m_depth; // depth in the hierarchy
nsString m_displayName;// name of this mailbox
- nsCOMPtr <nsILocalFile> m_pFile; // source file (if applicable)
+ nsCOMPtr <nsIFile> m_pFile; // source file (if applicable)
PRUint32 m_size;
bool m_import; // import it or not?
};
#endif
--- a/mailnews/import/src/nsImportScanFile.cpp
+++ b/mailnews/import/src/nsImportScanFile.cpp
@@ -1,15 +1,15 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nscore.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsImportScanFile.h"
#include "ImportCharSet.h"
nsImportScanFile::nsImportScanFile()
{
m_allocated = false;
m_eof = false;
m_pBuf = nsnull;
--- a/mailnews/import/text/src/nsTextImport.cpp
+++ b/mailnews/import/text/src/nsTextImport.cpp
@@ -101,17 +101,17 @@ private:
PRUnichar **pSuccess);
static void ReportError(PRInt32 errorNum, nsString& name, nsString *pStream,
nsIStringBundle* pBundle);
static void SanitizeSampleData(nsCString& val);
private:
nsTextAddress m_text;
bool m_haveDelim;
- nsCOMPtr<nsILocalFile> m_fileLoc;
+ nsCOMPtr<nsIFile> m_fileLoc;
nsCOMPtr<nsIStringBundle> m_notProxyBundle;
char m_delim;
PRUint32 m_bytesImported;
};
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
--- a/mailnews/import/vcard/src/nsVCardImport.cpp
+++ b/mailnews/import/vcard/src/nsVCardImport.cpp
@@ -14,17 +14,17 @@
#include "nsIAddrDatabase.h"
#include "nsIFile.h"
#include "nsIImportABDescriptor.h"
#include "nsIImportAddressBooks.h"
#include "nsIImportFieldMap.h"
#include "nsIImportGeneric.h"
#include "nsCOMPtr.h"
#include "nsIImportService.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsImportStringBundle.h"
#include "nsMsgUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsTextFormatter.h"
#include "nsVCardAddress.h"
#include "nsVCardImport.h"
@@ -86,17 +86,17 @@ private:
nsString& success, nsString& error,
PRUnichar **pError, PRUnichar **pSuccess);
static void ReportError(
const char *errorName, nsString& name, nsString *pStream,
nsIStringBundle* pBundle);
private:
nsVCardAddress m_vCard;
- nsCOMPtr<nsILocalFile> m_fileLoc;
+ nsCOMPtr<nsIFile> m_fileLoc;
PRUint32 m_bytesImported;
nsCOMPtr<nsIStringBundle> m_notProxyBundle;
};
nsVCardImport::nsVCardImport()
{
if (!VCARDLOGMODULE)
VCARDLOGMODULE = PR_NewLogModule("IMPORT");
--- a/mailnews/import/winlivemail/nsWMSettings.cpp
+++ b/mailnews/import/winlivemail/nsWMSettings.cpp
@@ -26,39 +26,39 @@
#include "nsISmtpService.h"
#include "nsISmtpServer.h"
#include "nsWMStringBundle.h"
#include "WMDebugLog.h"
#include "nsIPop3IncomingServer.h"
#include "nsIImapIncomingServer.h"
#include "nsINntpIncomingServer.h"
#include "stdlib.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsISimpleEnumerator.h"
#include "nsIMutableArray.h"
#include "nsIDOMDocument.h"
#include "nsNetUtil.h"
#include "nsIDOMNodeList.h"
#include "nsIFileStreams.h"
#include "nsIDOMParser.h"
#include "nsIDOMElement.h"
#include "nsTArray.h"
#include <windows.h>
#include "nsIWindowsRegKey.h"
#include "nsCOMArray.h"
class WMSettings {
public:
static nsresult FindWMKey(nsIWindowsRegKey* akey);
- static bool getOEacctFiles(nsILocalFile* file, nsCOMArray<nsILocalFile>& fileArray);
+ static bool getOEacctFiles(nsIFile* file, nsCOMArray<nsIFile>& fileArray);
static nsresult GetValueForTag(nsIDOMDocument *xmlDoc,
const nsAString& tagName,
nsAString &value);
static nsresult MakeXMLdoc(nsIDOMDocument** xmlDoc,
- nsILocalFile* file);
+ nsIFile* file);
static bool DoImport(nsIMsgAccount **ppAccount);
static bool DoIMAPServer(nsIMsgAccountManager *pMgr,
nsIDOMDocument *xmlDoc,
const nsString& serverName,
nsIMsgAccount **ppAccount);
static bool DoPOP3Server(nsIMsgAccountManager *pMgr,
nsIDOMDocument *xmlDoc,
const nsString& serverName,
@@ -157,32 +157,32 @@ nsresult WMSettings::FindWMKey(nsIWindow
if (NS_SUCCEEDED(rv))
return rv;
rv = akey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
NS_LITERAL_STRING("Software\\Microsoft\\Windows Mail"),
nsIWindowsRegKey::ACCESS_QUERY_VALUE);
return rv;
}
-bool WMSettings::getOEacctFiles(nsILocalFile* file,
- nsCOMArray<nsILocalFile>& fileArray)
+bool WMSettings::getOEacctFiles(nsIFile* file,
+ nsCOMArray<nsIFile>& fileArray)
{
nsresult rv;
nsCOMPtr<nsISimpleEnumerator> entries;
rv = file->GetDirectoryEntries(getter_AddRefs(entries));
if (NS_FAILED(rv) || !entries)
return false;
bool hasMore;
while (NS_SUCCEEDED(entries->HasMoreElements(&hasMore)) && hasMore) {
nsCOMPtr<nsISupports> sup;
entries->GetNext(getter_AddRefs(sup));
if (!sup)
return false;
- nsCOMPtr<nsILocalFile> fileX = do_QueryInterface(sup);
+ nsCOMPtr<nsIFile> fileX = do_QueryInterface(sup);
if (!fileX)
return false;
nsString name;
if (NS_FAILED(fileX->GetLeafName(name)))
return false;
bool isDir;
if (NS_FAILED(fileX->IsDirectory(&isDir)))
return false;
@@ -207,17 +207,17 @@ nsresult WMSettings::GetValueForTag(nsID
nsCOMPtr<nsIDOMNode> domNode;
list->Item(0, getter_AddRefs(domNode));
if (!domNode)
return NS_ERROR_FAILURE;
return domNode->GetTextContent(value);
}
nsresult WMSettings::MakeXMLdoc(nsIDOMDocument** xmlDoc,
- nsILocalFile* file)
+ nsIFile* file)
{
nsresult rv;
nsCOMPtr<nsIFileInputStream> stream =
do_CreateInstance(NS_LOCALFILEINPUTSTREAM_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = stream->Init(file, PR_RDONLY, -1, 0);
nsCOMPtr<nsIDOMParser> parser = do_CreateInstance(NS_DOMPARSER_CONTRACTID);
@@ -266,19 +266,19 @@ bool WMSettings::DoImport(nsIMsgAccount
nsString storeRoot;
rv = key->ReadStringValue(NS_LITERAL_STRING("Store Root"), storeRoot);
key->Close(); // Finished with windows registry key. We do not want to return before this closing
if (NS_FAILED(rv) || storeRoot.IsEmpty()) {
IMPORT_LOG0("*** Error finding Windows Live Mail Store Root\n");
return false;
}
- nsCOMPtr<nsILocalFile> file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
+ nsCOMPtr<nsIFile> file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
if (!file) {
- IMPORT_LOG0("*** Failed to create an nsILocalFile!\n");
+ IMPORT_LOG0("*** Failed to create an nsIFile!\n");
return false;
}
nsCOMPtr<nsIMsgAccountManager> accMgr =
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
IMPORT_LOG0("*** Failed to create an account manager!\n");
return false;
}
@@ -292,17 +292,17 @@ bool WMSettings::DoImport(nsIMsgAccount
(LPWSTR)expandedStoreRoot.BeginWriting(),
size);
storeRoot = expandedStoreRoot;
if (NS_FAILED(file->InitWithPath(storeRoot))) {
IMPORT_LOG0("*** Failed get store root!\n");
return false;
}
- nsCOMArray<nsILocalFile> fileArray;
+ nsCOMArray<nsIFile> fileArray;
if (!getOEacctFiles(file, fileArray)) {
IMPORT_LOG0("*** Failed to get OEacctFiles!\n");
return false;
}
// Loop through *.oeaccounts files looking for POP3 & IMAP & NNTP accounts
// Ignore LDAP for now!
int accounts = 0;
--- a/mailnews/local/public/nsIMailboxService.idl
+++ b/mailnews/local/public/nsIMailboxService.idl
@@ -4,17 +4,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
#include "nsIUrlListener.idl"
interface nsIURI;
interface nsIStreamListener;
interface nsIMsgWindow;
-interface nsILocalFile;
+interface nsIFile;
[scriptable, uuid(809FCD02-B9EA-4DC0-84F0-3FBC55AE11F1)]
interface nsIMailboxService : nsISupports {
/*
* All of these functions build mailbox urls and run them. If you want a
* handle on the running task, pass in a valid nsIURI ptr. You can later
* interrupt this action by asking the netlib service manager to interrupt
@@ -22,13 +22,13 @@ interface nsIMailboxService : nsISupport
* with it. Pass nsnull in for aURL if you don't care about the returned URL.
*/
/*
* Pass in a file path for the mailbox you wish to parse. You also need to
* pass in a mailbox parser (the consumer). The url listener can be null
* if you have no interest in tracking the url.
*/
- nsIURI ParseMailbox(in nsIMsgWindow aMsgWindow, in nsILocalFile aMailboxPath,
+ nsIURI ParseMailbox(in nsIMsgWindow aMsgWindow, in nsIFile aMailboxPath,
in nsIStreamListener aMailboxParser,
in nsIUrlListener aUrlListener);
};
--- a/mailnews/local/public/nsINoIncomingServer.idl
+++ b/mailnews/local/public/nsINoIncomingServer.idl
@@ -1,15 +1,15 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
-interface nsILocalFile;
+interface nsIFile;
[scriptable, uuid(ba3071e9-39a5-4a10-b770-1809317ef2c1)]
interface nsINoIncomingServer : nsISupports {
/* copy (or prepend) bin/defaults/messenger/<folderNameOnDisk> to <parentDir>/<folderNameOnDisk> */
- void copyDefaultMessages(in string folderNameOnDisk, in nsILocalFile parentDir);
+ void copyDefaultMessages(in string folderNameOnDisk, in nsIFile parentDir);
};
--- a/mailnews/local/public/nsIRssIncomingServer.idl
+++ b/mailnews/local/public/nsIRssIncomingServer.idl
@@ -1,16 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
-interface nsILocalFile;
+interface nsIFile;
[scriptable, uuid(6d744e7f-2218-45c6-8734-998a56cb3c6d)]
interface nsIRssIncomingServer : nsISupports {
// Path to the subscriptions data source for this RSS server
- readonly attribute nsILocalFile subscriptionsDataSourcePath;
+ readonly attribute nsIFile subscriptionsDataSourcePath;
// Path to the feed items data source for this RSS server
- readonly attribute nsILocalFile feedItemsDataSourcePath;
+ readonly attribute nsIFile feedItemsDataSourcePath;
};
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -223,17 +223,17 @@ nsMsgLocalMailFolder::GetSubFolders(nsIS
nsCOMPtr<nsIMsgPluggableStore> msgStore;
// need to set this flag here to avoid infinite recursion
mInitialized = true;
rv = server->GetMsgStore(getter_AddRefs(msgStore));
NS_ENSURE_SUCCESS(rv, rv);
// This should add all existing folders as sub-folders of this folder.
rv = msgStore->DiscoverSubFolders(this, true);
- nsCOMPtr<nsILocalFile> path;
+ nsCOMPtr<nsIFile> path;
rv = GetFilePath(getter_AddRefs(path));
if (NS_FAILED(rv))
return rv;
bool exists, directory;
path->Exists(&exists);
if (!exists)
path->Create(nsIFile::DIRECTORY_TYPE, 0755);
@@ -318,17 +318,17 @@ NS_IMETHODIMP nsMsgLocalMailFolder::GetD
{
NS_ASSERTION(!mReparseListener, "can't have an existing listener");
mReparseListener = aReparseUrlListener;
return NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE;
}
if (!mDatabase)
{
- nsCOMPtr <nsILocalFile> pathFile;
+ nsCOMPtr <nsIFile> pathFile;
rv = GetFilePath(getter_AddRefs(pathFile));
if (NS_FAILED(rv))
return rv;
bool exists;
rv = pathFile->Exists(&exists);
NS_ENSURE_SUCCESS(rv,rv);
if (!exists)
@@ -366,17 +366,17 @@ NS_IMETHODIMP nsMsgLocalMailFolder::GetD
mBackupDatabase = nsnull;
}
}
else
mDatabase->ForceClosed();
mDatabase = nsnull;
}
- nsCOMPtr <nsILocalFile> summaryFile;
+ nsCOMPtr <nsIFile> summaryFile;
rv = GetSummaryFileLocation(pathFile, getter_AddRefs(summaryFile));
NS_ENSURE_SUCCESS(rv, rv);
// Remove summary file.
summaryFile->Remove(false);
// if it's out of date then reopen with upgrade.
rv = msgDBService->CreateNewDB(this, getter_AddRefs(mDatabase));
NS_ENSURE_SUCCESS(rv, rv);
@@ -474,17 +474,17 @@ nsMsgLocalMailFolder::GetMessages(nsISim
nsCOMPtr <nsIMsgDatabase> msgDB;
nsresult rv = GetDatabaseWOReparse(getter_AddRefs(msgDB));
return NS_SUCCEEDED(rv) ? msgDB->EnumerateMessages(result) : rv;
}
NS_IMETHODIMP nsMsgLocalMailFolder::GetFolderURL(nsACString& aUrl)
{
nsresult rv;
- nsCOMPtr<nsILocalFile> path;
+ nsCOMPtr<nsIFile> path;
rv = GetFilePath(getter_AddRefs(path));
if (NS_FAILED(rv))
return rv;
rv = NS_GetURLSpecFromFile(path, aUrl);
NS_ENSURE_SUCCESS(rv, rv);
aUrl.Replace(0, strlen("file:"), "mailbox:");
@@ -776,17 +776,17 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Dele
rv = GetServer(getter_AddRefs(server));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMsgPluggableStore> msgStore;
rv = server->GetMsgStore(getter_AddRefs(msgStore));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr <nsILocalFile> summaryFile;
+ nsCOMPtr <nsIFile> summaryFile;
rv = msgStore->GetSummaryFile(this, getter_AddRefs(summaryFile));
NS_ENSURE_SUCCESS(rv, rv);
//Clean up .sbd folder if it exists.
// Remove summary file.
summaryFile->Remove(false);
return msgStore->DeleteFolder(this);
@@ -1020,17 +1020,17 @@ NS_IMETHODIMP nsMsgLocalMailFolder::GetN
nsresult nsMsgLocalMailFolder::OpenDatabase()
{
nsresult rv;
nsCOMPtr<nsIMsgDBService> msgDBService = do_GetService(NS_MSGDB_SERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
bool folderEmpty = false;
- nsCOMPtr <nsILocalFile> file;
+ nsCOMPtr <nsIFile> file;
rv = GetFilePath(getter_AddRefs(file));
rv = msgDBService->OpenFolderDB(this, true, getter_AddRefs(mDatabase));
if (rv == NS_MSG_ERROR_FOLDER_SUMMARY_MISSING)
{
// check if we're a real folder by looking at the parent folder.
nsCOMPtr<nsIMsgFolder> parent;
GetParent(getter_AddRefs(parent));
@@ -1142,17 +1142,17 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Refr
}
NS_IMETHODIMP nsMsgLocalMailFolder::GetSizeOnDisk(PRUint32* aSize)
{
NS_ENSURE_ARG_POINTER(aSize);
nsresult rv = NS_OK;
if (!mFolderSize)
{
- nsCOMPtr <nsILocalFile> file;
+ nsCOMPtr <nsIFile> file;
rv = GetFilePath(getter_AddRefs(file));
NS_ENSURE_SUCCESS(rv, rv);
PRInt64 folderSize;
rv = file->GetFileSize(&folderSize);
NS_ENSURE_SUCCESS(rv, rv);
mFolderSize = (PRUint32) folderSize;
}
@@ -1290,17 +1290,17 @@ nsMsgLocalMailFolder::MarkMessagesFlagge
nsresult
nsMsgLocalMailFolder::InitCopyState(nsISupports* aSupport,
nsIArray* messages,
bool isMove,
nsIMsgCopyServiceListener* listener,
nsIMsgWindow *msgWindow, bool isFolder,
bool allowUndo)
{
- nsCOMPtr<nsILocalFile> path;
+ nsCOMPtr<nsIFile> path;
NS_ASSERTION(!mCopyState, "already copying a msg into this folder");
if (mCopyState)
return NS_ERROR_FAILURE; // already has a copy in progress
// get mDatabase set, so we can use it to add new hdrs to this db.
// calling GetDatabase will set mDatabase - we use the comptr
// here to avoid doubling the refcnt on mDatabase. We don't care if this
--- a/mailnews/local/src/nsLocalUtils.cpp
+++ b/mailnews/local/src/nsLocalUtils.cpp
@@ -139,17 +139,17 @@ nsLocalURI2Path(const char* rootURI, con
nsCOMPtr<nsIMsgIncomingServer> server;
rv = nsLocalURI2Server(uriStr, getter_AddRefs(server));
if (NS_FAILED(rv))
return rv;
// now ask the server what it's root is
// and begin pathResult with the mailbox root
- nsCOMPtr<nsILocalFile> localPath;
+ nsCOMPtr<nsIFile> localPath;
rv = server->GetLocalPath(getter_AddRefs(localPath));
NS_ENSURE_SUCCESS(rv, rv);
nsCString localNativePath;
localPath->GetNativePath(localNativePath);
nsEscapeNativePath(localNativePath);
pathResult = localNativePath.get();
--- a/mailnews/local/src/nsMailboxService.cpp
+++ b/mailnews/local/src/nsMailboxService.cpp
@@ -32,17 +32,17 @@ nsMailboxService::nsMailboxService()
mPrintingOperation = false;
}
nsMailboxService::~nsMailboxService()
{}
NS_IMPL_ISUPPORTS4(nsMailboxService, nsIMailboxService, nsIMsgMessageService, nsIProtocolHandler, nsIMsgMessageFetchPartService)
-nsresult nsMailboxService::ParseMailbox(nsIMsgWindow *aMsgWindow, nsILocalFile *aMailboxPath, nsIStreamListener *aMailboxParser,
+nsresult nsMailboxService::ParseMailbox(nsIMsgWindow *aMsgWindow, nsIFile *aMailboxPath, nsIStreamListener *aMailboxParser,
nsIUrlListener * aUrlListener, nsIURI ** aURL)
{
NS_ENSURE_ARG_POINTER(aMailboxPath);
nsresult rv;
nsCOMPtr<nsIMailboxUrl> mailboxurl =
do_CreateInstance(NS_MAILBOXURL_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv) && mailboxurl)
--- a/mailnews/local/src/nsMailboxUrl.h
+++ b/mailnews/local/src/nsMailboxUrl.h
@@ -54,17 +54,17 @@ protected:
virtual nsresult ParseUrl();
nsresult GetMsgHdrForKey(nsMsgKey msgKey, nsIMsgDBHdr ** aMsgHdr);
// mailboxurl specific state
nsCOMPtr<nsIStreamListener> m_mailboxParser;
nsCOMPtr<nsIStreamListener> m_mailboxCopyHandler;
nsMailboxAction m_mailboxAction; // the action this url represents...parse mailbox, display messages, etc.
- nsCOMPtr <nsILocalFile> m_filePath;
+ nsCOMPtr <nsIFile> m_filePath;
char *m_messageID;
PRUint32 m_messageSize;
nsMsgKey m_messageKey;
nsCString m_file;
// This is currently only set when we're doing something with a .eml file.
// If that changes, we should change the name of this var.
nsCOMPtr<nsIMsgDBHdr> m_dummyHdr;
--- a/mailnews/local/src/nsMovemailService.cpp
+++ b/mailnews/local/src/nsMovemailService.cpp
@@ -19,17 +19,17 @@
#include "nsIMovemailService.h"
#include "nsIMsgIncomingServer.h"
#include "nsIMovemailIncomingServer.h"
#include "nsIMsgProtocolInfo.h"
#include "nsParseMailbox.h"
#include "nsIMsgFolder.h"
#include "nsIPrompt.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsMailDirServiceDefs.h"
#include "nsMsgUtils.h"
#include "nsMsgLocalCID.h"
#include "nsMsgBaseCID.h"
#include "nsCOMPtr.h"
#include "nsMsgFolderFlags.h"
@@ -137,17 +137,17 @@ bool ObtainSpoolLock(const char *aSpoolN
* Locking procedures:
* If the directory is not writable, we want to use the appropriate system
* utilites to lock the file.
* If the directory is writable, we want to go through the create-and-link
* locking procedures to make it atomic for certain networked file systems.
* This involves creating a .mozlock file and attempting to hard-link it to
* the customary .lock file.
*/
- nsCOMPtr<nsILocalFile> spoolFile;
+ nsCOMPtr<nsIFile> spoolFile;
nsresult rv = NS_NewNativeLocalFile(nsDependentCString(aSpoolName),
true,
getter_AddRefs(spoolFile));
NS_ENSURE_SUCCESS(rv, false);
nsCOMPtr<nsIFile> directory;
rv = spoolFile->GetParent(getter_AddRefs(directory));
NS_ENSURE_SUCCESS(rv, false);
@@ -191,18 +191,18 @@ bool ObtainSpoolLock(const char *aSpoolN
// (step 2a not yet implemented)
nsCAutoString mozlockstr(aSpoolName);
mozlockstr.Append(".mozlock");
nsCAutoString lockstr(aSpoolName);
lockstr.Append(".lock");
- // Create nsILocalFile for the spool.mozlock file
- nsCOMPtr<nsILocalFile> tmplocfile;
+ // Create nsIFile for the spool.mozlock file
+ nsCOMPtr<nsIFile> tmplocfile;
rv = NS_NewNativeLocalFile(mozlockstr, true, getter_AddRefs(tmplocfile));
if (NS_FAILED(rv))
return false;
// THOUGHT: hmm, perhaps use MakeUnique to generate us a unique mozlock?
// ... perhaps not, MakeUnique implementation looks racey -- use mktemp()?
// step 1: create SPOOLNAME.mozlock
rv = tmplocfile->Create(nsIFile::NORMAL_FILE_TYPE, 0666);
@@ -248,17 +248,17 @@ bool ObtainSpoolLock(const char *aSpoolN
// Remove our mail-spool-file lock (n.b. we should only try this if
// we're the ones who made the lock in the first place!)
bool YieldSpoolLock(const char *aSpoolName, bool aUsingLockFile)
{
LOG(("YieldSpoolLock(%s)", aSpoolName));
if (!aUsingLockFile) {
- nsCOMPtr<nsILocalFile> spoolFile;
+ nsCOMPtr<nsIFile> spoolFile;
nsresult rv = NS_NewNativeLocalFile(nsDependentCString(aSpoolName),
true,
getter_AddRefs(spoolFile));
NS_ENSURE_SUCCESS(rv, false);
PRFileDesc *fd;
rv = spoolFile->OpenNSPRFileDesc(PR_RDWR, 0, &fd);
NS_ENSURE_SUCCESS(rv, false);
@@ -270,18 +270,18 @@ bool YieldSpoolLock(const char *aSpoolNa
return unlockSucceeded;
}
nsCAutoString lockstr(aSpoolName);
lockstr.Append(".lock");
nsresult rv;
- // Create nsILocalFile for the spool.lock file
- nsCOMPtr<nsILocalFile> locklocfile;
+ // Create nsIFile for the spool.lock file
+ nsCOMPtr<nsIFile> locklocfile;
rv = NS_NewNativeLocalFile(lockstr, true, getter_AddRefs(locklocfile));
if (NS_FAILED(rv))
return false;
// Check if the lock file exists
bool exists;
rv = locklocfile->Exists(&exists);
if (NS_FAILED(rv))
@@ -301,17 +301,17 @@ bool YieldSpoolLock(const char *aSpoolNa
}
static nsresult
LocateSpoolFile(nsACString & spoolPath)
{
bool isFile;
nsresult rv;
- nsCOMPtr<nsILocalFile> spoolFile;
+ nsCOMPtr<nsIFile> spoolFile;
rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(spoolFile));
NS_ENSURE_SUCCESS(rv, rv);
char * mailEnv = PR_GetEnv("MAIL");
char * userEnv = PR_GetEnv("USER");
if (!userEnv)
userEnv = PR_GetEnv("USERNAME");
@@ -365,17 +365,17 @@ nsMovemailService::GetNewMail(nsIMsgWind
if (spoolPath.IsEmpty())
rv = LocateSpoolFile(spoolPath);
if (NS_FAILED(rv) || spoolPath.IsEmpty()) {
Error(MOVEMAIL_SPOOL_FILE_NOT_FOUND, nsnull, 0);
return NS_ERROR_FAILURE;
}
// Create an input stream for the spool file
- nsCOMPtr<nsILocalFile> spoolFile;
+ nsCOMPtr<nsIFile> spoolFile;
rv = NS_NewNativeLocalFile(spoolPath, true, getter_AddRefs(spoolFile));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIInputStream> spoolInputStream;
rv = NS_NewLocalFileInputStream(getter_AddRefs(spoolInputStream), spoolFile);
if (NS_FAILED(rv)) {
const PRUnichar *params[] = {
NS_ConvertUTF8toUTF16(spoolPath).get()
};
@@ -503,31 +503,31 @@ nsMovemailService::GetNewMail(nsIMsgWind
in_server->SetServerBusy(false);
LOG(("GetNewMail returning rv=%d", rv));
return rv;
}
NS_IMETHODIMP
-nsMovemailService::SetDefaultLocalPath(nsILocalFile *aPath)
+nsMovemailService::SetDefaultLocalPath(nsIFile *aPath)
{
NS_ENSURE_ARG(aPath);
return NS_SetPersistentFile(PREF_MAIL_ROOT_MOVEMAIL_REL, PREF_MAIL_ROOT_MOVEMAIL, aPath);
}
NS_IMETHODIMP
-nsMovemailService::GetDefaultLocalPath(nsILocalFile ** aResult)
+nsMovemailService::GetDefaultLocalPath(nsIFile ** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = nsnull;
nsresult rv;
bool havePref;
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
rv = NS_GetPersistentFile(PREF_MAIL_ROOT_MOVEMAIL_REL,
PREF_MAIL_ROOT_MOVEMAIL,
NS_APP_MAIL_50_DIR,
havePref,
getter_AddRefs(localFile));
if (NS_FAILED(rv)) return rv;
bool exists;
--- a/mailnews/local/src/nsMsgBrkMBoxStore.cpp
+++ b/mailnews/local/src/nsMsgBrkMBoxStore.cpp
@@ -50,17 +50,17 @@ NS_IMPL_ISUPPORTS1(nsMsgBrkMBoxStore, ns
NS_IMETHODIMP nsMsgBrkMBoxStore::DiscoverSubFolders(nsIMsgFolder *aParentFolder,
bool aDeep)
{
NS_ENSURE_ARG_POINTER(aParentFolder);
bool isServer;
nsresult rv = aParentFolder->GetIsServer(&isServer);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> path;
+ nsCOMPtr<nsIFile> path;
rv = aParentFolder->GetFilePath(getter_AddRefs(path));
if (NS_FAILED(rv))
return rv;
bool exists, directory;
path->Exists(&exists);
if (!exists)
path->Create(nsIFile::DIRECTORY_TYPE, 0755);
@@ -114,17 +114,17 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::Discove
}
return rv;
}
NS_IMETHODIMP nsMsgBrkMBoxStore::CreateFolder(nsIMsgFolder *aParent,
const nsAString &aFolderName,
nsIMsgFolder **aResult)
{
- nsCOMPtr<nsILocalFile> path;
+ nsCOMPtr<nsIFile> path;
nsCOMPtr<nsIMsgFolder> child;
nsresult rv = aParent->GetFilePath(getter_AddRefs(path));
if (NS_FAILED(rv))
return rv;
//Get a directory based on our current path.
rv = CreateDirectoryForFolder(path);
if (NS_FAILED(rv))
return rv;
@@ -179,23 +179,23 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::CreateF
rv = NS_MSG_CANT_CREATE_FOLDER;
}
}
child.forget(aResult);
return rv;
}
NS_IMETHODIMP nsMsgBrkMBoxStore::GetSummaryFile(nsIMsgFolder *aFolder,
- nsILocalFile **aSummaryFile)
+ nsIFile **aSummaryFile)
{
NS_ENSURE_ARG_POINTER(aFolder);
NS_ENSURE_ARG_POINTER(aSummaryFile);
nsresult rv;
- nsCOMPtr<nsILocalFile> newSummaryLocation;
+ nsCOMPtr<nsIFile> newSummaryLocation;
rv = aFolder->GetFilePath(getter_AddRefs(newSummaryLocation));
NS_ENSURE_SUCCESS(rv, rv);
nsString fileName;
rv = newSummaryLocation->GetLeafName(fileName);
if (NS_FAILED(rv))
return rv;
@@ -210,17 +210,17 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::GetSumm
// Get the current attributes of the mbox file, corrected for caching
void nsMsgBrkMBoxStore::GetMailboxModProperties(nsIMsgFolder *aFolder,
PRInt64 *aSize, PRUint32 *aDate)
{
// We'll simply return 0 on errors.
*aDate = 0;
*aSize = 0;
- nsCOMPtr<nsILocalFile> pathFile;
+ nsCOMPtr<nsIFile> pathFile;
nsresult rv = aFolder->GetFilePath(getter_AddRefs(pathFile));
NS_ENSURE_SUCCESS(rv, );
rv = pathFile->GetFileSize(aSize);
if (NS_FAILED(rv))
return;
PRInt64 lastModTime;
@@ -232,17 +232,17 @@ void nsMsgBrkMBoxStore::GetMailboxModPro
}
NS_IMETHODIMP nsMsgBrkMBoxStore::HasSpaceAvailable(nsIMsgFolder *aFolder,
PRInt64 aSpaceRequested,
bool *aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
NS_ENSURE_ARG_POINTER(aFolder);
- nsCOMPtr<nsILocalFile> pathFile;
+ nsCOMPtr<nsIFile> pathFile;
nsresult rv = aFolder->GetFilePath(getter_AddRefs(pathFile));
NS_ENSURE_SUCCESS(rv, rv);
PRInt64 fileSize;
rv = pathFile->GetFileSize(&fileSize);
NS_ENSURE_SUCCESS(rv, rv);
// ### I think we're allowing mailboxes > 4GB, so we should be checking
// for disk space here, not total file size.
// 0xFFC00000 = 4 GiB - 4 MiB.
@@ -263,17 +263,17 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::IsSumma
// We only check local folders for db validity.
nsCOMPtr<nsIMsgLocalMailFolder> localFolder(do_QueryInterface(aFolder));
if (!localFolder)
{
*aResult = true;
return NS_OK;
}
- nsCOMPtr<nsILocalFile> pathFile;
+ nsCOMPtr<nsIFile> pathFile;
nsresult rv = aFolder->GetFilePath(getter_AddRefs(pathFile));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDBFolderInfo> folderInfo;
rv = aDB->GetDBFolderInfo(getter_AddRefs(folderInfo));
NS_ENSURE_SUCCESS(rv, rv);
PRUint64 folderSize;
PRUint32 folderDate;
PRInt32 numUnreadMessages;
@@ -319,17 +319,17 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::SetSumm
{
NS_ENSURE_ARG_POINTER(aFolder);
NS_ENSURE_ARG_POINTER(aDB);
// We only need to do this for local folders.
nsCOMPtr<nsIMsgLocalMailFolder> localFolder(do_QueryInterface(aFolder));
if (!localFolder)
return NS_OK;
- nsCOMPtr<nsILocalFile> pathFile;
+ nsCOMPtr<nsIFile> pathFile;
nsresult rv = aFolder->GetFilePath(getter_AddRefs(pathFile));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDBFolderInfo> folderInfo;
rv = aDB->GetDBFolderInfo(getter_AddRefs(folderInfo));
NS_ENSURE_SUCCESS(rv, rv);
bool exists;
pathFile->Exists(&exists);
if (!exists)
@@ -350,17 +350,17 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::SetSumm
aDB->Commit(nsMsgDBCommitType::kLargeCommit);
return rv;
}
NS_IMETHODIMP nsMsgBrkMBoxStore::DeleteFolder(nsIMsgFolder *aFolder)
{
NS_ENSURE_ARG_POINTER(aFolder);
//Delete mailbox
- nsCOMPtr<nsILocalFile> pathFile;
+ nsCOMPtr<nsIFile> pathFile;
nsresult rv = aFolder->GetFilePath(getter_AddRefs(pathFile));
NS_ENSURE_SUCCESS(rv, rv);
pathFile->Remove(false);
bool isDirectory = false;
pathFile->IsDirectory(&isDirectory);
if (!isDirectory)
@@ -383,49 +383,48 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::RenameF
NS_ENSURE_ARG_POINTER(aFolder);
NS_ENSURE_ARG_POINTER(aNewFolder);
PRUint32 numChildren;
aFolder->GetNumSubFolders(&numChildren);
nsString existingName;
aFolder->GetName(existingName);
- nsCOMPtr<nsILocalFile> oldPathFile;
+ nsCOMPtr<nsIFile> oldPathFile;
nsresult rv = aFolder->GetFilePath(getter_AddRefs(oldPathFile));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIMsgFolder> parentFolder;
rv = aFolder->GetParent(getter_AddRefs(parentFolder));
if (!parentFolder)
return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsISupports> parentSupport = do_QueryInterface(parentFolder);
- nsCOMPtr<nsILocalFile> oldSummaryFile;
+ nsCOMPtr<nsIFile> oldSummaryFile;
rv = GetSummaryFile(aFolder, getter_AddRefs(oldSummaryFile));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIFile> dirFile;
oldPathFile->Clone(getter_AddRefs(dirFile));
- nsCOMPtr<nsILocalFile> localDirFile(do_QueryInterface(dirFile));
if (numChildren > 0)
{
- rv = CreateDirectoryForFolder(localDirFile);
+ rv = CreateDirectoryForFolder(dirFile);
NS_ENSURE_SUCCESS(rv, rv);
}
nsAutoString safeName(aNewName);
NS_MsgHashIfNecessary(safeName);
nsCAutoString oldLeafName;
oldPathFile->GetNativeLeafName(oldLeafName);
- nsCOMPtr<nsILocalFile> parentPathFile;
+ nsCOMPtr<nsIFile> parentPathFile;
parentFolder->GetFilePath(getter_AddRefs(parentPathFile));
NS_ENSURE_SUCCESS(rv,rv);
bool isDirectory = false;
parentPathFile->IsDirectory(&isDirectory);
if (!isDirectory)
{
nsAutoString leafName;
@@ -445,17 +444,17 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::RenameF
dbName += NS_LITERAL_STRING(SUMMARY_SUFFIX);
oldSummaryFile->MoveTo(nsnull, dbName);
if (numChildren > 0)
{
// rename "*.sbd" directory
nsAutoString newNameDirStr(safeName);
newNameDirStr += NS_LITERAL_STRING(".sbd");
- localDirFile->MoveTo(nsnull, newNameDirStr);
+ dirFile->MoveTo(nsnull, newNameDirStr);
}
return parentFolder->AddSubfolder(safeName, aNewFolder);
}
NS_IMETHODIMP nsMsgBrkMBoxStore::CopyFolder(nsIMsgFolder *aSrcFolder,
nsIMsgFolder *aDstFolder,
bool aIsMoveFolder,
@@ -471,24 +470,24 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::CopyFol
nsCOMPtr<nsIMsgLocalMailFolder> localSrcFolder(do_QueryInterface(aSrcFolder));
nsCOMPtr<nsIMsgDatabase> srcDB;
if (localSrcFolder)
localSrcFolder->GetDatabaseWOReparse(getter_AddRefs(srcDB));
bool summaryValid = !!srcDB;
srcDB = nsnull;
aSrcFolder->ForceDBClosed();
- nsCOMPtr<nsILocalFile> oldPath;
+ nsCOMPtr<nsIFile> oldPath;
nsresult rv = aSrcFolder->GetFilePath(getter_AddRefs(oldPath));
NS_ENSURE_SUCCESS(rv,rv);
- nsCOMPtr<nsILocalFile> summaryFile;
+ nsCOMPtr<nsIFile> summaryFile;
GetSummaryFileLocation(oldPath, getter_AddRefs(summaryFile));
- nsCOMPtr<nsILocalFile> newPath;
+ nsCOMPtr<nsIFile> newPath;
rv = aDstFolder->GetFilePath(getter_AddRefs(newPath));
NS_ENSURE_SUCCESS(rv,rv);
bool newPathIsDirectory = false;
newPath->IsDirectory(&newPathIsDirectory);
if (!newPathIsDirectory)
{
AddDirectorySeparator(newPath);
@@ -606,17 +605,17 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::CopyFol
{
// The files have already been moved, so delete storage false
msgParent->PropagateDelete(aSrcFolder, false, aMsgWindow);
oldPath->Remove(false); //berkeley mailbox
// We need to force closed the source db
nsCOMPtr<nsIMsgDatabase> srcDB;
aSrcFolder->Delete();
- nsCOMPtr<nsILocalFile> parentPath;
+ nsCOMPtr<nsIFile> parentPath;
rv = msgParent->GetFilePath(getter_AddRefs(parentPath));
NS_ENSURE_SUCCESS(rv,rv);
AddDirectorySeparator(parentPath);
nsCOMPtr<nsISimpleEnumerator> children;
parentPath->GetDirectoryEntries(getter_AddRefs(children));
bool more;
// checks if the directory is empty or not
@@ -661,17 +660,17 @@ nsMsgBrkMBoxStore::GetNewMsgOutputStream
NS_ENSURE_ARG_POINTER(aReusable);
NS_ENSURE_ARG_POINTER(aResult);
#ifdef _DEBUG
NS_ASSERTION(m_streamOutstandingFolder != aFolder, "didn't finish prev msg");
m_streamOutstandingFolder = aFolder;
#endif
*aReusable = true;
- nsCOMPtr<nsILocalFile> mboxFile;
+ nsCOMPtr<nsIFile> mboxFile;
aFolder->GetFilePath(getter_AddRefs(mboxFile));
nsCOMPtr<nsIMsgDatabase> db;
aFolder->GetMsgDatabase(getter_AddRefs(db));
if (!db && !*aNewMsgHdr)
NS_WARNING("no db, and no message header");
bool exists;
mboxFile->Exists(&exists);
if (!exists)
@@ -730,17 +729,17 @@ nsMsgBrkMBoxStore::DiscardNewMessage(nsI
NS_ENSURE_ARG_POINTER(aOutputStream);
NS_ENSURE_ARG_POINTER(aNewHdr);
#ifdef _DEBUG
m_streamOutstandingFolder = nsnull;
#endif
PRUint64 hdrOffset;
aNewHdr->GetMessageOffset(&hdrOffset);
aOutputStream->Close();
- nsCOMPtr<nsILocalFile> mboxFile;
+ nsCOMPtr<nsIFile> mboxFile;
nsCOMPtr<nsIMsgFolder> folder;
nsresult rv = aNewHdr->GetFolder(getter_AddRefs(folder));
NS_ENSURE_SUCCESS(rv, rv);
folder->GetFilePath(getter_AddRefs(mboxFile));
return mboxFile->SetFileSize(hdrOffset);
}
NS_IMETHODIMP
@@ -789,17 +788,17 @@ nsMsgBrkMBoxStore::GetMsgInputStream(nsI
char storeToken[100];
PR_snprintf(storeToken, sizeof(storeToken), "%lld", *aOffset);
aMsgHdr->SetStringProperty("storeToken", storeToken);
}
else
*aOffset = ParseUint64Str(PromiseFlatCString(aMsgToken).get());
*aReusable = true;
nsCString URI;
- nsCOMPtr<nsILocalFile> mboxFile;
+ nsCOMPtr<nsIFile> mboxFile;
aMsgFolder->GetURI(URI);
aMsgFolder->GetFilePath(getter_AddRefs(mboxFile));
return NS_NewLocalFileInputStream(aResult, mboxFile);
}
NS_IMETHODIMP nsMsgBrkMBoxStore::DeleteMessages(nsIArray *aHdrArray)
{
@@ -849,17 +848,17 @@ NS_IMETHODIMP nsMsgBrkMBoxStore::Compact
NS_IMETHODIMP nsMsgBrkMBoxStore::RebuildIndex(nsIMsgFolder *aFolder,
nsIMsgDatabase *aMsgDB,
nsIMsgWindow *aMsgWindow,
nsIUrlListener *aListener)
{
NS_ENSURE_ARG_POINTER(aFolder);
// We don't use aMsgDB, but I think nsMsgMailDirStore needs it.
- nsCOMPtr<nsILocalFile> pathFile;
+ nsCOMPtr<nsIFile> pathFile;
nsresult rv = aFolder->GetFilePath(getter_AddRefs(pathFile));
if (NS_FAILED(rv))
return rv;
bool isLocked;
aFolder->GetLocked(&isLocked);
if (isLocked)
{
@@ -900,17 +899,17 @@ nsMsgBrkMBoxStore::GetOutputStream(nsIAr
seekableStream = do_QueryInterface(outputStream);
rv = seekableStream->Tell(&restorePos);
if (NS_FAILED(rv))
{
outputStream = nsnull;
m_outputStreams.Remove(URI);
}
}
- nsCOMPtr<nsILocalFile> mboxFile;
+ nsCOMPtr<nsIFile> mboxFile;
folder->GetFilePath(getter_AddRefs(mboxFile));
if (!outputStream)
{
rv = MsgGetFileStream(mboxFile, getter_AddRefs(outputStream));
seekableStream = do_QueryInterface(outputStream);
if (NS_SUCCEEDED(rv))
m_outputStreams.Put(URI, outputStream);
}
@@ -1091,30 +1090,30 @@ nsMsgBrkMBoxStore::AddSubFolders(nsIMsgF
if (child)
{
nsString folderName;
child->GetName(folderName); // try to get it from cache/db
if (folderName.IsEmpty())
child->SetPrettyName(leafName);
if (deep)
{
- nsCOMPtr<nsILocalFile> path;
+ nsCOMPtr<nsIFile> path;
rv = child->GetFilePath(getter_AddRefs(path));
AddSubFolders(child, path, true);
}
}
}
return rv == NS_MSG_FOLDER_EXISTS ? NS_OK : rv;
}
/* Finds the directory associated with this folder. That is if the path is
c:\Inbox, it will return c:\Inbox.sbd if it succeeds. If that path doesn't
currently exist then it will create it. Path is strictly an out parameter.
*/
-nsresult nsMsgBrkMBoxStore::CreateDirectoryForFolder(nsILocalFile *path)
+nsresult nsMsgBrkMBoxStore::CreateDirectoryForFolder(nsIFile *path)
{
nsresult rv = NS_OK;
bool pathIsDirectory = false;
path->IsDirectory(&pathIsDirectory);
if (!pathIsDirectory)
{
// If the current path isn't a directory, add directory separator
--- a/mailnews/local/src/nsMsgBrkMBoxStore.h
+++ b/mailnews/local/src/nsMsgBrkMBoxStore.h
@@ -6,34 +6,34 @@
/**
Class for handling Berkeley Mailbox stores.
*/
#ifndef nsMsgBrkMboxStore_h__
#define nsMsgBrkMboxStore_h__
#include "nsMsgLocalStoreUtils.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsInterfaceHashtable.h"
#include "nsISeekableStream.h"
class nsMsgBrkMBoxStore : public nsMsgLocalStoreUtils, nsIMsgPluggableStore
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMSGPLUGGABLESTORE
nsMsgBrkMBoxStore();
private:
~nsMsgBrkMBoxStore();
protected:
nsresult AddSubFolders(nsIMsgFolder *parent, nsIFile *path, bool deep);
- nsresult CreateDirectoryForFolder(nsILocalFile *path);
+ nsresult CreateDirectoryForFolder(nsIFile *path);
nsresult GetOutputStream(nsIArray *aHdrArray,
nsCOMPtr<nsIOutputStream> &outputStream,
nsCOMPtr<nsISeekableStream> &seekableStream,
PRInt64 &restorePos);
void GetMailboxModProperties(nsIMsgFolder *aFolder,
PRInt64 *aSize, PRUint32 *aDate);
void SetDBValid(nsIMsgDBHdr *aHdr);
// We don't want to keep re-opening an output stream when downloading
--- a/mailnews/local/src/nsMsgLocalStoreUtils.cpp
+++ b/mailnews/local/src/nsMsgLocalStoreUtils.cpp
@@ -1,24 +1,24 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "msgCore.h" // precompiled header...
#include "nsMsgLocalStoreUtils.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "prprf.h"
nsMsgLocalStoreUtils::nsMsgLocalStoreUtils()
{
}
nsresult
-nsMsgLocalStoreUtils::AddDirectorySeparator(nsILocalFile *path)
+nsMsgLocalStoreUtils::AddDirectorySeparator(nsIFile *path)
{
nsAutoString leafName;
path->GetLeafName(leafName);
leafName.AppendLiteral(FOLDER_SUFFIX);
return path->SetLeafName(leafName);
}
bool
--- a/mailnews/local/src/nsMsgLocalStoreUtils.h
+++ b/mailnews/local/src/nsMsgLocalStoreUtils.h
@@ -22,17 +22,17 @@
* and MailDir stores inherit from this class to share some code.
*/
class nsMsgLocalStoreUtils
{
public:
nsMsgLocalStoreUtils();
- static nsresult AddDirectorySeparator(nsILocalFile *path);
+ static nsresult AddDirectorySeparator(nsIFile *path);
static bool nsShouldIgnoreFile(nsAString& name);
static void ChangeKeywordsHelper(nsIMsgDBHdr *message,
PRUint64 desiredOffset,
nsLineBuffer<char> *lineBuffer,
nsTArray<nsCString> &keywordArray,
bool aAdd,
nsIOutputStream *outputStream,
nsISeekableStream *seekableStream,
--- a/mailnews/local/src/nsMsgMaildirStore.cpp
+++ b/mailnews/local/src/nsMsgMaildirStore.cpp
@@ -93,17 +93,17 @@ nsresult nsMsgMaildirStore::AddSubFolder
if (child)
{
nsString folderName;
child->GetName(folderName); // try to get it from cache/db
if (folderName.IsEmpty())
child->SetPrettyName(leafName);
if (deep)
{
- nsCOMPtr<nsILocalFile> path;
+ nsCOMPtr<nsIFile> path;
rv = child->GetFilePath(getter_AddRefs(path));
NS_ENSURE_SUCCESS(rv, rv);
// Construct the .sbd directory path for the possible children of the
// folder.
GetDirectoryForFolder(path);
bool directory = false;
// Check that <folder>.sbd really is a directory.
@@ -116,17 +116,17 @@ nsresult nsMsgMaildirStore::AddSubFolder
return rv == NS_MSG_FOLDER_EXISTS ? NS_OK : rv;
}
NS_IMETHODIMP nsMsgMaildirStore::DiscoverSubFolders(nsIMsgFolder *aParentFolder,
bool aDeep)
{
NS_ENSURE_ARG_POINTER(aParentFolder);
- nsCOMPtr<nsILocalFile> path;
+ nsCOMPtr<nsIFile> path;
nsresult rv = aParentFolder->GetFilePath(getter_AddRefs(path));
NS_ENSURE_SUCCESS(rv, rv);
bool isServer, directory = false;
aParentFolder->GetIsServer(&isServer);
if (!isServer)
GetDirectoryForFolder(path);
@@ -167,23 +167,23 @@ NS_IMETHODIMP nsMsgMaildirStore::Discove
/**
*Create a Maildir-style folder with "tmp", " and "cur" subfolders
* but no "new" subfolder, because it's not sensical in the mail client context.
("new" directory is for messages on the server that haven't been seen by a
* mail client).
* aFolderName is already "safe" - it has been through NS_MsgHashIfNecessary
*/
-nsresult nsMsgMaildirStore::CreateMaildir(nsILocalFile *path)
+nsresult nsMsgMaildirStore::CreateMaildir(nsIFile *path)
{
nsresult rv = path->Create(nsIFile::DIRECTORY_TYPE, 0700);
NS_ENSURE_SUCCESS(rv, rv);
// Create tmp, new, cur leaves
- nsCOMPtr<nsILocalFile> leaf(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
+ nsCOMPtr<nsIFile> leaf(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
leaf->InitWithFile(path);
leaf->AppendNative(NS_LITERAL_CSTRING("tmp"));
rv = leaf->Create(nsIFile::DIRECTORY_TYPE, 0700);
NS_ENSURE_SUCCESS(rv, rv);
@@ -193,17 +193,17 @@ nsresult nsMsgMaildirStore::CreateMaildi
return NS_OK;
}
NS_IMETHODIMP nsMsgMaildirStore::CreateFolder(nsIMsgFolder *aParent,
const nsAString &aFolderName,
nsIMsgFolder **aResult)
{
- nsCOMPtr <nsILocalFile> path;
+ nsCOMPtr <nsIFile> path;
nsresult rv = aParent->GetFilePath(getter_AddRefs(path));
NS_ENSURE_SUCCESS(rv, rv);
// Get a directory based on our current path
bool isServer;
aParent->GetIsServer(&isServer);
rv = CreateDirectoryForFolder(path, isServer);
NS_ENSURE_SUCCESS(rv, rv);
@@ -282,17 +282,17 @@ NS_IMETHODIMP nsMsgMaildirStore::IsSumma
NS_ENSURE_ARG_POINTER(aResult);
*aResult = true;
nsCOMPtr<nsIDBFolderInfo> dbFolderInfo;
aDB->GetDBFolderInfo(getter_AddRefs(dbFolderInfo));
nsresult rv = dbFolderInfo->GetBooleanProperty("maildirValid", false,
aResult);
if (!*aResult)
{
- nsCOMPtr<nsILocalFile> newFile;
+ nsCOMPtr<nsIFile> newFile;
rv = aFolder->GetFilePath(getter_AddRefs(newFile));
NS_ENSURE_SUCCESS(rv, rv);
newFile->Append(NS_LITERAL_STRING("cur"));
// If the "cur" sub-dir doesn't exist, and there are no messages
// in the db, then the folder is probably new and the db is valid.
bool exists;
newFile->Exists(&exists);
@@ -314,27 +314,27 @@ NS_IMETHODIMP nsMsgMaildirStore::SetSumm
NS_ENSURE_ARG_POINTER(aFolder);
NS_ENSURE_ARG_POINTER(aDB);
nsCOMPtr<nsIDBFolderInfo> dbFolderInfo;
aDB->GetDBFolderInfo(getter_AddRefs(dbFolderInfo));
return dbFolderInfo->SetBooleanProperty("maildirValid", aValid);
}
NS_IMETHODIMP nsMsgMaildirStore::GetSummaryFile(nsIMsgFolder *aFolder,
- nsILocalFile **aSummaryFile)
+ nsIFile **aSummaryFile)
{
NS_ENSURE_ARG_POINTER(aFolder);
NS_ENSURE_ARG_POINTER(aSummaryFile);
nsresult rv;
- nsCOMPtr <nsILocalFile> newSummaryLocation =
+ nsCOMPtr <nsIFile> newSummaryLocation =
do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> pathFile;
+ nsCOMPtr<nsIFile> pathFile;
rv = aFolder->GetFilePath(getter_AddRefs(pathFile));
NS_ENSURE_SUCCESS(rv, rv);
newSummaryLocation->InitWithFile(pathFile);
nsString fileName;
rv = newSummaryLocation->GetLeafName(fileName);
if (NS_FAILED(rv))
@@ -347,17 +347,17 @@ NS_IMETHODIMP nsMsgMaildirStore::GetSumm
return NS_OK;
}
NS_IMETHODIMP nsMsgMaildirStore::DeleteFolder(nsIMsgFolder *aFolder)
{
NS_ENSURE_ARG_POINTER(aFolder);
// Delete Maildir structure
- nsCOMPtr<nsILocalFile> pathFile;
+ nsCOMPtr<nsIFile> pathFile;
nsresult rv = aFolder->GetFilePath(getter_AddRefs(pathFile));
NS_ENSURE_SUCCESS(rv, rv);
rv = pathFile->Remove(true); // recursive
AddDirectorySeparator(pathFile);
bool exists;
pathFile->Exists(&exists);
if (exists)
@@ -368,35 +368,35 @@ NS_IMETHODIMP nsMsgMaildirStore::DeleteF
NS_IMETHODIMP nsMsgMaildirStore::RenameFolder(nsIMsgFolder *aFolder,
const nsAString & aNewName,
nsIMsgFolder **aNewFolder)
{
NS_ENSURE_ARG_POINTER(aFolder);
NS_ENSURE_ARG_POINTER(aNewFolder);
// old path
- nsCOMPtr<nsILocalFile> oldPathFile;
+ nsCOMPtr<nsIFile> oldPathFile;
nsresult rv = aFolder->GetFilePath(getter_AddRefs(oldPathFile));
NS_ENSURE_SUCCESS(rv, rv);
// old sbd directory
- nsCOMPtr<nsILocalFile> sbdPathFile;
+ nsCOMPtr<nsIFile> sbdPathFile;
PRUint32 numChildren;
aFolder->GetNumSubFolders(&numChildren);
if (numChildren > 0)
{
sbdPathFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = sbdPathFile->InitWithFile(oldPathFile);
NS_ENSURE_SUCCESS(rv, rv);
GetDirectoryForFolder(sbdPathFile);
}
// old summary
- nsCOMPtr<nsILocalFile> oldSummaryFile;
+ nsCOMPtr<nsIFile> oldSummaryFile;
rv = GetSummaryFile(aFolder, getter_AddRefs(oldSummaryFile));
NS_ENSURE_SUCCESS(rv, rv);
// Validate new name
nsAutoString safeName(aNewName);
NS_MsgHashIfNecessary(safeName);
aFolder->ForceDBClosed();
@@ -435,24 +435,24 @@ NS_IMETHODIMP nsMsgMaildirStore::CopyFol
NS_ENSURE_ARG_POINTER(aDstFolder);
nsString folderName;
aSrcFolder->GetName(folderName);
nsAutoString safeFolderName(folderName);
NS_MsgHashIfNecessary(safeFolderName);
nsCOMPtr<nsIMsgLocalMailFolder> localSrcFolder(do_QueryInterface(aSrcFolder));
aSrcFolder->ForceDBClosed();
- nsCOMPtr<nsILocalFile> oldPath;
+ nsCOMPtr<nsIFile> oldPath;
nsresult rv = aSrcFolder->GetFilePath(getter_AddRefs(oldPath));
NS_ENSURE_SUCCESS(rv,rv);
- nsCOMPtr<nsILocalFile> summaryFile;
+ nsCOMPtr<nsIFile> summaryFile;
GetSummaryFileLocation(oldPath, getter_AddRefs(summaryFile));
- nsCOMPtr<nsILocalFile> newPath;
+ nsCOMPtr<nsIFile> newPath;
rv = aDstFolder->GetFilePath(getter_AddRefs(newPath));
NS_ENSURE_SUCCESS(rv, rv);
// create target directory based on our current path
bool isServer;
aDstFolder->GetIsServer(&isServer);
rv = CreateDirectoryForFolder(newPath, isServer);
NS_ENSURE_SUCCESS(rv, rv);
@@ -549,17 +549,17 @@ NS_IMETHODIMP nsMsgMaildirStore::CopyFol
if (msgParent)
{
// The files have already been moved, so delete storage false
msgParent->PropagateDelete(aSrcFolder, false, aMsgWindow);
oldPath->Remove(true);
nsCOMPtr<nsIMsgDatabase> srcDB; // we need to force closed the source db
aSrcFolder->Delete();
- nsCOMPtr<nsILocalFile> parentPath;