From a9fd87805a740b80cde74235b22f71d526195309 Mon Sep 17 00:00:00 2001 From: "masayuki@d-toybox.com" Date: Wed, 9 Apr 2008 10:35:30 -0700 Subject: [PATCH] Bug 411854 directory list should use localized ellipsis p=Masahiro Yamada r=bzbarsky a1.9=beltzner --- .../streamconv/converters/nsIndexedToHTML.cpp | 25 +++++++++++++++++-- .../streamconv/converters/nsIndexedToHTML.h | 1 + 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/netwerk/streamconv/converters/nsIndexedToHTML.cpp b/netwerk/streamconv/converters/nsIndexedToHTML.cpp index 03d3f89064b2..c4070b9e856c 100644 --- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp +++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp @@ -50,6 +50,9 @@ #include "nsURLHelper.h" #include "nsCRT.h" #include "nsIPlatformCharset.h" +#include "nsIPrefService.h" +#include "nsIPrefBranch.h" +#include "nsIPrefLocalizedString.h" NS_IMPL_ISUPPORTS4(nsIndexedToHTML, nsIDirIndexListener, @@ -93,6 +96,22 @@ nsIndexedToHTML::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) { nsresult nsIndexedToHTML::Init(nsIStreamListener* aListener) { + + nsXPIDLString ellipsis; + nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefs) { + nsCOMPtr prefVal; + prefs->GetComplexValue("intl.ellipsis", + NS_GET_IID(nsIPrefLocalizedString), + getter_AddRefs(prefVal)); + if (prefVal) + prefVal->ToString(getter_Copies(ellipsis)); + } + if (ellipsis.IsEmpty()) + mEscapedEllipsis.AppendLiteral("…"); + else + mEscapedEllipsis.Adopt(nsEscapeHTML2(ellipsis.get(), ellipsis.Length())); + nsresult rv = NS_OK; mListener = aListener; @@ -824,8 +843,10 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest, description.Truncate(description.Length() - 1); escapedShort.Adopt(nsEscapeHTML2(description.get(), description.Length())); - // add HORIZONTAL ELLIPSIS (U+2026) and ZERO WIDTH SPACE (U+200B) for wrapping - escapedShort.AppendLiteral("…​"); + + escapedShort.Append(mEscapedEllipsis); + // add ZERO WIDTH SPACE (U+200B) for wrapping + escapedShort.AppendLiteral("​"); nsString tmp; tmp.Adopt(nsEscapeHTML2(descriptionAffix.get(), descriptionAffix.Length())); escapedShort.Append(tmp); diff --git a/netwerk/streamconv/converters/nsIndexedToHTML.h b/netwerk/streamconv/converters/nsIndexedToHTML.h index 0835f31883a4..4001c9f77947 100644 --- a/netwerk/streamconv/converters/nsIndexedToHTML.h +++ b/netwerk/streamconv/converters/nsIndexedToHTML.h @@ -91,6 +91,7 @@ protected: private: // Expecting absolute locations, given by 201 lines. PRBool mExpectAbsLoc; + nsString mEscapedEllipsis; }; #endif