more work on 314124 folder pane popup on folders with new messages, sr=mscott

This commit is contained in:
bienvenu%nventure.com 2005-11-16 15:01:24 +00:00
Родитель 7eace4f6bf
Коммит dce386397f
4 изменённых файлов: 34 добавлений и 29 удалений

Просмотреть файл

@ -2003,6 +2003,7 @@
// now get the database
var msgDatabase = msgFolder.getMsgDatabase(msgWindow);
msgFolder.setMsgDatabase(null);
var msgKeys = {};
var numMsgKeys = {};
msgDatabase.getNewList(numMsgKeys, msgKeys);
@ -2016,12 +2017,14 @@
try {
msgFolder.fetchMsgPreviewText(msgKeys.value, numMsgKeys.value, false, null, asyncResults);
msgFolder.setMsgDatabase(null);
}
catch (ex)
{
// fetchMsgPreviewText throws an error when we call it on a news folder, we should just not show
// the tooltip if this method returns an error.
dump('fetchMsgPreviewText threw an error or failed to set any preview text data\n');
msgFolder.setMsgDatabase(null);
return false;
}
@ -2035,7 +2038,7 @@
msgPopup, msgDatabase.GetMsgHdrForKey(msgKeys.value[index++]));
document.getAnonymousNodes(this)[0].appendChild(msgPopup);
}
}
return true;
]]>
</handler>

Просмотреть файл

@ -299,27 +299,7 @@ NS_IMETHODIMP nsMsgDBFolder::EndFolderLoading(void)
//GGGG check for new mail here and call SetNewMessages...?? -- ONE OF THE 2 PLACES
if(mDatabase)
{
nsresult rv;
PRBool hasNewMessages;
rv = mDatabase->HasNew(&hasNewMessages);
if (!hasNewMessages)
{
for (PRUint32 keyIndex = 0; keyIndex < m_newMsgs.GetSize(); keyIndex++)
{
PRBool isRead = PR_FALSE;
mDatabase->IsRead(m_newMsgs[keyIndex], &isRead);
if (!isRead)
{
mDatabase->AddToNewList(m_newMsgs[keyIndex]);
hasNewMessages = PR_TRUE;
}
}
m_newMsgs.RemoveAll();
}
SetHasNewMessages(hasNewMessages);
}
m_newMsgs.RemoveAll();
return NS_OK;
}
@ -5111,7 +5091,8 @@ nsresult nsMsgDBFolder::GetMsgPreviewTextFromStream(nsIMsgDBHdr *msgHdr, nsIInpu
// might want to use a state var instead of bools.
PRBool inMsgBody = PR_FALSE, msgBodyIsHtml = PR_FALSE, lookingForBoundary = PR_FALSE;
PRBool haveBoundary = PR_FALSE;
while (len > 0)
PRBool more = PR_TRUE;
while (len > 0 && more)
{
// might be on same line as content-type, so look before
// we read the next line.
@ -5132,7 +5113,6 @@ nsresult nsMsgDBFolder::GetMsgPreviewTextFromStream(nsIMsgDBHdr *msgHdr, nsIInpu
}
}
}
PRBool more;
rv = NS_ReadLine(stream, lineBuffer, curLine, &more);
if (NS_SUCCEEDED(rv))
{
@ -5162,17 +5142,22 @@ nsresult nsMsgDBFolder::GetMsgPreviewTextFromStream(nsIMsgDBHdr *msgHdr, nsIInpu
inMsgBody = PR_TRUE;
continue;
}
if (StringBeginsWith(curLine, NS_LITERAL_CSTRING("Content-Type:")))
if (StringBeginsWith(curLine, NS_LITERAL_CSTRING("Content-Type:"),
nsCaseInsensitiveCStringComparator()))
{
if (FindInReadable(NS_LITERAL_CSTRING("text/html"), curLine))
if (FindInReadable(NS_LITERAL_CSTRING("text/html"), curLine,
nsCaseInsensitiveCStringComparator()))
{
msgBodyIsHtml = PR_TRUE;
// bodyFollowsHeaders = PR_TRUE;
}
else if (FindInReadable(NS_LITERAL_CSTRING("text/plain"), curLine))
else if (FindInReadable(NS_LITERAL_CSTRING("text/plain"), curLine,
nsCaseInsensitiveCStringComparator()))
/* bodyFollowsHeaders = PR_TRUE */;
else if (FindInReadable(NS_LITERAL_CSTRING("multipart/mixed"), curLine)
|| FindInReadable(NS_LITERAL_CSTRING("multipart/alternative"), curLine))
else if (FindInReadable(NS_LITERAL_CSTRING("multipart/mixed"), curLine,
nsCaseInsensitiveCStringComparator())
|| FindInReadable(NS_LITERAL_CSTRING("multipart/alternative"), curLine,
nsCaseInsensitiveCStringComparator()))
{
lookingForBoundary = PR_TRUE;
}

Просмотреть файл

@ -493,7 +493,22 @@ NS_IMETHODIMP nsMsgLocalMailFolder::GetDatabaseWOReparse(nsIMsgDatabase **aDatab
{
rv = msgDBService->OpenFolderDB(this, PR_FALSE, PR_TRUE, (nsIMsgDatabase **) getter_AddRefs(mDatabase));
if (mDatabase && NS_SUCCEEDED(rv))
{
mDatabase->AddListener(this);
PRBool hasNewMessages = PR_FALSE;
for (PRUint32 keyIndex = 0; keyIndex < m_newMsgs.GetSize(); keyIndex++)
{
PRBool isRead = PR_FALSE;
mDatabase->IsRead(m_newMsgs[keyIndex], &isRead);
if (!isRead)
{
hasNewMessages = PR_TRUE;
mDatabase->AddToNewList(m_newMsgs[keyIndex]);
}
}
SetHasNewMessages(hasNewMessages);
}
}
}
*aDatabase = mDatabase;

Просмотреть файл

@ -175,6 +175,8 @@ pref("mail.receipt.request_header_type", 0); // 0: MDN-DNT header 1:
pref("mail.receipt.request_return_receipt_on", false);
pref("mail.mdn.report.enabled", true); // false: Never send true: Send sometimes
pref("mail.showPreviewText", false);
pref("news.default_cc", "");
pref("news.default_fcc", ""); // mailbox:URL or Imap://Host/OnlineFolderName
pref("news.use_fcc", true);