зеркало из https://github.com/mozilla/pjs.git
Bug #223292 --> Default mailViews.dat contains hardcoded English descriptions
add a prettyName attribute to a mail view just like we currently do for mail folders. Similar to the way we handle mail folders, if the raw name of the mail view matches one of our default views, then we look up the translated pretty name and return it as the pretty name. sr=bienvenu a=bsmedberg
This commit is contained in:
Родитель
1fa82e99cd
Коммит
970b2de485
|
@ -345,7 +345,7 @@ function viewRefreshCustomMailViews(aCurrentViewValue)
|
|||
for (i = 0; i < numItems; i++)
|
||||
{
|
||||
var newMenuItem = document.createElement("menuitem");
|
||||
newMenuItem.setAttribute("label", mailViewList.getMailViewAt(i).mailViewName);
|
||||
newMenuItem.setAttribute("label", mailViewList.getMailViewAt(i).prettyName);
|
||||
newMenuItem.setAttribute("userdefined", "true");
|
||||
var oncommandStr = "ViewMessagesBy('userdefinedview" + (kLastDefaultViewIndex + i) + "');";
|
||||
newMenuItem.setAttribute("oncommand", oncommandStr);
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#
|
||||
# Mail Views
|
||||
#
|
||||
|
||||
mailViewPeopleIKnow=People I Know
|
||||
mailViewRecentMail=Recent Mail
|
||||
mailViewLastFiveDays=Last 5 Days
|
||||
mailViewNotJunk=Not Junk
|
||||
mailViewHasAttachments=Has Attachments
|
|
@ -67,6 +67,7 @@
|
|||
locale/@AB_CD@/messenger/am-mdn.dtd (%chrome/messenger/am-mdn.dtd)
|
||||
locale/@AB_CD@/messenger/am-mdn.properties (%chrome/messenger/am-mdn.properties)
|
||||
locale/@AB_CD@/messenger/msgmdn.properties (%chrome/messenger/msgmdn.properties)
|
||||
locale/@AB_CD@/messenger/mailviews.properties (%chrome/messenger/mailviews.properties)
|
||||
locale/@AB_CD@/messenger/msgViewPickerOverlay.dtd (%chrome/messenger/msgViewPickerOverlay.dtd)
|
||||
locale/@AB_CD@/messenger/mailViewSetup.dtd (%chrome/messenger/mailViewSetup.dtd)
|
||||
locale/@AB_CD@/messenger/mailViewList.dtd (%chrome/messenger/mailViewList.dtd)
|
||||
|
|
|
@ -331,7 +331,7 @@ function viewRefreshCustomMailViews(aCurrentViewValue)
|
|||
for (i = 0; i < numItems; i++)
|
||||
{
|
||||
var newMenuItem = document.createElement("menuitem");
|
||||
newMenuItem.setAttribute("label", mailViewList.getMailViewAt(i).mailViewName);
|
||||
newMenuItem.setAttribute("label", mailViewList.getMailViewAt(i).prettyName);
|
||||
newMenuItem.setAttribute("userdefined", "true");
|
||||
var oncommandStr = "ViewMessagesBy('userdefinedview" + (kLastDefaultViewIndex + i) + "');";
|
||||
newMenuItem.setAttribute("oncommand", oncommandStr);
|
||||
|
|
|
@ -11,5 +11,6 @@ messenger.jar:
|
|||
en-US.jar:
|
||||
locale/en-US/messenger/msgViewPickerOverlay.dtd (resources/locale/en-US/msgViewPickerOverlay.dtd)
|
||||
locale/en-US/messenger/mailViewSetup.dtd (resources/locale/en-US/mailViewSetup.dtd)
|
||||
locale/en-US/messenger/mailViewList.dtd (resources/locale/en-US/mailViewList.dtd)
|
||||
locale/en-US/messenger/mailViewList.dtd (resources/locale/en-US/mailViewList.dtd)
|
||||
locale/en-US/messenger/mailviews.properties (resources/locale/en-US/mailviews.properties)
|
||||
#endif
|
||||
|
|
|
@ -42,12 +42,10 @@
|
|||
|
||||
interface nsIMsgSearchTerm;
|
||||
|
||||
// a mail view consists of a string identifier which would show up in the UI
|
||||
// and an array of search terms which define the criteria for the view.
|
||||
|
||||
[scriptable, uuid(82496947-84F9-42ac-87D1-88B0CCAF114B)]
|
||||
[scriptable, uuid(28AC84DF-CBE5-430d-A5C0-4FA63B5424DF)]
|
||||
interface nsIMsgMailView : nsISupports {
|
||||
attribute wstring mailViewName;
|
||||
readonly attribute wstring prettyName; // localized pretty name
|
||||
|
||||
// the array of search terms
|
||||
attribute nsISupportsArray searchTerms;
|
||||
|
|
|
@ -83,8 +83,8 @@ function refreshListView(aSelectedMailView)
|
|||
for (index = 0; index < numItems; index++)
|
||||
{
|
||||
mailView = gMailListView.getMailViewAt(index);
|
||||
gListBox.appendItem(mailView.mailViewName, index);
|
||||
if (aSelectedMailView && (mailView.mailViewName == aSelectedMailView.mailViewName) )
|
||||
gListBox.appendItem(mailView.prettyName, index);
|
||||
if (aSelectedMailView && (mailView.prettyName == aSelectedMailView.prettyName) )
|
||||
gListBox.selectedIndex = index;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,14 +65,11 @@ function mailViewOnLoad()
|
|||
|
||||
if (gMailView)
|
||||
{
|
||||
dialog.nameField.value = gMailView.mailViewName;
|
||||
dialog.nameField.value = gMailView.prettyName;
|
||||
initializeSearchRows(nsMsgSearchScope.offlineMail, gMailView.searchTerms);
|
||||
|
||||
if (gMailView.searchTerms.Count() == 1)
|
||||
document.getElementById("less0").setAttribute("disabled", "true");
|
||||
}
|
||||
else
|
||||
onMore(null, 0);
|
||||
onMore(null);
|
||||
|
||||
doEnabling();
|
||||
}
|
||||
|
@ -91,7 +88,9 @@ function onOK()
|
|||
if (gMailView)
|
||||
{
|
||||
saveSearchTerms(gMailView.searchTerms, gMailView);
|
||||
gMailView.mailViewName = dialog.nameField.value;
|
||||
// if the name of the view has been changed...
|
||||
if (gMailView.prettyName != dialog.nameField.value)
|
||||
gMailView.mailViewName = dialog.nameField.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -206,7 +206,7 @@ function refreshCustomMailViews(aDefaultSelectedIndex)
|
|||
for (var index = 0; index < numItems; index++)
|
||||
{
|
||||
newMenuItem = document.createElement('menuitem');
|
||||
newMenuItem.setAttribute('label', gMailViewList.getMailViewAt(index).mailViewName);
|
||||
newMenuItem.setAttribute('label', gMailViewList.getMailViewAt(index).prettyName);
|
||||
newMenuItem.setAttribute('id', "userdefinedview" + (kLastDefaultViewIndex + index));
|
||||
item = menupopupNode.insertBefore(newMenuItem, customNode);
|
||||
item.setAttribute('value', kLastDefaultViewIndex + index);
|
||||
|
|
|
@ -56,6 +56,7 @@ REQUIRES = xpcom \
|
|||
msgbaseutil \
|
||||
msgdb \
|
||||
mime \
|
||||
intl \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
|
|
|
@ -44,9 +44,14 @@
|
|||
#include "nsIFileSpec.h"
|
||||
#include "nsIMsgMailSession.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
|
||||
#define kDefaultViewPeopleIKnow "People I Know"
|
||||
#define kDefaultViewRecent "Recent Mail"
|
||||
#define kDefaultViewFiveDays "Last 5 Days"
|
||||
#define kDefaultViewNotJunk "Not Junk"
|
||||
#define kDefaultViewHasAttachments "Has Attachments"
|
||||
|
||||
nsMsgMailView::nsMsgMailView()
|
||||
{
|
||||
NS_NewISupportsArray(getter_AddRefs(mViewSearchTerms));
|
||||
|
@ -74,6 +79,37 @@ NS_IMETHODIMP nsMsgMailView::SetMailViewName(const PRUnichar * aMailViewName)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailView::GetPrettyName(PRUnichar ** aMailViewName)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (!mBundle)
|
||||
{
|
||||
nsCOMPtr<nsIStringBundleService> bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
bundleService->CreateBundle("chrome://messenger/locale/mailviews.properties",
|
||||
getter_AddRefs(mBundle));
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(mBundle, NS_ERROR_FAILURE);
|
||||
|
||||
// see if mName has an associated pretty name inside our string bundle and if so, use that as the pretty name
|
||||
// otherwise just return mName
|
||||
if (mName.EqualsLiteral(kDefaultViewPeopleIKnow))
|
||||
rv = mBundle->GetStringFromName(NS_LITERAL_STRING("mailViewPeopleIKnow").get(), aMailViewName);
|
||||
else if (mName.EqualsLiteral(kDefaultViewRecent))
|
||||
rv = mBundle->GetStringFromName(NS_LITERAL_STRING("mailViewRecentMail").get(), aMailViewName);
|
||||
else if (mName.EqualsLiteral(kDefaultViewFiveDays))
|
||||
rv = mBundle->GetStringFromName(NS_LITERAL_STRING("mailViewLastFiveDays").get(), aMailViewName);
|
||||
else if (mName.EqualsLiteral(kDefaultViewNotJunk))
|
||||
rv = mBundle->GetStringFromName(NS_LITERAL_STRING("mailViewNotJunk").get(), aMailViewName);
|
||||
else if (mName.EqualsLiteral(kDefaultViewHasAttachments))
|
||||
rv = mBundle->GetStringFromName(NS_LITERAL_STRING("mailViewHasAttachments").get(), aMailViewName);
|
||||
else
|
||||
*aMailViewName = ToNewUnicode(mName);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgMailView::GetSearchTerms(nsISupportsArray ** aSearchTerms)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSearchTerms);
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
#include "nsIMsgFilterList.h"
|
||||
|
||||
|
@ -59,6 +60,7 @@ public:
|
|||
|
||||
protected:
|
||||
nsString mName;
|
||||
nsCOMPtr<nsIStringBundle> mBundle;
|
||||
nsCOMPtr<nsISupportsArray> mViewSearchTerms;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче