Bug #289197 --> When opening offline settings, we should bring up the options dialog, select the advanced

pane and then select the offline settings tab in that pane.
This commit is contained in:
scott%scott-macgregor.org 2005-06-22 18:16:28 +00:00
parent 82535db879
commit f895d1b674
6 changed files with 30 additions and 13 deletions

View File

@ -138,7 +138,8 @@ function CheckOnline()
return true;
}
function openOptionsDialog(containerID, paneURL, itemID)
// aPaneID
function openOptionsDialog(aPaneID, aTabID)
{
var prefsService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch(null)
var instantApply = prefsService.getBoolPref("browser.preferences.instantApply");
@ -149,9 +150,20 @@ function openOptionsDialog(containerID, paneURL, itemID)
var win = wm.getMostRecentWindow("Mail:Preferences");
if (win)
{
win.focus();
if (aPaneID)
{
var pane = win.document.getElementById(aPaneID);
win.document.documentElement.showPane(pane);
// I don't know how to support aTabID for an arbitrary panel when the dialog is already open
// This is complicated because showPane is asynchronous (it could trigger a dynamic overlay)
// so our tab element may not be accessible right away...
}
}
else
openDialog("chrome://messenger/content/preferences/preferences.xul","Preferences", features);
openDialog("chrome://messenger/content/preferences/preferences.xul","Preferences", features, aPaneID, aTabID);
}
function openExtensions(aOpenMode)

View File

@ -324,7 +324,7 @@
#ifndef XP_MACOSX
<menuseparator id="prefSep"/>
<menuitem id="menu_preferences" label="&preferencesCmdUnix.label;" accesskey="&preferencesCmdUnix.accesskey;"
oncommand="openOptionsDialog('mailnews', 'chrome://messenger/content/addressbook/pref-addressing.xul', 'mailaddressbookpref')"/>
oncommand="openOptionsDialog()"/>
#endif
#endif
</menupopup>
@ -463,11 +463,11 @@
#ifndef XP_UNIX
<menuseparator id="prefSep"/>
<menuitem id="menu_preferences" label="&preferencesCmd.label;" accesskey="&preferencesCmd.accesskey;"
oncommand="openOptionsDialog('mailnews', 'chrome://messenger/content/addressbook/pref-addressing.xul', 'mailaddressbookpref')"/>
oncommand="openOptionsDialog()"/>
#else
#ifdef XP_MACOSX
<menuitem id="menu_preferences" label="&preferencesCmd.label;" accesskey="&preferencesCmd.accesskey;"
oncommand="openOptionsDialog('mailnews', 'chrome://messenger/content/addressbook/pref-addressing.xul', 'mailaddressbookpref')"/>
oncommand="openOptionsDialog()"/>
#endif
#endif
</menupopup>

View File

@ -355,7 +355,7 @@
<menuseparator id="prefSep"/>
<menuitem label="&accountManagerCmd.label;" accesskey="&accountManagerCmdUnix.accesskey;" command="cmd_account"/>
<menuitem id="menu_preferences" label="&preferencesCmdUnix.label;" accesskey="&preferencesCmdUnix.accesskey;"
oncommand="openOptionsDialog('mailcomposepref', 'chrome://messenger/content/messengercompose/pref-composing_messages.xul', 'mailcomposepref');"/>
oncommand="openOptionsDialog('paneCompose');"/>
#endif
#endif
</menupopup>
@ -512,12 +512,12 @@
<menuseparator id="prefSep"/>
<menuitem label="&accountManagerCmd.label;" accesskey="&accountManagerCmd.accesskey;" command="cmd_account"/>
<menuitem id="menu_preferences" label="&preferencesCmd.label;" accesskey="&preferencesCmd.accesskey;"
oncommand="openOptionsDialog('mailcomposepref', 'chrome://messenger/content/messengercompose/pref-composing_messages.xul', 'mailcomposepref');"/>
oncommand="openOptionsDialog('paneCompose');"/>
#else
#ifdef XP_MACOSX
<menuitem label="&accountManagerCmd.label;" accesskey="&accountManagerCmd.accesskey;" command="cmd_account"/>
<menuitem id="menu_preferences" label="&preferencesCmd.label;" accesskey="&preferencesCmd.accesskey;"
oncommand="openOptionsDialog('mailcomposepref', 'chrome://messenger/content/messengercompose/pref-composing_messages.xul', 'mailcomposepref');"/>
oncommand="openOptionsDialog('paneCompose');"/>
#endif
#endif
</menupopup>

View File

@ -43,9 +43,14 @@ var gAdvancedPane = {
this.mPane = document.getElementById("paneAdvanced");
this.updateMarkAsReadTextbox(false);
var preference = document.getElementById("mail.preferences.advanced.selectedTabIndex");
if (preference.value)
document.getElementById("advancedPrefs").selectedIndex = preference.value;
if ("arguments" in window && window.arguments[1] && document.getElementById(window.arguments[1]))
document.getElementById("advancedPrefs").selectedTab = document.getElementById(window.arguments[1]);
else
{
var preference = document.getElementById("mail.preferences.advanced.selectedTabIndex");
if (preference.value)
document.getElementById("advancedPrefs").selectedIndex = preference.value;
}
this.mInitialized = true;
},

View File

@ -73,7 +73,7 @@
<tabbox id="advancedPrefs" flex="1" onselect="gAdvancedPane.tabSelectionChanged();">
<tabs>
<tab label="&itemGeneral.label;"/>
<tab label="&itemOffline.label;"/>
<tab id="offlineTab" label="&itemOffline.label;"/>
<tab label="&itemUpdate.label;"/>
</tabs>

View File

@ -63,7 +63,7 @@
<menuitem id="offlineGoOfflineCmd"/>
<menuseparator/>
<menuitem label="&synchronizeOfflineCmd.label;" accesskey="&synchronizeOfflineCmd.accesskey;" observes="cmd_synchronizeOffline"/>
<menuitem label="&settingsOfflineCmd.label;" accesskey="&settingsOfflineCmd.accesskey;" oncommand="openOptionsDialog();"/>
<menuitem label="&settingsOfflineCmd.label;" accesskey="&settingsOfflineCmd.accesskey;" oncommand="openOptionsDialog('paneAdvanced', 'offlineTab');"/>
<menuseparator/>
<menuitem label="&downloadFlaggedCmd.label;" accesskey="&downloadFlaggedCmd.accesskey;" observes="cmd_downloadFlagged"/>
<menuitem label="&downloadSelectedCmd.label;" accesskey="&downloadSelectedCmd.accesskey;" observes="cmd_downloadSelected"/>