39790: [L12y] Move all localizable prefs into chrome://.r=alecf.

This commit is contained in:
tao%netscape.com 2000-06-27 22:13:23 +00:00
Родитель 762d0b1cd8
Коммит c094568ffd
16 изменённых файлов: 92 добавлений и 118 удалений

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

@ -1421,8 +1421,8 @@ NS_IMETHODIMP GlobalWindowImpl::Home()
NS_ENSURE_TRUE(prefs, NS_ERROR_FAILURE); NS_ENSURE_TRUE(prefs, NS_ERROR_FAILURE);
// if we get here, we know prefs is not null // if we get here, we know prefs is not null
char *url = nsnull; nsXPIDLString url;
prefs->CopyCharPref(PREF_BROWSER_STARTUP_HOMEPAGE, &url); prefs->GetLocalizedUnicharPref(PREF_BROWSER_STARTUP_HOMEPAGE, getter_Copies(url));
nsString homeURL; nsString homeURL;
if(!url) if(!url)
{ {
@ -1433,8 +1433,7 @@ NS_IMETHODIMP GlobalWindowImpl::Home()
homeURL.AssignWithConversion(DEFAULT_HOME_PAGE); homeURL.AssignWithConversion(DEFAULT_HOME_PAGE);
} }
else else
homeURL.AssignWithConversion(url); homeURL = url;
PR_FREEIF(url);
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell)); nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE); NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(webNav->LoadURI(homeURL.GetUnicode()), NS_ERROR_FAILURE); NS_ENSURE_SUCCESS(webNav->LoadURI(homeURL.GetUnicode()), NS_ERROR_FAILURE);

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

@ -43,7 +43,7 @@ pref("editor.table.delete_key", 0);
pref("editor.prettyprint_html", 1); pref("editor.prettyprint_html", 1);
pref("editor.throbber.url","http://www.mozilla.org"); pref("editor.throbber.url","chrome://editor/locale/editor.properties");
pref("editor.auto_save", false); pref("editor.auto_save", false);
pref("editor.auto_save_delay", 10); // minutes pref("editor.auto_save_delay", 10); // minutes

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

@ -133,3 +133,7 @@ Click=Click
Drag=Drag Drag=Drag
Unknown=Unknown Unknown=Unknown
Close=Close Close=Close
#
# editor.js
#
editor.throbber.url=http://www.mozilla.org/

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

@ -1450,13 +1450,13 @@ HRESULT STDMETHODCALLTYPE CMozillaBrowser::GoHome(void)
// Find the home page stored in prefs // Find the home page stored in prefs
if (mPrefs) if (mPrefs)
{ {
char *szBuffer; nsXPIDLString szBuffer;
nsresult rv; nsresult rv;
rv = mPrefs->CopyCharPref(c_szPrefsHomePage, &szBuffer); rv = mPrefs->GetLocalizedUnicharPref(c_szPrefsHomePage, getter_Copies(szBuffer));
if (rv == NS_OK) if (rv == NS_OK)
{ {
USES_CONVERSION; USES_CONVERSION;
sUrl = A2OLE(szBuffer); sUrl = A2OLE(NS_ConvertUCS2toUTF8(szBuffer));
} }
} }
// Navigate to the home page // Navigate to the home page

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

@ -93,3 +93,8 @@ unsentFolderName=Unsent Messages
test1=The string (%S) is here! test1=The string (%S) is here!
# mailnews.js
messenger.throbber.url=http://www.mozilla.org/
compose.throbber.url=http://www.mozilla.org/
addressbook.throbber.url=http://www.mozilla.org/

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

