Bug 1357822 - Port bug 1356263: remove nsILocaleService/use of getApplicationLocale(); Port bug 1313625: add namespace to date/time format. r=aceman

This commit is contained in:
Jorg K 2017-08-04 23:16:12 +02:00
Родитель 2831e7c1c1
Коммит c88ad3df81
6 изменённых файлов: 28 добавлений и 50 удалений

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

@ -531,8 +531,8 @@ nsMsgFilter::LogRuleHitGeneric(nsIMsgRuleAction *aFilterAction,
PRExplodedTime exploded;
PR_ExplodeTime(date, PR_LocalTimeParameters, &exploded);
mozilla::DateTimeFormat::FormatPRExplodedTime(kDateFormatShort,
kTimeFormatSeconds,
mozilla::DateTimeFormat::FormatPRExplodedTime(mozilla::kDateFormatShort,
mozilla::kTimeFormatSeconds,
&exploded,
dateValue);
@ -646,8 +646,8 @@ nsMsgFilter::LogRuleHitGeneric(nsIMsgRuleAction *aFilterAction,
// Prepare timestamp
PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &exploded);
mozilla::DateTimeFormat::FormatPRExplodedTime(kDateFormatShort,
kTimeFormatSeconds,
mozilla::DateTimeFormat::FormatPRExplodedTime(mozilla::kDateFormatShort,
mozilla::kTimeFormatSeconds,
&exploded,
dateValue);

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

@ -68,9 +68,9 @@ char16_t * nsMsgDBView::kRepliedString = nullptr;
char16_t * nsMsgDBView::kForwardedString = nullptr;
char16_t * nsMsgDBView::kNewString = nullptr;
nsDateFormatSelector nsMsgDBView::m_dateFormatDefault = kDateFormatShort;
nsDateFormatSelector nsMsgDBView::m_dateFormatThisWeek = kDateFormatShort;
nsDateFormatSelector nsMsgDBView::m_dateFormatToday = kDateFormatNone;
mozilla::nsDateFormatSelector nsMsgDBView::m_dateFormatDefault = mozilla::kDateFormatShort;
mozilla::nsDateFormatSelector nsMsgDBView::m_dateFormatThisWeek = mozilla::kDateFormatShort;
mozilla::nsDateFormatSelector nsMsgDBView::m_dateFormatToday = mozilla::kDateFormatNone;
static const uint32_t kMaxNumSortColumns = 2;
@ -587,7 +587,7 @@ nsresult nsMsgDBView::FetchDate(nsIMsgDBHdr * aHdr, nsAString &aDateString, bool
// if the message is from the last week, show the day of the week. (i.e. Mon 3:15 pm)
// in all other cases, show the full date (03/19/01 3:15 pm)
nsDateFormatSelector dateFormat = m_dateFormatDefault;
mozilla::nsDateFormatSelector dateFormat = m_dateFormatDefault;
if (explodedCurrentTime.tm_year == explodedMsgTime.tm_year &&
explodedCurrentTime.tm_month == explodedMsgTime.tm_month &&
explodedCurrentTime.tm_mday == explodedMsgTime.tm_mday)
@ -623,7 +623,7 @@ nsresult nsMsgDBView::FetchDate(nsIMsgDBHdr * aHdr, nsAString &aDateString, bool
if (NS_SUCCEEDED(rv))
rv = mozilla::DateTimeFormat::FormatPRTime(dateFormat,
kTimeFormatNoSeconds,
mozilla::kTimeFormatNoSeconds,
dateOfMsg,
aDateString);
@ -7888,7 +7888,8 @@ nsMsgDBView::FindIndexOfMsgHdr(nsIMsgDBHdr *aMsgHdr, bool aExpand, nsMsgViewInde
return NS_OK;
}
static void getDateFormatPref( nsIPrefBranch* _prefBranch, const char* _prefLocalName, nsDateFormatSelector& _format )
static void
getDateFormatPref( nsIPrefBranch* _prefBranch, const char* _prefLocalName, mozilla::nsDateFormatSelector& _format )
{
// read
int32_t nFormatSetting( 0 );
@ -7896,18 +7897,19 @@ static void getDateFormatPref( nsIPrefBranch* _prefBranch, const char* _prefLoca
if ( NS_SUCCEEDED( result ) )
{
// translate
nsDateFormatSelector res( nFormatSetting );
mozilla::nsDateFormatSelector res;
res = static_cast<mozilla::nsDateFormatSelector>(nFormatSetting);
// transfer if valid
if ( ( res >= kDateFormatNone ) && ( res <= kDateFormatWeekday ) )
if ( ( res >= mozilla::kDateFormatNone ) && ( res <= mozilla::kDateFormatWeekday ) )
_format = res;
}
}
nsresult nsMsgDBView::InitDisplayFormats()
{
m_dateFormatDefault = kDateFormatShort;
m_dateFormatThisWeek = kDateFormatShort;
m_dateFormatToday = kDateFormatNone;
m_dateFormatDefault = mozilla::kDateFormatShort;
m_dateFormatThisWeek = mozilla::kDateFormatShort;
m_dateFormatToday = mozilla::kDateFormatNone;
nsresult rv = NS_OK;
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);

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

@ -478,9 +478,9 @@ protected:
static nsresult InitDisplayFormats();
private:
static nsDateFormatSelector m_dateFormatDefault;
static nsDateFormatSelector m_dateFormatThisWeek;
static nsDateFormatSelector m_dateFormatToday;
static mozilla::nsDateFormatSelector m_dateFormatDefault;
static mozilla::nsDateFormatSelector m_dateFormatThisWeek;
static mozilla::nsDateFormatSelector m_dateFormatToday;
bool ServerSupportsFilterAfterTheFact();
nsresult PerformActionsOnJunkMsgs(bool msgsAreJunk);

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

@ -649,8 +649,8 @@ NS_IMETHODIMP nsSpamSettings::LogJunkHit(nsIMsgDBHdr *aMsgHdr, bool aMoveMessage
PRExplodedTime exploded;
PR_ExplodeTime(date, PR_LocalTimeParameters, &exploded);
mozilla::DateTimeFormat::FormatPRExplodedTime(kDateFormatShort,
kTimeFormatSeconds,
mozilla::DateTimeFormat::FormatPRExplodedTime(mozilla::kDateFormatShort,
mozilla::kTimeFormatSeconds,
&exploded,
dateValue);
@ -721,8 +721,8 @@ NS_IMETHODIMP nsSpamSettings::LogJunkString(const char *string)
PRExplodedTime exploded;
PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &exploded);
mozilla::DateTimeFormat::FormatPRExplodedTime(kDateFormatShort,
kTimeFormatSeconds,
mozilla::DateTimeFormat::FormatPRExplodedTime(mozilla::kDateFormatShort,
mozilla::kTimeFormatSeconds,
&exploded,
dateValue);

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

@ -35,27 +35,13 @@ function StringBundle(url) {
}
StringBundle.prototype = {
/**
* the locale associated with the application
* @type nsILocale
* @private
*/
get _appLocale() {
try {
return Services.locale.getApplicationLocale();
}
catch(ex) {
return null;
}
},
/**
* the wrapped nsIStringBundle
* @type nsIStringBundle
* @private
*/
get _stringBundle() {
let stringBundle = Services.strings.createBundle(this.url, this._appLocale);
let stringBundle = Services.strings.createBundle(this.url);
this.__defineGetter__("_stringBundle", () => stringBundle);
return this._stringBundle;
},
@ -134,16 +120,6 @@ StringBundle.prototype = {
this.url = newVal;
},
/**
* the locale associated with the application
* @deprecated because it has never been used outside the XBL binding itself,
* and consumers should obtain it directly from the locale service anyway.
* @type nsILocale
*/
get appLocale() {
return this._appLocale;
},
/**
* the wrapped nsIStringBundle
* @deprecated because this module should provide all necessary functionality

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

@ -709,20 +709,20 @@ nsMimeBaseEmitter::GenerateDateString(const char * dateString,
// If we want short dates, check if the message is from today, and if so
// only show the time (e.g. 3:15 pm).
nsDateFormatSelector dateFormat = kDateFormatShort;
mozilla::nsDateFormatSelector dateFormat = mozilla::kDateFormatShort;
if (!showDateForToday &&
explodedCurrentTime.tm_year == explodedCompTime.tm_year &&
explodedCurrentTime.tm_month == explodedCompTime.tm_month &&
explodedCurrentTime.tm_mday == explodedCompTime.tm_mday)
{
// same day...
dateFormat = kDateFormatNone;
dateFormat = mozilla::kDateFormatNone;
}
nsAutoString formattedDateString;
rv = mozilla::DateTimeFormat::FormatPRExplodedTime(dateFormat,
kTimeFormatNoSeconds,
mozilla::kTimeFormatNoSeconds,
&explodedCompTime,
formattedDateString);