зеркало из https://github.com/mozilla/pjs.git
Bug #370537 --> add client support for a hosted first run and start page. Right now we use the local start page for both of these values. r=magnus. sr=bienvenu
This commit is contained in:
Родитель
13bf3e89cd
Коммит
77c8f61a23
|
@ -55,6 +55,10 @@ PREF_JS_EXPORTS = \
|
|||
$(srcdir)/profile/channel-prefs.js \
|
||||
$(NULL)
|
||||
|
||||
ifndef MOZ_BRANDING_DIRECTORY
|
||||
PREF_JS_EXPORTS += $(srcdir)/thunderbird-branding.js
|
||||
endif
|
||||
|
||||
ifeq ($(USE_SHORT_LIBNAME), 1)
|
||||
PROGRAM = thunderbird$(BIN_SUFFIX)
|
||||
else
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
pref("mailnews.start_page.url","chrome://messenger/content/start.xhtml");
|
||||
pref("mailnews.start_page.welcome_url","chrome://messenger/content/start.xhtml");
|
|
@ -258,15 +258,27 @@ function openRegionURL(aResourceName)
|
|||
*/
|
||||
function openFormattedRegionURL(aPrefName)
|
||||
{
|
||||
var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
|
||||
.getService(Components.interfaces.nsIURLFormatter);
|
||||
var formattedUrl = formatter.formatURLPref(aPrefName);
|
||||
var formattedUrl = getFormattedRegionURL(aPrefName);
|
||||
|
||||
var uri = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService)
|
||||
.newURI(formattedUrl, null, null);
|
||||
var uri = Components.classes["@mozilla.org/network/io-service;1"].
|
||||
getService(Components.interfaces.nsIIOService).
|
||||
newURI(formattedUrl, null, null);
|
||||
|
||||
var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
|
||||
.getService(Components.interfaces.nsIExternalProtocolService);
|
||||
var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"].
|
||||
getService(Components.interfaces.nsIExternalProtocolService);
|
||||
protocolSvc.loadUrl(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches the url for the passed in pref name and uses the URL formatter service to
|
||||
* process it.
|
||||
*
|
||||
* @param aPrefName - name of the pref that holds the url we want to format and open
|
||||
* @returns the formatted url string
|
||||
*/
|
||||
function getFormattedRegionURL(aPrefName)
|
||||
{
|
||||
var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"].
|
||||
getService(Components.interfaces.nsIURLFormatter);
|
||||
return formatter.formatURLPref(aPrefName);
|
||||
}
|
||||
|
|
|
@ -449,36 +449,50 @@ function StopUrls()
|
|||
msgWindow.StopUrls();
|
||||
}
|
||||
|
||||
/**
|
||||
* Every time the application version changes, we should load the welcome url for that version
|
||||
* instead of the usual start page.
|
||||
* @return true if we should use the welcome url
|
||||
*/
|
||||
function useWelcomeUrl()
|
||||
{
|
||||
var savedVersion = null;
|
||||
try {
|
||||
savedVersion = pref.getCharPref("mailnews.start_page_override.mstone");
|
||||
} catch (ex) {}
|
||||
|
||||
// ability to always bypass the welcome url
|
||||
if (savedVersion == "ignore")
|
||||
return false;
|
||||
|
||||
// look up the current version. Firefox uses the platform version it extracts from nsIHttpProtocolHandler.
|
||||
// Can we use an application version instead? For now, also use the platform version.
|
||||
var currentPlatformVersion = Components.classes["@mozilla.org/xre/app-info;1"].
|
||||
getService(Components.interfaces.nsIXULAppInfo).platformVersion;
|
||||
pref.setCharPref("mailnews.start_page_override.mstone", currentPlatformVersion);
|
||||
return currentPlatformVersion != savedVersion;
|
||||
}
|
||||
|
||||
function loadStartPage()
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
gMessageNotificationBar.clearMsgNotifications();
|
||||
|
||||
var startpageenabled = pref.getBoolPref("mailnews.start_page.enabled");
|
||||
if (startpageenabled)
|
||||
// only load the start page if we are online
|
||||
if (startpageenabled && MailOfflineMgr.isOnline())
|
||||
{
|
||||
|
||||
var startpage = pref.getComplexValue("mailnews.start_page.url", Components.interfaces.nsIPrefLocalizedString).data;
|
||||
|
||||
// Some users have our old default start page
|
||||
// showing up as a user pref instead of a default pref. If this is the case, clear the user pref by hand
|
||||
// and re-read it again so we get the correct default start page.
|
||||
if (startpage == "chrome://messenger/locale/start.html")
|
||||
{
|
||||
pref.clearUserPref("mailnews.start_page.url");
|
||||
startpage = pref.getComplexValue("mailnews.start_page.url", Components.interfaces.nsIPrefLocalizedString).data;
|
||||
}
|
||||
|
||||
if (startpage != "")
|
||||
var startpage = getFormattedRegionURL(useWelcomeUrl() ? "mailnews.start_page.welcome_url" :
|
||||
"mailnews.start_page.url");
|
||||
if (startpage)
|
||||
{
|
||||
GetMessagePaneFrame().location.href = startpage;
|
||||
//dump("start message pane with: " + startpage + "\n");
|
||||
ClearMessageSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ex)
|
||||
catch (ex)
|
||||
{
|
||||
dump("Error loading start page.\n");
|
||||
return;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
var gGeneralPane = {
|
||||
mPane: null,
|
||||
mStartPageUrl: "",
|
||||
|
||||
init: function ()
|
||||
{
|
||||
|
@ -91,17 +92,39 @@ var gGeneralPane = {
|
|||
document.getElementById("mailnewsStartPageUrl").disabled = !document.getElementById("mailnewsStartPageEnabled").checked;
|
||||
},
|
||||
|
||||
setHomePageToDefaultPage: function ()
|
||||
/**
|
||||
* Restores the default start page as the user's start page
|
||||
*/
|
||||
restoreDefaultStartPage: function()
|
||||
{
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
var pref = prefService.getDefaultBranch(null);
|
||||
var url = pref.getComplexValue("mailnews.start_page.url",
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
var startPageUrlField = document.getElementById("mailnewsStartPageUrl");
|
||||
startPageUrlField.value = url;
|
||||
|
||||
this.mPane.userChangedValue(startPageUrlField);
|
||||
var startPage = document.getElementById("mailnews.start_page.url");
|
||||
startPage.value = startPage.defaultValue;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a formatted url corresponding to the value of mailnews.start_page.url
|
||||
* Stores the original value of mailnews.start_page.url
|
||||
*/
|
||||
readStartPageUrl: function()
|
||||
{
|
||||
var pref = document.getElementById("mailnews.start_page.url");
|
||||
this.mStartPageUrl = pref.value;
|
||||
var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"].
|
||||
getService(Components.interfaces.nsIURLFormatter);
|
||||
return formatter.formatURL(this.mStartPageUrl);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the value of the mailnews start page url represented by the UI.
|
||||
* If the url matches the formatted version of our stored value, then
|
||||
* return the unformatted url.
|
||||
*/
|
||||
writeStartPageUrl: function()
|
||||
{
|
||||
var startPage = document.getElementById('mailnewsStartPageUrl');
|
||||
var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"].
|
||||
getService(Components.interfaces.nsIURLFormatter);
|
||||
return formatter.formatURL(this.mStartPageUrl) == startPage.value ? this.mStartPageUrl : startPage.value;
|
||||
},
|
||||
|
||||
customizeMailAlert: function()
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<preference id="mail.pane_config.dynamic" name="mail.pane_config.dynamic" type="int"/>
|
||||
<preference id="mailnews.reuse_message_window" name="mailnews.reuse_message_window" type="bool"/>
|
||||
<preference id="mailnews.start_page.enabled" name="mailnews.start_page.enabled" type="bool"/>
|
||||
<preference id="mailnews.start_page.url" name="mailnews.start_page.url" type="wstring"/>
|
||||
<preference id="mailnews.start_page.url" name="mailnews.start_page.url" type="string"/>
|
||||
<preference id="mail.biff.show_alert" name="mail.biff.show_alert" type="bool"/>
|
||||
<preference id="mail.biff.play_sound" name="mail.biff.play_sound" type="bool"/>
|
||||
<preference id="pref.general.disable_button.default_mail"
|
||||
|
@ -94,9 +94,11 @@
|
|||
</hbox>
|
||||
<hbox align="center">
|
||||
<label value="&location.label;" accesskey="&location1.accesskey;" control="mailnewsStartPageUrl"/>
|
||||
<textbox id="mailnewsStartPageUrl" flex="1" preference="mailnews.start_page.url"/>
|
||||
<textbox id="mailnewsStartPageUrl" flex="1" preference="mailnews.start_page.url"
|
||||
onsyncfrompreference="return gGeneralPane.readStartPageUrl();"
|
||||
onsynctopreference="return gGeneralPane.writeStartPageUrl();"/>
|
||||
<button label="&useDefault.label;" accesskey="&useDefault.accesskey;"
|
||||
oncommand="gGeneralPane.setHomePageToDefaultPage();">
|
||||
oncommand="gGeneralPane.restoreDefaultStartPage();">
|
||||
<observes element="mailnewsStartPageUrl" attribute="disabled"/>
|
||||
</button>
|
||||
</hbox>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#
|
||||
# messenger.properties
|
||||
# mailnews.js
|
||||
mailnews.start_page.url=chrome://messenger/content/start.xhtml
|
||||
mailnews.hints_and_tips.url=http://www.mozilla.org/support/thunderbird/
|
||||
|
||||
# To make mapit buttons to disappear in the addressbook, specify empty string. For example:
|
||||
|
|
|
@ -171,6 +171,7 @@ pref("mail.show_headers", 1); // some
|
|||
pref("mail.pane_config", 0);
|
||||
pref("mail.addr_book.mapit_url.format", "chrome://messenger-region/locale/region.properties");
|
||||
#ifdef MOZ_SUITE
|
||||
pref("mailnews.start_page.url", "chrome://messenger-region/locale/region.properties");
|
||||
pref("mail.addr_book.im.onlineCheckAllowed", false);
|
||||
pref("messenger.throbber.url","chrome://messenger-region/locale/region.properties");
|
||||
pref("compose.throbber.url","chrome://messenger-region/locale/region.properties");
|
||||
|
@ -395,7 +396,6 @@ pref("mailnews.reuse_message_window", true);
|
|||
pref("mailnews.reuse_thread_window2", false);
|
||||
pref("mailnews.open_window_warning", 10); // warn user if they attempt to open more than this many messages at once
|
||||
|
||||
pref("mailnews.start_page.url", "chrome://messenger-region/locale/region.properties");
|
||||
pref("mailnews.start_page.enabled", true);
|
||||
|
||||
pref("mailnews.remember_selected_message", true);
|
||||
|
|
|
@ -15,6 +15,8 @@ DIRS = \
|
|||
locales \
|
||||
$(NULL)
|
||||
|
||||
PREF_JS_EXPORTS = $(srcdir)/thunderbird-branding.js
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
MAIL_APP_FILES = \
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
pref("mailnews.start_page.url","chrome://messenger/content/start.xhtml");
|
||||
pref("mailnews.start_page.welcome_url","chrome://messenger/content/start.xhtml");
|
Загрузка…
Ссылка в новой задаче