mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
57440 r=bienvenu sr=sspitzer a=asa Make the default mail folders localizable.
This commit is contained in:
parent
1e8adc7427
commit
7a4dee432d
@ -584,13 +584,12 @@ function setDefaultCopiesAndFoldersPrefs(identity, server)
|
||||
if (protocolInfo.needToBuildSpecialFolderURIs)
|
||||
{
|
||||
var folderDelim = "/";
|
||||
var sentFolderName = gMessengerBundle.getString("sentFolderName");
|
||||
var draftsFolderName = gMessengerBundle.getString("draftsFolderName");
|
||||
var templatesFolderName = gMessengerBundle.getString("templatesFolderName");
|
||||
|
||||
identity.draftFolder = msgFolder.server.serverURI+ folderDelim + draftsFolderName;
|
||||
identity.stationeryFolder = msgFolder.server.serverURI+ folderDelim + templatesFolderName;
|
||||
identity.fccFolder = msgFolder.server.serverURI+ folderDelim + sentFolderName;
|
||||
/* we use internal names known to everyone like Sent, Templates and Drafts */
|
||||
|
||||
identity.draftFolder = msgFolder.server.serverURI+ folderDelim + "Drafts";
|
||||
identity.stationeryFolder = msgFolder.server.serverURI+ folderDelim + "Templates";
|
||||
identity.fccFolder = msgFolder.server.serverURI+ folderDelim + "Sent";
|
||||
}
|
||||
else {
|
||||
// these hex values come from nsMsgFolderFlags.h
|
||||
|
@ -1035,11 +1035,9 @@ PRBool PR_CALLBACK nsMsgAccountManager::cleanupOnExit(nsHashKey *aKey, void *aDa
|
||||
{
|
||||
rv = aEnumerator->CurrentItem(getter_AddRefs(aSupport));
|
||||
nsCOMPtr<nsIMsgFolder>inboxFolder = do_QueryInterface(aSupport);
|
||||
nsXPIDLString folderName;
|
||||
inboxFolder->GetName(getter_Copies(folderName));
|
||||
if (folderName &&
|
||||
folderName.Equals(NS_LITERAL_STRING("INBOX"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
PRUint32 flags;
|
||||
inboxFolder->GetFlags(&flags);
|
||||
if (flags & MSG_FOLDER_FLAG_INBOX)
|
||||
{
|
||||
rv1 = inboxFolder->Compact(urlListener, nsnull /* msgwindow */);
|
||||
if (NS_SUCCEEDED(rv1))
|
||||
|
@ -429,7 +429,7 @@ nsresult nsMsgDBFolder::ReadDBFolderInfo(PRBool force)
|
||||
#ifdef DEBUG_bienvenu
|
||||
nsXPIDLString name;
|
||||
GetName(getter_Copies(name));
|
||||
NS_ASSERTION(Compare(name, NS_LITERAL_STRING("Trash")) || (mFlags & MSG_FOLDER_FLAG_TRASH), "lost trash flag");
|
||||
NS_ASSERTION(Compare(name, kLocalizedTrashName) || (mFlags & MSG_FOLDER_FLAG_TRASH), "lost trash flag");
|
||||
#endif
|
||||
mInitializedFromCache = PR_TRUE;
|
||||
}
|
||||
|
@ -90,12 +90,12 @@ static NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID);
|
||||
|
||||
nsrefcnt nsMsgFolder::gInstanceCount = 0;
|
||||
|
||||
PRUnichar *nsMsgFolder::kInboxName = 0;
|
||||
PRUnichar *nsMsgFolder::kTrashName = 0;
|
||||
PRUnichar *nsMsgFolder::kSentName = 0;
|
||||
PRUnichar *nsMsgFolder::kDraftsName = 0;
|
||||
PRUnichar *nsMsgFolder::kTemplatesName = 0;
|
||||
PRUnichar *nsMsgFolder::kUnsentName = 0;
|
||||
PRUnichar *nsMsgFolder::kLocalizedInboxName;
|
||||
PRUnichar *nsMsgFolder::kLocalizedTrashName;
|
||||
PRUnichar *nsMsgFolder::kLocalizedSentName;
|
||||
PRUnichar *nsMsgFolder::kLocalizedDraftsName;
|
||||
PRUnichar *nsMsgFolder::kLocalizedTemplatesName;
|
||||
PRUnichar *nsMsgFolder::kLocalizedUnsentName;
|
||||
|
||||
nsIAtom * nsMsgFolder::kTotalMessagesAtom = nsnull;
|
||||
nsIAtom * nsMsgFolder::kBiffStateAtom = nsnull;
|
||||
@ -195,12 +195,12 @@ nsMsgFolder::~nsMsgFolder(void)
|
||||
NS_IF_RELEASE(kSynchronizeAtom);
|
||||
NS_IF_RELEASE(kOpenAtom);
|
||||
NS_IF_RELEASE(kCollationKeyGenerator);
|
||||
CRTFREEIF(kInboxName);
|
||||
CRTFREEIF(kTrashName);
|
||||
CRTFREEIF(kSentName);
|
||||
CRTFREEIF(kDraftsName);
|
||||
CRTFREEIF(kTemplatesName);
|
||||
CRTFREEIF(kUnsentName);
|
||||
CRTFREEIF(kLocalizedInboxName);
|
||||
CRTFREEIF(kLocalizedTrashName);
|
||||
CRTFREEIF(kLocalizedSentName);
|
||||
CRTFREEIF(kLocalizedDraftsName);
|
||||
CRTFREEIF(kLocalizedTemplatesName);
|
||||
CRTFREEIF(kLocalizedUnsentName);
|
||||
#ifdef MSG_FASTER_URI_PARSING
|
||||
mParsingURL = nsnull;
|
||||
#endif
|
||||
@ -218,7 +218,7 @@ nsMsgFolder::initializeStrings()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(kStringBundleServiceCID, &rv);
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
rv = bundleService->CreateBundle("chrome://messenger/locale/messenger.properties",
|
||||
@ -226,17 +226,17 @@ nsMsgFolder::initializeStrings()
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("inboxFolderName").get(),
|
||||
&kInboxName);
|
||||
&kLocalizedInboxName);
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("trashFolderName").get(),
|
||||
&kTrashName);
|
||||
&kLocalizedTrashName);
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("sentFolderName").get(),
|
||||
&kSentName);
|
||||
&kLocalizedSentName);
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("draftsFolderName").get(),
|
||||
&kDraftsName);
|
||||
&kLocalizedDraftsName);
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("templatesFolderName").get(),
|
||||
&kTemplatesName);
|
||||
&kLocalizedTemplatesName);
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("unsentFolderName").get(),
|
||||
&kUnsentName);
|
||||
&kLocalizedUnsentName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -873,7 +873,33 @@ NS_IMETHODIMP nsMsgFolder::GetPrettyName(PRUnichar ** name)
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::SetPrettyName(const PRUnichar *name)
|
||||
{
|
||||
return SetName(name);
|
||||
nsresult rv;
|
||||
nsAutoString unicodeName(name);
|
||||
|
||||
//Set pretty name only if special flag is set and if it the default folder name
|
||||
|
||||
if (mFlags & MSG_FOLDER_FLAG_INBOX && unicodeName.Equals(NS_LITERAL_STRING("Inbox"), nsCaseInsensitiveStringComparator()))
|
||||
rv = SetName(kLocalizedInboxName);
|
||||
|
||||
else if (mFlags & MSG_FOLDER_FLAG_SENTMAIL && unicodeName.Equals(NS_LITERAL_STRING("Sent"), nsCaseInsensitiveStringComparator()))
|
||||
rv = SetName(kLocalizedSentName);
|
||||
|
||||
else if (mFlags & MSG_FOLDER_FLAG_DRAFTS && unicodeName.Equals(NS_LITERAL_STRING("Drafts"), nsCaseInsensitiveStringComparator()))
|
||||
rv = SetName(kLocalizedDraftsName);
|
||||
|
||||
else if (mFlags & MSG_FOLDER_FLAG_TEMPLATES && unicodeName.Equals(NS_LITERAL_STRING("Templates"), nsCaseInsensitiveStringComparator()))
|
||||
rv = SetName(kLocalizedTemplatesName);
|
||||
|
||||
else if (mFlags & MSG_FOLDER_FLAG_TRASH && unicodeName.Equals(NS_LITERAL_STRING("Trash"), nsCaseInsensitiveStringComparator()))
|
||||
rv = SetName(kLocalizedTrashName);
|
||||
|
||||
else if (mFlags & MSG_FOLDER_FLAG_QUEUE && unicodeName.Equals(NS_LITERAL_STRING("Unsent Messages"), nsCaseInsensitiveStringComparator()))
|
||||
rv = SetName(kLocalizedUnsentName);
|
||||
|
||||
else
|
||||
rv = SetName(name);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgFolder::GetName(PRUnichar **name)
|
||||
@ -1628,7 +1654,7 @@ NS_IMETHODIMP nsMsgFolder::OnFlagChange(PRUint32 flag)
|
||||
#ifdef DEBUG_bienvenu
|
||||
nsXPIDLString name;
|
||||
rv = GetName(getter_Copies(name));
|
||||
NS_ASSERTION(Compare(name, NS_LITERAL_STRING("Trash")) || (mFlags & MSG_FOLDER_FLAG_TRASH), "lost trash flag");
|
||||
NS_ASSERTION(Compare(name, kLocalizedTrashName)) || (mFlags & MSG_FOLDER_FLAG_TRASH), "lost trash flag");
|
||||
#endif
|
||||
folderInfo->SetFlags((PRInt32) mFlags);
|
||||
if (db)
|
||||
@ -2915,4 +2941,3 @@ NS_IMETHODIMP nsMsgFolder::CompareSortKeys(nsIMsgFolder *aFolder, PRInt32 *sortO
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -266,6 +266,7 @@ protected:
|
||||
nsresult GetWarnFilterChanged(PRBool *aVal);
|
||||
nsresult SetWarnFilterChanged(PRBool aVal);
|
||||
nsresult CreateCollationKey(const nsString &aSource, PRUint8 **aKey, PRUint32 *aLength);
|
||||
|
||||
protected:
|
||||
PRUint32 mFlags;
|
||||
nsWeakPtr mParent; //This won't be refcounted for ownership reasons.
|
||||
@ -310,12 +311,12 @@ protected:
|
||||
static nsresult initializeStrings();
|
||||
static nsresult createCollationKeyGenerator();
|
||||
|
||||
static PRUnichar *kInboxName;
|
||||
static PRUnichar *kTrashName;
|
||||
static PRUnichar *kSentName;
|
||||
static PRUnichar *kDraftsName;
|
||||
static PRUnichar *kTemplatesName;
|
||||
static PRUnichar *kUnsentName;
|
||||
static PRUnichar *kLocalizedInboxName;
|
||||
static PRUnichar *kLocalizedTrashName;
|
||||
static PRUnichar *kLocalizedSentName;
|
||||
static PRUnichar *kLocalizedDraftsName;
|
||||
static PRUnichar *kLocalizedTemplatesName;
|
||||
static PRUnichar *kLocalizedUnsentName;
|
||||
|
||||
static nsIAtom* kTotalUnreadMessagesAtom;
|
||||
static nsIAtom* kBiffStateAtom;
|
||||
|
@ -1312,7 +1312,7 @@ NS_IMETHODIMP nsImapIncomingServer::PossibleImapMailbox(const char *folderPath,
|
||||
if (hierarchyDelimiter != '/')
|
||||
nsImapUrl::UnescapeSlashes(NS_CONST_CAST(char*, folderName.get()));
|
||||
if (NS_SUCCEEDED(CreatePRUnicharStringFromUTF7(folderName.get(), getter_Copies(unicodeName))))
|
||||
child->SetName(unicodeName);
|
||||
child->SetPrettyName(unicodeName);
|
||||
// Call ConvertFolderName() and HideFolderName() to do special folder name
|
||||
// mapping and hiding, if configured to do so. For example, need to hide AOL's
|
||||
// 'RECYCLE_OUT' & convert a few AOL folder names. Regular imap accounts
|
||||
|
@ -365,15 +365,15 @@ NS_IMETHODIMP nsImapMailFolder::AddSubfolderWithPath(nsAutoString *name, nsIFile
|
||||
name->Equals(NS_LITERAL_STRING("Inbox"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
flags |= MSG_FOLDER_FLAG_INBOX;
|
||||
else if((isServer || isParentInbox) && name->Equals(kTrashName,
|
||||
else if((isServer || isParentInbox) && name->Equals(NS_LITERAL_STRING("Trash"),
|
||||
nsCaseInsensitiveStringComparator()))
|
||||
flags |= MSG_FOLDER_FLAG_TRASH;
|
||||
#if 0
|
||||
else if(name->EqualsIgnoreCase(kSentName))
|
||||
else if(name->EqualsIgnoreCase(NS_LITERAL_STRING("Sent")))
|
||||
folder->SetFlag(MSG_FOLDER_FLAG_SENTMAIL);
|
||||
else if(name->EqualsIgnoreCase(kDraftsName))
|
||||
else if(name->EqualsIgnoreCase(NS_LITERAL_STRING("Drafts")))
|
||||
folder->SetFlag(MSG_FOLDER_FLAG_DRAFTS);
|
||||
else if (name->EqualsIgnoreCase(kTemplatesName));
|
||||
else if (name->EqualsIgnoreCase(NS_LITERAL_STRING("Templates")));
|
||||
folder->SetFlag(MSG_FOLDER_FLAG_TEMPLATES);
|
||||
#endif
|
||||
}
|
||||
@ -508,7 +508,7 @@ nsresult nsImapMailFolder::CreateSubFolders(nsFileSpec &path)
|
||||
// use the unicode name as the "pretty" name. Set it so it won't be
|
||||
// automatically computed from the URI, which is in utf7 form.
|
||||
if (currentFolderNameStr.Length() > 0)
|
||||
child->SetName(currentFolderNameStr.get());
|
||||
child->SetPrettyName(currentFolderNameStr.get());
|
||||
|
||||
}
|
||||
PL_strfree(folderName);
|
||||
|
@ -242,7 +242,7 @@ nsMsgLocalMailFolder::CreateSubFolders(nsFileSpec &path)
|
||||
|
||||
rv = AddSubfolder(¤tFolderNameStr, getter_AddRefs(child));
|
||||
if (child)
|
||||
child->SetName(currentFolderNameStr.get());
|
||||
child->SetPrettyName(currentFolderNameStr.get());
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@ -295,24 +295,24 @@ NS_IMETHODIMP nsMsgLocalMailFolder::AddSubfolder(nsAutoString *name,
|
||||
//Only set these is these are top level children.
|
||||
if(NS_SUCCEEDED(rv) && isServer)
|
||||
{
|
||||
if(name->Equals(kInboxName, nsCaseInsensitiveStringComparator()))
|
||||
if(name->Equals(NS_LITERAL_STRING("Inbox"), nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
flags |= MSG_FOLDER_FLAG_INBOX;
|
||||
SetBiffState(nsIMsgFolder::nsMsgBiffState_Unknown);
|
||||
}
|
||||
else if (name->Equals(kTrashName, nsCaseInsensitiveStringComparator()))
|
||||
else if (name->Equals(NS_LITERAL_STRING("Trash"), nsCaseInsensitiveStringComparator()))
|
||||
flags |= MSG_FOLDER_FLAG_TRASH;
|
||||
else if (name->Equals(kUnsentName, nsCaseInsensitiveStringComparator()) ||
|
||||
else if (name->Equals(NS_LITERAL_STRING("Unsent Messages"), nsCaseInsensitiveStringComparator()) ||
|
||||
name->Equals(NS_LITERAL_STRING("Outbox"), nsCaseInsensitiveStringComparator()))
|
||||
flags |= MSG_FOLDER_FLAG_QUEUE;
|
||||
#if 0
|
||||
// the logic for this has been moved into
|
||||
// SetFlagsOnDefaultMailboxes()
|
||||
else if(name->EqualsIgnoreCase(kSentName))
|
||||
else if(name->EqualsIgnoreCase(NS_LITERAL_STRING("Sent"), nsCaseInsensitiveStringComparator()))
|
||||
folder->SetFlag(MSG_FOLDER_FLAG_SENTMAIL);
|
||||
else if(name->EqualsIgnoreCase(kDraftsName))
|
||||
else if(name->EqualsIgnoreCase(NS_LITERAL_STRING("Drafts"), nsCaseInsensitiveStringComparator()))
|
||||
folder->SetFlag(MSG_FOLDER_FLAG_DRAFTS);
|
||||
else if(name->EqualsIgnoreCase(kTemplatesName))
|
||||
else if(name->EqualsIgnoreCase(NS_LITERAL_STRING("Templates"), nsCaseInsensitiveStringComparator()))
|
||||
folder->SetFlag(MSG_FOLDER_FLAG_TEMPLATES);
|
||||
#endif
|
||||
}
|
||||
@ -352,7 +352,6 @@ NS_IMETHODIMP nsMsgLocalMailFolder::ParseFolder(nsIMsgWindow *aMsgWindow, nsIUrl
|
||||
nsMsgMailboxParser *parser = new nsMsgMailboxParser;
|
||||
if(!parser)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = mailboxService->ParseMailbox(aMsgWindow, path, parser, listener, nsnull);
|
||||
|
||||
return rv;
|
||||
@ -842,7 +841,7 @@ nsMsgLocalMailFolder::CreateSubfolder(const PRUnichar *folderName, nsIMsgWindow
|
||||
//Now let's create the actual new folder
|
||||
rv = AddSubfolder(&folderNameStr, getter_AddRefs(child));
|
||||
if (child)
|
||||
child->SetName(folderNameStr.get());
|
||||
child->SetPrettyName(folderNameStr.get()); //because empty trash will create a new trash folder
|
||||
unusedDB->SetSummaryValid(PR_TRUE);
|
||||
unusedDB->Close(PR_TRUE);
|
||||
}
|
||||
@ -983,33 +982,27 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EmptyTrash(nsIMsgWindow *msgWindow,
|
||||
rv = trashFolder->GetParentMsgFolder(getter_AddRefs(parentFolder));
|
||||
if (NS_SUCCEEDED(rv) && parentFolder)
|
||||
{
|
||||
nsXPIDLString idlFolderName;
|
||||
rv = trashFolder->GetName(getter_Copies(idlFolderName));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr <nsIDBFolderInfo> dbFolderInfo;
|
||||
nsCOMPtr <nsIDBFolderInfo> transferInfo;
|
||||
nsCOMPtr <nsIMsgDatabase> db;
|
||||
trashFolder->GetDBFolderInfoAndDB(getter_AddRefs(dbFolderInfo), getter_AddRefs(db));
|
||||
if (dbFolderInfo)
|
||||
dbFolderInfo->GetTransferInfo(getter_AddRefs(transferInfo));
|
||||
dbFolderInfo = nsnull;
|
||||
nsCOMPtr <nsIDBFolderInfo> dbFolderInfo;
|
||||
nsCOMPtr <nsIDBFolderInfo> transferInfo;
|
||||
nsCOMPtr <nsIMsgDatabase> db;
|
||||
trashFolder->GetDBFolderInfoAndDB(getter_AddRefs(dbFolderInfo), getter_AddRefs(db));
|
||||
if (dbFolderInfo)
|
||||
dbFolderInfo->GetTransferInfo(getter_AddRefs(transferInfo));
|
||||
dbFolderInfo = nsnull;
|
||||
|
||||
nsString folderName(idlFolderName);
|
||||
trashFolder->SetParent(nsnull);
|
||||
parentFolder->PropagateDelete(trashFolder, PR_TRUE, msgWindow);
|
||||
parentFolder->CreateSubfolder(folderName.get(),nsnull);
|
||||
nsCOMPtr<nsIMsgFolder> newTrashFolder;
|
||||
rv = GetTrashFolder(getter_AddRefs(newTrashFolder));
|
||||
if (NS_SUCCEEDED(rv) && newTrashFolder)
|
||||
newTrashFolder->GetMsgDatabase(msgWindow, getter_AddRefs(db));
|
||||
trashFolder->SetParent(nsnull);
|
||||
parentFolder->PropagateDelete(trashFolder, PR_TRUE, msgWindow);
|
||||
parentFolder->CreateSubfolder(NS_LITERAL_STRING("Trash").get(),nsnull);
|
||||
nsCOMPtr<nsIMsgFolder> newTrashFolder;
|
||||
rv = GetTrashFolder(getter_AddRefs(newTrashFolder));
|
||||
if (NS_SUCCEEDED(rv) && newTrashFolder)
|
||||
newTrashFolder->GetMsgDatabase(msgWindow, getter_AddRefs(db));
|
||||
|
||||
if (transferInfo && db)
|
||||
{
|
||||
db->GetDBFolderInfo(getter_AddRefs(dbFolderInfo));
|
||||
if (dbFolderInfo)
|
||||
dbFolderInfo->InitFromTransferInfo(transferInfo);
|
||||
}
|
||||
if (transferInfo && db)
|
||||
{
|
||||
db->GetDBFolderInfo(getter_AddRefs(dbFolderInfo));
|
||||
if (dbFolderInfo)
|
||||
dbFolderInfo->InitFromTransferInfo(transferInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3256,44 +3249,52 @@ NS_IMETHODIMP
|
||||
nsMsgLocalMailFolder::SetFlagsOnDefaultMailboxes(PRUint32 flags)
|
||||
{
|
||||
if (flags & MSG_FOLDER_FLAG_INBOX)
|
||||
setSubfolderFlag(kInboxName, MSG_FOLDER_FLAG_INBOX);
|
||||
setSubfolderFlag("Inbox", MSG_FOLDER_FLAG_INBOX);
|
||||
|
||||
if (flags & MSG_FOLDER_FLAG_SENTMAIL)
|
||||
setSubfolderFlag(kSentName, MSG_FOLDER_FLAG_SENTMAIL);
|
||||
setSubfolderFlag("Sent", MSG_FOLDER_FLAG_SENTMAIL);
|
||||
|
||||
if (flags & MSG_FOLDER_FLAG_DRAFTS)
|
||||
setSubfolderFlag(kDraftsName, MSG_FOLDER_FLAG_DRAFTS);
|
||||
setSubfolderFlag("Drafts", MSG_FOLDER_FLAG_DRAFTS);
|
||||
|
||||
if (flags & MSG_FOLDER_FLAG_TEMPLATES)
|
||||
setSubfolderFlag(kTemplatesName, MSG_FOLDER_FLAG_TEMPLATES);
|
||||
setSubfolderFlag("Templates", MSG_FOLDER_FLAG_TEMPLATES);
|
||||
|
||||
if (flags & MSG_FOLDER_FLAG_TRASH)
|
||||
setSubfolderFlag(kTrashName, MSG_FOLDER_FLAG_TRASH);
|
||||
setSubfolderFlag("Trash", MSG_FOLDER_FLAG_TRASH);
|
||||
|
||||
if (flags & MSG_FOLDER_FLAG_QUEUE)
|
||||
setSubfolderFlag(kUnsentName, MSG_FOLDER_FLAG_QUEUE);
|
||||
setSubfolderFlag("Unsent Messages", MSG_FOLDER_FLAG_QUEUE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgLocalMailFolder::setSubfolderFlag(PRUnichar* aFolderName,
|
||||
nsMsgLocalMailFolder::setSubfolderFlag(const char *aFolderName,
|
||||
PRUint32 flags)
|
||||
{
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIFolder> folder;
|
||||
rv = FindSubFolder(NS_ConvertUCS2toUTF8(aFolderName).get(), getter_AddRefs(folder));
|
||||
rv = FindSubFolder(aFolderName, getter_AddRefs(folder));
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!folder) return NS_ERROR_FAILURE;
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (!folder)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> msgFolder = do_QueryInterface(folder);
|
||||
if (!msgFolder) return NS_ERROR_FAILURE;
|
||||
if (!msgFolder)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
rv = msgFolder->SetFlag(flags);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsAutoString unicodeFolderName;
|
||||
unicodeFolderName.AssignWithConversion(aFolderName);
|
||||
msgFolder->SetPrettyName(unicodeFolderName.get());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ protected:
|
||||
PRBool mCheckForNewMessagesAfterParsing;
|
||||
nsCOMPtr<nsIMsgStringService> mMsgStringService;
|
||||
|
||||
nsresult setSubfolderFlag(PRUnichar *aFolderName, PRUint32 flags);
|
||||
nsresult setSubfolderFlag(const char *aFolderName, PRUint32 flags);
|
||||
};
|
||||
|
||||
#endif // nsMsgLocalMailFolder_h__
|
||||
|
@ -118,8 +118,6 @@ NS_IMETHODIMP nsMovemailIncomingServer::CreateDefaultMailboxes(nsIFileSpec *path
|
||||
PRBool exists;
|
||||
if (!path) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// todo, use a string bundle for this
|
||||
|
||||
rv =path->AppendRelativeUnixPath("Inbox");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = path->Exists(&exists);
|
||||
|
@ -166,10 +166,8 @@ NS_IMETHODIMP nsNoIncomingServer::CreateDefaultMailboxes(nsIFileSpec *path)
|
||||
{
|
||||
nsresult rv;
|
||||
PRBool exists;
|
||||
if (!path) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// todo, use a string bundle for these
|
||||
|
||||
if (!path)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// notice, no Inbox
|
||||
rv = path->AppendRelativeUnixPath("Trash");
|
||||
|
@ -60,17 +60,6 @@ static NS_DEFINE_CID(kCPop3ServiceCID, NS_POP3SERVICE_CID);
|
||||
static NS_DEFINE_CID(kCMsgMailSessionCID, NS_MSGMAILSESSION_CID);
|
||||
static NS_DEFINE_CID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
|
||||
|
||||
#define INBOX_NAME "Inbox"
|
||||
|
||||
nsrefcnt nsPop3IncomingServer::gInstanceCount = 0;
|
||||
|
||||
PRUnichar *nsPop3IncomingServer::kInboxName = 0;
|
||||
PRUnichar *nsPop3IncomingServer::kTrashName = 0;
|
||||
PRUnichar *nsPop3IncomingServer::kSentName = 0;
|
||||
PRUnichar *nsPop3IncomingServer::kDraftsName = 0;
|
||||
PRUnichar *nsPop3IncomingServer::kTemplatesName = 0;
|
||||
PRUnichar *nsPop3IncomingServer::kUnsentName = 0;
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsPop3IncomingServer,
|
||||
nsMsgIncomingServer,
|
||||
nsIPop3IncomingServer,
|
||||
@ -87,52 +76,11 @@ nsPop3IncomingServer::nsPop3IncomingServer()
|
||||
POP3_TOP_UNDEFINED |
|
||||
POP3_XTND_XLST_UNDEFINED;
|
||||
|
||||
if (gInstanceCount++ == 0) {
|
||||
initializeStrings();
|
||||
|
||||
}
|
||||
|
||||
m_canHaveFilters = PR_TRUE;
|
||||
}
|
||||
|
||||
nsPop3IncomingServer::~nsPop3IncomingServer()
|
||||
{
|
||||
if (--gInstanceCount == 0) {
|
||||
CRTFREEIF(kInboxName);
|
||||
CRTFREEIF(kTrashName);
|
||||
CRTFREEIF(kSentName);
|
||||
CRTFREEIF(kDraftsName);
|
||||
CRTFREEIF(kTemplatesName);
|
||||
CRTFREEIF(kUnsentName);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPop3IncomingServer::initializeStrings()
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(kStringBundleServiceCID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
rv = bundleService->CreateBundle("chrome://messenger/locale/messenger.properties",
|
||||
getter_AddRefs(bundle));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("inboxFolderName").get(),
|
||||
&kInboxName);
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("trashFolderName").get(),
|
||||
&kTrashName);
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("sentFolderName").get(),
|
||||
&kSentName);
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("draftsFolderName").get(),
|
||||
&kDraftsName);
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("templatesFolderName").get(),
|
||||
&kTemplatesName);
|
||||
bundle->GetStringFromName(NS_LITERAL_STRING("unsentFolderName").get(),
|
||||
&kUnsentName);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -260,8 +208,7 @@ NS_IMETHODIMP nsPop3IncomingServer::CreateDefaultMailboxes(nsIFileSpec *path)
|
||||
PRBool exists;
|
||||
if (!path) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// todo, use a string bundle for this
|
||||
rv =path->AppendRelativeUnixPath(INBOX_NAME);
|
||||
rv =path->AppendRelativeUnixPath("Inbox");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = path->Exists(&exists);
|
||||
if (!exists) {
|
||||
|
@ -69,18 +69,6 @@ private:
|
||||
PRUnichar *folderName,
|
||||
PRUint32 flag);
|
||||
|
||||
// copied from nsMsgFolder because flag setting is done in the
|
||||
// server, not the folder :(
|
||||
static nsrefcnt gInstanceCount;
|
||||
static nsresult initializeStrings();
|
||||
|
||||
static PRUnichar *kInboxName;
|
||||
static PRUnichar *kTrashName;
|
||||
static PRUnichar *kSentName;
|
||||
static PRUnichar *kDraftsName;
|
||||
static PRUnichar *kTemplatesName;
|
||||
static PRUnichar *kUnsentName;
|
||||
|
||||
PRUint32 m_capabilityFlags;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user