add extensibility hooks for custom keywords in db view, r=cavin, sr=sspitzer 161226

This commit is contained in:
bienvenu%netscape.com 2002-08-13 01:33:28 +00:00
Родитель 1ad24af65b
Коммит 8393bf4fbc
3 изменённых файлов: 39 добавлений и 4 удалений

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

@ -322,5 +322,5 @@ interface nsIMsgDBViewCommandUpdater : nsISupports
void updateCommandStatus();
/* displayed message has changed */
void displayMessageChanged(in nsIMsgFolder aFolder, in wstring aSubject);
void displayMessageChanged(in nsIMsgFolder aFolder, in wstring aSubject, in string aKeywords);
};

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

@ -86,6 +86,7 @@ nsIAtom * nsMsgDBView::kAttachMsgAtom = nsnull;
nsIAtom * nsMsgDBView::kHasUnreadAtom = nsnull;
nsIAtom * nsMsgDBView::kWatchThreadAtom = nsnull;
nsIAtom * nsMsgDBView::kIgnoreThreadAtom = nsnull;
nsIAtom * nsMsgDBView::kHasImageAtom = nsnull;
nsIAtom * nsMsgDBView::mLabelPrefColorAtoms[PREF_LABELS_MAX] = {nsnull, nsnull, nsnull, nsnull, nsnull};
@ -161,6 +162,7 @@ void nsMsgDBView::InitializeAtomsAndLiterals()
kHasUnreadAtom = NS_NewAtom("hasUnread");
kWatchThreadAtom = NS_NewAtom("watch");
kIgnoreThreadAtom = NS_NewAtom("ignore");
kHasImageAtom = NS_NewAtom("hasimage");
#ifdef SUPPORT_PRIORITY_COLORS
kHighestPriorityAtom = NS_NewAtom("priority-highest");
@ -204,6 +206,7 @@ nsMsgDBView::~nsMsgDBView()
NS_IF_RELEASE(kHasUnreadAtom);
NS_IF_RELEASE(kWatchThreadAtom);
NS_IF_RELEASE(kIgnoreThreadAtom);
NS_IF_RELEASE(kHasImageAtom);
#ifdef SUPPORT_PRIORITY_COLORS
NS_IF_RELEASE(kHighestPriorityAtom);
@ -500,7 +503,6 @@ nsresult nsMsgDBView::FetchAuthor(nsIMsgHdr * aHdr, PRUnichar ** aSenderString)
return NS_OK;
}
}
// if we got here then just return the original string
*aSenderString = nsCRT::strdup(unparsedAuthor);
return NS_OK;
@ -883,7 +885,12 @@ nsresult nsMsgDBView::UpdateDisplayMessage(nsMsgKey aMsgKey)
NS_ENSURE_SUCCESS(rv,rv);
nsXPIDLString subject;
FetchSubject(msgHdr, m_flags[viewPosition], getter_Copies(subject));
mCommandUpdater->DisplayMessageChanged(m_folder, subject);
nsXPIDLCString keywords;
rv = msgHdr->GetStringProperty("keywords", getter_Copies(keywords));
NS_ENSURE_SUCCESS(rv,rv);
mCommandUpdater->DisplayMessageChanged(m_folder, subject, keywords);
} // if view position is valid
} // if we have an updater
return NS_OK;
@ -1111,7 +1118,34 @@ NS_IMETHODIMP nsMsgDBView::GetCellProperties(PRInt32 aRow, const PRUnichar *colI
if (mIsNews)
properties->AppendElement(kNewsMsgAtom);
nsXPIDLCString imageSize;
msgHdr->GetStringProperty("imageSize", getter_Copies(imageSize));
if (!imageSize.IsEmpty())
{
properties->AppendElement(kHasImageAtom);
}
nsXPIDLCString keywordProperty;
msgHdr->GetStringProperty("keywords", getter_Copies(keywordProperty));
if (!keywordProperty.IsEmpty())
{
nsCAutoString keywords(keywordProperty);
nsCAutoString nextKeyword;
PRInt32 spaceIndex = 0;
do
{
spaceIndex = keywords.FindChar(' ');
PRInt32 endOfKeyword = (spaceIndex == -1) ? keywords.Length() : spaceIndex;
keywords.Left(nextKeyword, endOfKeyword);
nextKeyword.Insert("kw-", 0);
nsCOMPtr <nsIAtom> keywordAtom = NS_NewAtom(nextKeyword.get());
properties->AppendElement(keywordAtom);
if (spaceIndex > 0)
keywords.Cut(0, endOfKeyword + 1);
}
while (spaceIndex > 0);
}
#ifdef SUPPORT_PRIORITY_COLORS
// add special styles for priority
nsMsgPriorityValue priority;

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

@ -116,6 +116,7 @@ protected:
static nsIAtom* kHasUnreadAtom;
static nsIAtom* kWatchThreadAtom;
static nsIAtom* kIgnoreThreadAtom;
static nsIAtom* kHasImageAtom;
#ifdef SUPPORT_PRIORITY_COLORS
static nsIAtom* kHighestPriorityAtom;