@ -418,9 +418,9 @@ pref("mail.forward_message_mode", 0); // 0=default as attachment 2=forward as in
pref("mailnews.max_header_display_length",3); // number of addresses to show pref("mailnews.max_header_display_length",3); // number of addresses to show
pref("messenger.throbber.url","http://www.mozilla.org"); pref("messenger.throbber.url","chrome://messenger/locale/messenger.properties");
pref("compose.throbber.url","http://www.mozilla.org"); pref("compose.throbber.url","chrome://messenger/locale/messenger.properties");
pref("addressbook.throbber.url","http://www.mozilla.org"); pref("addressbook.throbber.url","chrome://messenger/locale/messenger.properties");
pref("mailnews.send_plaintext_flowed", true); // RFC 2646======= pref("mailnews.send_plaintext_flowed", true); // RFC 2646=======

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

@ -51,7 +51,7 @@ pref("general.fullcircle_collect_ns_data", false);
pref("browser.enable_style_sheets", true); pref("browser.enable_style_sheets", true);
// 0 = blank, 1 = home (browser.startup.homepage), 2 = last // 0 = blank, 1 = home (browser.startup.homepage), 2 = last
pref("browser.startup.page", 1); pref("browser.startup.page", 1);
pref("browser.startup.homepage", "http://www.mozilla.org/"); pref("browser.startup.homepage", "chrome://navigator/locale/navigator.properties");
// "browser.startup.homepage_override" was for 4.x // "browser.startup.homepage_override" was for 4.x
pref("browser.startup.homepage_override.1", true); pref("browser.startup.homepage_override.1", true);
pref("browser.startup.autoload_homepage", true); pref("browser.startup.autoload_homepage", true);
@ -568,4 +568,4 @@ pref("sidebar.customize.all_panels.url", "http://sidebar-rdf.netscape.com/%LOCAL
pref("prefs.converted-to-utf8",false); pref("prefs.converted-to-utf8",false);
pref("browser.throbber.url","http://www.mozilla.org/"); pref("browser.throbber.url","chrome://navigator/locale/navigator.properties");

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

@ -23,89 +23,8 @@
// Default configuration information for the client // Default configuration information for the client
// //
config("startup.homepage_override_url","http://www.mozilla.org/mozorg.html"); config("startup.homepage_override_url","chrome://navigator/locale/navigator.properties");
config("autoadmin.append_emailaddr",false); config("autoadmin.append_emailaddr",false);
config("autoadmin.failover_to_cached",true); config("autoadmin.failover_to_cached",true);
config("browser.chromeURL","chrome://navigator/content/navigator.xul"); config("browser.chromeURL","chrome://navigator/content/navigator.xul");
config("toolbar.logo.url","http://home.netscape.com/");
config("toolbar.logo.win_small_file","");
config("toolbar.logo.win_large_file","");
config("toolbar.logo.frames",-1);
config("toolbar.places.default_url","http://guide.netscape.com");
config("toolbar.places.item_0.label","The Internet");
config("toolbar.places.item_0.url","http://guide.netscape.com");
config("toolbar.places.item_1.label","People");
config("toolbar.places.item_1.url","http://guide.netscape.com/guide/people.html");
config("toolbar.places.item_2.label","Yellow Pages");
config("toolbar.places.item_2.url","http://guide.netscape.com/guide/yellow_pages.html");
config("toolbar.places.item_3.label","What's New");
config("toolbar.places.item_3.url","http://guide.netscape.com/guide/whats_new.html");
config("toolbar.places.item_4.label","What's Cool");
config("toolbar.places.item_4.url","http://guide.netscape.com/guide/whats_cool.html");
config("internal_url.net_search.url","http://home.netscape.com/home/internet-search.html");
config("internal_url.more_info_plugin.url","http://cgi.netscape.com/eng/mozilla/2.0/extensions/info.cgi");
config("internal_url.default_template.url","http://home.netscape.com/home/gold3.0_templates.html");
config("internal_url.page_from_wizard.url", "http://home.netscape.com/home/gold4.0_wizard.html");
config("menu.places.item_0.label","The &Internet");
config("menu.places.item_0.url","http://guide.netscape.com");
config("menu.places.item_1.label","&People");
config("menu.places.item_1.url","http://guide.netscape.com/guide/people.html");
config("menu.places.item_2.label","&Yellow Pages");
config("menu.places.item_2.url","http://guide.netscape.com/guide/yellow_pages.html");
config("menu.places.item_3.label","What's &New");
config("menu.places.item_3.url","http://guide.netscape.com/guide/whats_new.html");
config("menu.places.item_4.label","What's &Cool");
config("menu.places.item_4.url","http://guide.netscape.com/guide/whats_cool.html");
config("menu.help.item_0.label","&Help Contents");
config("menu.help.item_0.url","nethelp:netscape/home:start_here");
config("menu.help.item_1.label","&Release Notes");
config("menu.help.item_1.url","http://home.netscape.com/eng/mozilla/4.0/relnotes/windows-4.02.html");
config("menu.help.item_2.label","&Product Information and Support");
config("menu.help.item_2.url","http://home.netscape.com/menu/prodsupp/client/");
config("menu.help.item_3.label","-");
config("menu.help.item_4.label","&Software Updates");
config("menu.help.item_4.url","http://home.netscape.com/home/update.html");
config("menu.help.item_5.label","Register No&w");
config("menu.help.item_5.url","http://home.netscape.com/home/register.html");
config("menu.help.item_6.label","&Member Services");
config("menu.help.item_6.url","http://home.netscape.com/home/services.html");
config("menu.help.item_7.label","-");
config("menu.help.item_8.label","&International Users");
config("menu.help.item_8.url","http://home.netscape.com/menu/intl/");
config("menu.help.item_9.label","S&ecurity");
config("menu.help.item_9.url","http://home.netscape.com/info/security-doc.html");
config("menu.help.item_10.label","Net Etiq&uette");
config("menu.help.item_10.url","http://home.netscape.com/menu/netet/");
config("menu.help.item_11.label","-");
config("menu.help.item_12.label","Abou&t Plug-ins");
config("menu.help.item_12.url","about:plugins");
config("menu.help.item_13.label","About Font &Displayers");
config("menu.help.item_13.url","about:fonts");
config("personal_toolbar.item_0.label","Internet");
config("personal_toolbar.item_0.url","http://guide.netscape.com/?t");
config("personal_toolbar.item_1.label","Lookup");
config("personal_toolbar.item_1.url","FOLDER");
config("personal_toolbar.item_1.item_0.label","People");
config("personal_toolbar.item_1.item_0.url","http://guide.netscape.com/guide/people.html?t");
config("personal_toolbar.item_1.item_1.label","Yellow Pages");
config("personal_toolbar.item_1.item_1.url","http://guide.netscape.com/guide/yellow_pages.html?t");
config("personal_toolbar.item_2.label","New&Cool");
config("personal_toolbar.item_2.url","FOLDER");
config("personal_toolbar.item_2.item_0.label","What's New");
config("personal_toolbar.item_2.item_0.url","http://guide.netscape.com/guide/whats_new.html?t");
config("personal_toolbar.item_2.item_1.label","What's Cool");
config("personal_toolbar.item_2.item_1.url","http://guide.netscape.com/guide/whats_cool.html?t");
config("personal_toolbar.CreateNewToolbar", false);
config("personal_toolbar.NewToolbarFolderName", "");
config("personal_toolbar.ToolbarFolderVersion", "");

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

@ -43,7 +43,7 @@ pref("editor.table.delete_key", 0);
pref("editor.prettyprint_html", 1); pref("editor.prettyprint_html", 1);
pref("editor.throbber.url","http://www.mozilla.org"); pref("editor.throbber.url","chrome://editor/locale/editor.properties");
pref("editor.auto_save", false); pref("editor.auto_save", false);
pref("editor.auto_save_delay", 10); // minutes pref("editor.auto_save_delay", 10); // minutes

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

@ -418,9 +418,9 @@ pref("mail.forward_message_mode", 0); // 0=default as attachment 2=forward as in
pref("mailnews.max_header_display_length",3); // number of addresses to show pref("mailnews.max_header_display_length",3); // number of addresses to show
pref("messenger.throbber.url","http://www.mozilla.org"); pref("messenger.throbber.url","chrome://messenger/locale/messenger.properties");
pref("compose.throbber.url","http://www.mozilla.org"); pref("compose.throbber.url","chrome://messenger/locale/messenger.properties");
pref("addressbook.throbber.url","http://www.mozilla.org"); pref("addressbook.throbber.url","chrome://messenger/locale/messenger.properties");
pref("mailnews.send_plaintext_flowed", true); // RFC 2646======= pref("mailnews.send_plaintext_flowed", true); // RFC 2646=======

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

@ -311,17 +311,17 @@ nsresult nsPref::useLockPrefFile()
nsresult rv = NS_OK; nsresult rv = NS_OK;
PrefResult result = PREF_NOERROR; PrefResult result = PREF_NOERROR;
nsCOMPtr<nsIFileSpec> lockPrefFile; nsCOMPtr<nsIFileSpec> lockPrefFile;
nsXPIDLCString prefVal; nsXPIDLString prefVal;
nsXPIDLCString lockFileName; nsXPIDLCString lockFileName;
nsXPIDLCString lockVendor; nsXPIDLCString lockVendor;
char *return_error = nsnull; char *return_error = nsnull;
PRUint32 fileNameLen = 0; PRUint32 fileNameLen = 0;
PRUint32 vendorLen = 0; PRUint32 vendorLen = 0;
nsXPIDLCString configFile; nsXPIDLCString configFile;
if (NS_SUCCEEDED(rv = CopyCharPref("browser.startup.homepage", if (NS_SUCCEEDED(rv = GetLocalizedUnicharPref("browser.startup.homepage",
getter_Copies(prefVal)) && (prefVal))) getter_Copies(prefVal)) && (prefVal)))
{ {
printf("\nStartup homepage %s \n", (const char *)prefVal); printf("\nStartup homepage %s \n", (const char *)NS_ConvertUCS2toUTF8(prefVal));
} }
if (NS_SUCCEEDED(rv = CopyCharPref("general.config.filename", if (NS_SUCCEEDED(rv = CopyCharPref("general.config.filename",
@ -442,8 +442,8 @@ nsresult nsPref::useLockPrefFile()
JS_EndRequest(gMochaContext); JS_EndRequest(gMochaContext);
} }
} }
CopyCharPref("browser.startup.homepage",getter_Copies(prefVal)); GetLocalizedUnicharPref("browser.startup.homepage",getter_Copies(prefVal));
printf("\nStartup homepage %s \n", (const char *)prefVal); printf("\nStartup homepage %s \n", (const char *)NS_ConvertUCS2toUTF8(prefVal));
} }
return rv; return rv;
} // nsPref::useLockPrefFile } // nsPref::useLockPrefFile
@ -829,9 +829,33 @@ NS_IMETHODIMP nsPref::ClearUserPref(const char *pref_name)
/* /*
* Copy prefs * Copy prefs
*/ */
#if defined(DEBUG_tao_)
//3456789012345678901234567890123456789012 34567890123456789012345678901234567890
static const char strArr[][64] = {
"browser.startup.homepage",
"browser.throbber.url",
"startup.homepage_override_url",
NULL};
static void checkPref(const char* fname, const char* pref) {
int i=0;
nsCString cstr(strArr[i]);
while (cstr.Length()) {
if (pref == cstr) {
printf("\n --> %s:: SHALL use GetLocalizedUnicharPrefto get --%s--\n", fname, pref);
NS_ASSERTION(0, "\n\n");
return;
}
cstr = strArr[++i];
}
}
#endif
NS_IMETHODIMP nsPref::CopyCharPref(const char *pref, char ** return_buf) NS_IMETHODIMP nsPref::CopyCharPref(const char *pref, char ** return_buf)
{ {
#if defined(DEBUG_tao_)
checkPref("CopyCharPref", pref);
#endif
if (NS_FAILED(SecurePrefCheck(pref))) return NS_ERROR_FAILURE; if (NS_FAILED(SecurePrefCheck(pref))) return NS_ERROR_FAILURE;
return _convertRes(PREF_CopyCharPref(pref, return_buf, PR_FALSE)); return _convertRes(PREF_CopyCharPref(pref, return_buf, PR_FALSE));
} }
@ -845,6 +869,9 @@ static const PRUnichar unicodeFormatter[] = {
NS_IMETHODIMP nsPref::CopyUnicharPref(const char *pref, PRUnichar ** return_buf) NS_IMETHODIMP nsPref::CopyUnicharPref(const char *pref, PRUnichar ** return_buf)
{ {
#if defined(DEBUG_tao_)
checkPref("CopyUnicharPref", pref);
#endif
if (NS_FAILED(SecurePrefCheck(pref))) return NS_ERROR_FAILURE; if (NS_FAILED(SecurePrefCheck(pref))) return NS_ERROR_FAILURE;
nsresult rv; nsresult rv;
@ -861,6 +888,9 @@ nsPref::GetLocalizedUnicharPref(const char *pref, PRUnichar **return_buf)
{ {
nsresult rv; nsresult rv;
#if defined(DEBUG_tao_)
printf("\n --> nsPref::GetLocalizedUnicharPref(%s) --", pref);
#endif
// if the user has set this pref, then just return the user value // if the user has set this pref, then just return the user value
if (PREF_HasUserPref(pref)) if (PREF_HasUserPref(pref))
return CopyUnicharPref(pref, return_buf); return CopyUnicharPref(pref, return_buf);

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

@ -448,7 +448,7 @@ function Startup()
// set home button tooltip text // set home button tooltip text
var homepage; var homepage;
try { try {
homepage = pref.CopyUnicharPref("browser.startup.homepage"); homepage = pref.getLocalizedUnicharPref("browser.startup.homepage");
} }
catch(e) { catch(e) {
homepage = null; homepage = null;

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

@ -392,7 +392,7 @@ var homeButtonObserver = {
onDragStart: function () onDragStart: function ()
{ {
var homepage = nsPreferences.copyUnicharPref("browser.startup.homepage", "about:blank"); var homepage = nsPreferences.getLocalizedUnicharPref("browser.startup.homepage", "about:blank");
var flavourList = { }; var flavourList = { };
flavourList["text/unicode"] = { width: 2, data: homepage }; flavourList["text/unicode"] = { width: 2, data: homepage };
flavourList["text/x-moz-url"] = { width: 2, data: homepage }; flavourList["text/x-moz-url"] = { width: 2, data: homepage };

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

@ -19,4 +19,17 @@ droponhomemsg2=to be your new home page?
dontremindme=Always check when I drag an address to the Home button (This can also be set in the 'Navigator' category of Preferences) dontremindme=Always check when I drag an address to the Home button (This can also be set in the 'Navigator' category of Preferences)
droponhomeokbutton=Set Home Page droponhomeokbutton=Set Home Page
jserror=An error has occurred on this page. Double click here for details. jserror=An error has occurred on this page. Double click here for details.
#
# localizable preference value
#
# all.js
#
browser.startup.homepage=http://www.mozilla.org/
browser.throbber.url=http://www.mozilla.org/
#config.js
#
startup.homepage_override_url=http://www.mozilla.org/mozorg.html

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

@ -2089,7 +2089,7 @@ NS_IMETHODIMP nsBrowserContentHandler::GetDefaultArgs(PRUnichar **aDefaultArgs)
nsString args; nsString args;
nsresult rv; nsresult rv;
nsXPIDLCString url; nsXPIDLString url;
static PRBool timebombChecked = PR_FALSE; static PRBool timebombChecked = PR_FALSE;
if (timebombChecked == PR_FALSE) if (timebombChecked == PR_FALSE)
@ -2113,7 +2113,7 @@ NS_IMETHODIMP nsBrowserContentHandler::GetDefaultArgs(PRUnichar **aDefaultArgs)
rv = timeBomb->GetTimebombURL(&urlString); rv = timeBomb->GetTimebombURL(&urlString);
if ( NS_FAILED(rv) ) return rv; if ( NS_FAILED(rv) ) return rv;
*aDefaultArgs = NS_ConvertASCIItoUCS2(url).ToNewUnicode(); *aDefaultArgs = nsXPIDLString::Copy(url);
nsMemory::Free(urlString); nsMemory::Free(urlString);
return rv; return rv;
} }
@ -2130,23 +2130,27 @@ NS_IMETHODIMP nsBrowserContentHandler::GetDefaultArgs(PRUnichar **aDefaultArgs)
PRBool override = PR_FALSE; PRBool override = PR_FALSE;
rv = prefs->GetBoolPref(PREF_HOMEPAGE_OVERRIDE, &override); rv = prefs->GetBoolPref(PREF_HOMEPAGE_OVERRIDE, &override);
if (NS_SUCCEEDED(rv) && override) { if (NS_SUCCEEDED(rv) && override) {
rv = prefs->CopyCharPref(PREF_HOMEPAGE_OVERRIDE_URL, getter_Copies(url)); rv = prefs->GetLocalizedUnicharPref(PREF_HOMEPAGE_OVERRIDE_URL, getter_Copies(url));
if (NS_SUCCEEDED(rv) && (const char *)url) { if (NS_SUCCEEDED(rv) && (const PRUnichar *)url) {
rv = prefs->SetBoolPref(PREF_HOMEPAGE_OVERRIDE, PR_FALSE); rv = prefs->SetBoolPref(PREF_HOMEPAGE_OVERRIDE, PR_FALSE);
} }
} }
if (!((const char *)url) || (PL_strlen((const char *)url) == 0)) { nsAutoString tmp(url);
if (!url || !tmp.Length()) {
PRInt32 choice = 0; PRInt32 choice = 0;
rv = prefs->GetIntPref(PREF_BROWSER_STARTUP_PAGE, &choice); rv = prefs->GetIntPref(PREF_BROWSER_STARTUP_PAGE, &choice);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
switch (choice) { switch (choice) {
case 1: case 1:
rv = prefs->CopyCharPref(PREF_BROWSER_STARTUP_HOMEPAGE, getter_Copies(url)); rv = prefs->GetLocalizedUnicharPref(PREF_BROWSER_STARTUP_HOMEPAGE, getter_Copies(url));
tmp = url;
break; break;
case 2: case 2:
if (history) { if (history) {
rv = history->GetLastPageVisted(getter_Copies(url)); nsXPIDLCString curl;
rv = history->GetLastPageVisted(getter_Copies(curl));
tmp = NS_ConvertUTF8toUCS2((const char *)curl);
} }
break; break;
case 0: case 0:
@ -2157,8 +2161,8 @@ NS_IMETHODIMP nsBrowserContentHandler::GetDefaultArgs(PRUnichar **aDefaultArgs)
} }
} }
if (NS_SUCCEEDED(rv) && (const char *)url && (PL_strlen((const char *)url))) { if (NS_SUCCEEDED(rv) && tmp.Length()) {
args.AssignWithConversion((const char *) url); args = tmp;
} }
*aDefaultArgs = args.ToNewUnicode(); *aDefaultArgs = args.ToNewUnicode();

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

@ -122,7 +122,7 @@ function goClickThrobber( urlPref )
var pref = Components.classes["component://netscape/preferences"].getService(); var pref = Components.classes["component://netscape/preferences"].getService();
if( pref ) if( pref )
pref = pref.QueryInterface( Components.interfaces.nsIPref ); pref = pref.QueryInterface( Components.interfaces.nsIPref );
url = pref.CopyCharPref(urlPref); url = pref.getLocalizedUnicharPref(urlPref);
} }
catch(e) { catch(e) {