Bug 878805 - Check UI consistency across all Thunderbird folderpickers - Part 2. r=squib, ui-r=richard.marti
This commit is contained in:
Родитель
e05e22ec36
Коммит
41de9a5dae
|
@ -11,6 +11,7 @@ Components.utils.import("resource://gre/modules/Services.jsm");
|
||||||
let gFilterListMsgWindow = null;
|
let gFilterListMsgWindow = null;
|
||||||
let gCurrentFilterList;
|
let gCurrentFilterList;
|
||||||
let gCurrentFolder;
|
let gCurrentFolder;
|
||||||
|
let gSelectedFolder;
|
||||||
|
|
||||||
let gFilterListbox = null;
|
let gFilterListbox = null;
|
||||||
let gEditButton = null;
|
let gEditButton = null;
|
||||||
|
@ -112,19 +113,25 @@ function onLoad()
|
||||||
|
|
||||||
updateButtons();
|
updateButtons();
|
||||||
|
|
||||||
|
// Get the folderpane selected folder, if there is one.
|
||||||
|
try {
|
||||||
|
gSelectedFolder = window.arguments[0].folder;
|
||||||
|
} catch(e) {
|
||||||
|
gSelectedFolder = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the folder where filters should be defined, if that server
|
// Get the folder where filters should be defined, if that server
|
||||||
// can accept filters.
|
// can accept filters.
|
||||||
let firstItem = getFilterFolderForSelection();
|
let firstItem = getFilterFolderForSelection(gSelectedFolder);
|
||||||
|
|
||||||
// If the selected server cannot have filters, get the default server
|
// If the selected server cannot have filters, get the default server
|
||||||
// If the default server cannot have filters, check all accounts
|
// If the default server cannot have filters, check all accounts
|
||||||
// and get a server that can have filters.
|
// and get a server that can have filters.
|
||||||
if (!firstItem)
|
if (!firstItem)
|
||||||
firstItem = getServerThatCanHaveFilters().rootFolder;
|
firstItem = getServerThatCanHaveFilters().rootFolder;
|
||||||
|
|
||||||
if (firstItem) {
|
if (firstItem)
|
||||||
selectFolder(firstItem);
|
selectFolder(firstItem);
|
||||||
}
|
|
||||||
|
|
||||||
Services.obs.addObserver(filterEditorQuitObserver,
|
Services.obs.addObserver(filterEditorQuitObserver,
|
||||||
"quit-application-requested", false);
|
"quit-application-requested", false);
|
||||||
|
@ -161,6 +168,10 @@ function onFilterFolderClick(aFolder)
|
||||||
// the dialog may be closed and we'll lose current filters.
|
// the dialog may be closed and we'll lose current filters.
|
||||||
gCurrentFilterList.saveToDefaultFile();
|
gCurrentFilterList.saveToDefaultFile();
|
||||||
|
|
||||||
|
// Initial selected folder no longer applies, use getFirstFolder() logic,
|
||||||
|
// unless it's nntp where we can use the subscribed newsgroup.
|
||||||
|
gSelectedFolder = aFolder.server.type == "nntp" ? aFolder : null;
|
||||||
|
|
||||||
selectFolder(aFolder);
|
selectFolder(aFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +222,7 @@ function setFolder(msgFolder)
|
||||||
// Get the first folder for this server. INBOX for
|
// Get the first folder for this server. INBOX for
|
||||||
// IMAP and POP3 accounts and 1st news group for news.
|
// IMAP and POP3 accounts and 1st news group for news.
|
||||||
gRunFiltersFolder.selectedIndex = 0;
|
gRunFiltersFolder.selectedIndex = 0;
|
||||||
runMenu.selectFolder(getFirstFolder(msgFolder));
|
runMenu.selectFolder(getFirstFolder(gSelectedFolder || msgFolder));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,14 +245,12 @@ function toggleFilter(aFilterItem)
|
||||||
aFilterItem.childNodes[1].setAttribute("enabled", filter.enabled);
|
aFilterItem.childNodes[1].setAttribute("enabled", filter.enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets up the menulist and the filter list
|
// update the server menulist
|
||||||
function selectFolder(aFolder)
|
function selectFolder(aFolder)
|
||||||
{
|
{
|
||||||
// update the server menu
|
var serverMenu = document.getElementById("serverMenuPopup");
|
||||||
var serverMenu = document.getElementById("serverMenuPopup");
|
serverMenu.selectFolder(aFolder);
|
||||||
serverMenu.selectFolder(aFolder);
|
setFolder(aFolder);
|
||||||
|
|
||||||
setFolder(aFolder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -708,32 +717,16 @@ function updateButtons()
|
||||||
* be defined (the root folder except for news) if the server can
|
* be defined (the root folder except for news) if the server can
|
||||||
* accept filters.
|
* accept filters.
|
||||||
*
|
*
|
||||||
|
* @param nsIMsgFolder aFolder - selected folder, from window args
|
||||||
* @returns an nsIMsgFolder where the filter is defined
|
* @returns an nsIMsgFolder where the filter is defined
|
||||||
*/
|
*/
|
||||||
function getFilterFolderForSelection()
|
function getFilterFolderForSelection(aFolder)
|
||||||
{
|
{
|
||||||
var args = window.arguments;
|
let rootFolder = aFolder && aFolder.server ? aFolder.server.rootFolder : null;
|
||||||
|
if (rootFolder && rootFolder.isServer && rootFolder.server.canHaveFilters)
|
||||||
|
return (aFolder.server.type == "nntp") ? aFolder : rootFolder;
|
||||||
|
|
||||||
if (args && args[0] && args[0].folder)
|
return null;
|
||||||
{
|
|
||||||
var selectedFolder = args[0].folder;
|
|
||||||
var msgFolder = selectedFolder.QueryInterface(Components.interfaces.nsIMsgFolder);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var rootFolder = msgFolder.server.rootFolder;
|
|
||||||
if (rootFolder.isServer)
|
|
||||||
{
|
|
||||||
var server = rootFolder.server;
|
|
||||||
if (server.canHaveFilters)
|
|
||||||
return (server.type == "nntp") ? msgFolder : rootFolder;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (ex)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -823,35 +816,35 @@ function onFilterListKeyPress(aEvent)
|
||||||
|
|
||||||
function onTargetSelect(event) {
|
function onTargetSelect(event) {
|
||||||
gRunFiltersFolder._folder = event.target._folder;
|
gRunFiltersFolder._folder = event.target._folder;
|
||||||
let runMenu = document.getElementById("runFiltersPopup");
|
gRunFiltersFolder.menupopup.selectFolder(gRunFiltersFolder._folder);
|
||||||
runMenu.selectFolder(gRunFiltersFolder._folder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For a given server folder, get the first folder. For imap and pop it's INBOX
|
* For a given server folder, get the default run target selected folder or show
|
||||||
* and it's the very first group for news accounts.
|
* Choose Folder.
|
||||||
*/
|
*/
|
||||||
function getFirstFolder(msgFolder)
|
function getFirstFolder(msgFolder)
|
||||||
{
|
{
|
||||||
// Sanity check.
|
// Sanity check.
|
||||||
if (! msgFolder.isServer)
|
if (!msgFolder.isServer)
|
||||||
return msgFolder;
|
return msgFolder;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Find Inbox for imap and pop
|
// Choose Folder for feeds.
|
||||||
|
if (msgFolder.server.type == "rss")
|
||||||
|
return null;
|
||||||
|
|
||||||
if (msgFolder.server.type != "nntp")
|
if (msgFolder.server.type != "nntp")
|
||||||
{
|
{
|
||||||
|
// Find Inbox for imap and pop; show Choose Folder if not found or
|
||||||
|
// Local Folders or any other account type.
|
||||||
const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
|
const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
|
||||||
var inboxFolder = msgFolder.getFolderWithFlags(nsMsgFolderFlags.Inbox);
|
// If inbox does not exist then return null.
|
||||||
if (inboxFolder)
|
return msgFolder.getFolderWithFlags(nsMsgFolderFlags.Inbox);
|
||||||
return inboxFolder;
|
|
||||||
else
|
|
||||||
// If inbox does not exist then use the server as default.
|
|
||||||
return msgFolder;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
// XXX TODO: For news, we should find the 1st group/folder off the news groups. For now use server.
|
// For news, this is the account folder.
|
||||||
return msgFolder;
|
return msgFolder;
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
dump(ex + "\n");
|
dump(ex + "\n");
|
||||||
|
|
|
@ -130,7 +130,8 @@
|
||||||
accesskey="&folderPickerPrefix.accesskey;"
|
accesskey="&folderPickerPrefix.accesskey;"
|
||||||
disabled="true" control="runFiltersFolder"/>
|
disabled="true" control="runFiltersFolder"/>
|
||||||
<menulist id="runFiltersFolder" disabled="true" flex="1"
|
<menulist id="runFiltersFolder" disabled="true" flex="1"
|
||||||
class="folderMenuItem">
|
class="folderMenuItem"
|
||||||
|
displayformat="verbose">
|
||||||
<menupopup id="runFiltersPopup"
|
<menupopup id="runFiltersPopup"
|
||||||
class="menulist-menupopup"
|
class="menulist-menupopup"
|
||||||
type="folder"
|
type="folder"
|
||||||
|
|
|
@ -787,8 +787,6 @@
|
||||||
mode="filing"
|
mode="filing"
|
||||||
showFileHereLabel="true"
|
showFileHereLabel="true"
|
||||||
showRecent="true"
|
showRecent="true"
|
||||||
fileHereLabel="&fileHereMenu.label;"
|
|
||||||
fileHereAccessKey="&fileHereMenu.accesskey;"
|
|
||||||
recentLabel="&contextMoveCopyMsgRecentMenu.label;"
|
recentLabel="&contextMoveCopyMsgRecentMenu.label;"
|
||||||
recentAccessKey="&contextMoveCopyMsgRecentMenu.accesskey;"/>
|
recentAccessKey="&contextMoveCopyMsgRecentMenu.accesskey;"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -801,8 +799,6 @@
|
||||||
mode="filing"
|
mode="filing"
|
||||||
showFileHereLabel="true"
|
showFileHereLabel="true"
|
||||||
showRecent="true"
|
showRecent="true"
|
||||||
fileHereLabel="©HereMenu.label;"
|
|
||||||
fileHereAccessKey="©HereMenu.accesskey;"
|
|
||||||
recentLabel="&contextMoveCopyMsgRecentMenu.label;"
|
recentLabel="&contextMoveCopyMsgRecentMenu.label;"
|
||||||
recentAccessKey="&contextMoveCopyMsgRecentMenu.accesskey;"/>
|
recentAccessKey="&contextMoveCopyMsgRecentMenu.accesskey;"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -1884,7 +1880,6 @@
|
||||||
<menupopup id="appmenu_GoFolderPopup"
|
<menupopup id="appmenu_GoFolderPopup"
|
||||||
type="folder"
|
type="folder"
|
||||||
showFileHereLabel="true"
|
showFileHereLabel="true"
|
||||||
fileHereLabel="&thisFolder.label;"
|
|
||||||
showRecent="true"
|
showRecent="true"
|
||||||
recentLabel="&contextMoveCopyMsgRecentMenu.label;"/>
|
recentLabel="&contextMoveCopyMsgRecentMenu.label;"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -2053,7 +2048,6 @@
|
||||||
mode="filing"
|
mode="filing"
|
||||||
showFileHereLabel="true"
|
showFileHereLabel="true"
|
||||||
showRecent="true"
|
showRecent="true"
|
||||||
fileHereLabel="&fileHereMenu.label;"
|
|
||||||
recentLabel="&moveCopyMsgRecentMenu.label;"/>
|
recentLabel="&moveCopyMsgRecentMenu.label;"/>
|
||||||
</menu>
|
</menu>
|
||||||
<menu id="appmenu_copyMenu"
|
<menu id="appmenu_copyMenu"
|
||||||
|
@ -2063,7 +2057,6 @@
|
||||||
mode="filing"
|
mode="filing"
|
||||||
showFileHereLabel="true"
|
showFileHereLabel="true"
|
||||||
showRecent="true"
|
showRecent="true"
|
||||||
fileHereLabel="©HereMenu.label;"
|
|
||||||
recentLabel="&moveCopyMsgRecentMenu.label;"/>
|
recentLabel="&moveCopyMsgRecentMenu.label;"/>
|
||||||
</menu>
|
</menu>
|
||||||
<menuitem id="appmenu_moveToFolderAgain"
|
<menuitem id="appmenu_moveToFolderAgain"
|
||||||
|
@ -2681,8 +2674,6 @@
|
||||||
<menupopup id="menu_GoFolderPopup"
|
<menupopup id="menu_GoFolderPopup"
|
||||||
type="folder"
|
type="folder"
|
||||||
showFileHereLabel="true"
|
showFileHereLabel="true"
|
||||||
fileHereLabel="&thisFolder.label;"
|
|
||||||
fileHereAccessKey="&thisFolder.accesskey;"
|
|
||||||
showRecent="true"
|
showRecent="true"
|
||||||
recentLabel="&contextMoveCopyMsgRecentMenu.label;"
|
recentLabel="&contextMoveCopyMsgRecentMenu.label;"
|
||||||
recentAccessKey="&contextMoveCopyMsgRecentMenu.accesskey;"/>
|
recentAccessKey="&contextMoveCopyMsgRecentMenu.accesskey;"/>
|
||||||
|
@ -2857,9 +2848,9 @@
|
||||||
label="&moveMsgToMenu.label;"
|
label="&moveMsgToMenu.label;"
|
||||||
accesskey="&moveMsgToMenu.accesskey;"
|
accesskey="&moveMsgToMenu.accesskey;"
|
||||||
oncommand="MsgMoveMessage(event.target._folder)">
|
oncommand="MsgMoveMessage(event.target._folder)">
|
||||||
<menupopup type="folder" mode="filing" showFileHereLabel="true"
|
<menupopup type="folder" mode="filing"
|
||||||
showRecent="true" fileHereLabel="&fileHereMenu.label;"
|
showFileHereLabel="true"
|
||||||
fileHereAccessKey="&fileHereMenu.accesskey;"
|
showRecent="true"
|
||||||
recentLabel="&moveCopyMsgRecentMenu.label;"
|
recentLabel="&moveCopyMsgRecentMenu.label;"
|
||||||
recentAccessKey="&moveCopyMsgRecentMenu.accesskey;"/>
|
recentAccessKey="&moveCopyMsgRecentMenu.accesskey;"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -2867,9 +2858,9 @@
|
||||||
label="©MsgToMenu.label;"
|
label="©MsgToMenu.label;"
|
||||||
accesskey="©MsgToMenu.accesskey;"
|
accesskey="©MsgToMenu.accesskey;"
|
||||||
oncommand="MsgCopyMessage(event.target._folder)">
|
oncommand="MsgCopyMessage(event.target._folder)">
|
||||||
<menupopup type="folder" mode="filing" showFileHereLabel="true"
|
<menupopup type="folder" mode="filing"
|
||||||
showRecent="true" fileHereLabel="©HereMenu.label;"
|
showFileHereLabel="true"
|
||||||
fileHereAccessKey="©HereMenu.accesskey;"
|
showRecent="true"
|
||||||
recentLabel="&moveCopyMsgRecentMenu.label;"
|
recentLabel="&moveCopyMsgRecentMenu.label;"
|
||||||
recentAccessKey="&moveCopyMsgRecentMenu.accesskey;"/>
|
recentAccessKey="&moveCopyMsgRecentMenu.accesskey;"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -3088,8 +3079,6 @@
|
||||||
mode="filing"
|
mode="filing"
|
||||||
showRecent="true"
|
showRecent="true"
|
||||||
showFileHereLabel="true"
|
showFileHereLabel="true"
|
||||||
fileHereLabel="&fileHereMenu.label;"
|
|
||||||
fileHereAccessKey="&fileHereMenu.accesskey;"
|
|
||||||
recentLabel="&moveCopyMsgRecentMenu.label;"
|
recentLabel="&moveCopyMsgRecentMenu.label;"
|
||||||
recentAccessKey="&moveCopyMsgRecentMenu.accesskey;"/>
|
recentAccessKey="&moveCopyMsgRecentMenu.accesskey;"/>
|
||||||
</toolbarbutton>
|
</toolbarbutton>
|
||||||
|
|
|
@ -5,3 +5,7 @@
|
||||||
# LOCALIZATION NOTE(globalInbox)
|
# LOCALIZATION NOTE(globalInbox)
|
||||||
# %S=name of the Local folders account
|
# %S=name of the Local folders account
|
||||||
globalInbox=Global Inbox (%S)
|
globalInbox=Global Inbox (%S)
|
||||||
|
# LOCALIZATION NOTE(verboseFolderFormat): %1$S is folder name, %2$S is server name
|
||||||
|
verboseFolderFormat=%1$S on %2$S
|
||||||
|
chooseFolder=Choose Folder…
|
||||||
|
noFolders=No available folders
|
||||||
|
|
|
@ -313,8 +313,6 @@
|
||||||
<!ENTITY prevStarredMsgCmd.accesskey "S">
|
<!ENTITY prevStarredMsgCmd.accesskey "S">
|
||||||
<!ENTITY folderMenu.label "Folder">
|
<!ENTITY folderMenu.label "Folder">
|
||||||
<!ENTITY folderMenu.accesskey "O">
|
<!ENTITY folderMenu.accesskey "O">
|
||||||
<!ENTITY thisFolder.label "This Folder">
|
|
||||||
<!ENTITY thisFolder.accesskey "F">
|
|
||||||
<!ENTITY goRecentlyClosedTabs.label "Recently Closed Tabs">
|
<!ENTITY goRecentlyClosedTabs.label "Recently Closed Tabs">
|
||||||
<!ENTITY goRecentlyClosedTabs.accesskey "R">
|
<!ENTITY goRecentlyClosedTabs.accesskey "R">
|
||||||
<!ENTITY startPageCmd.label "Mail Start Page">
|
<!ENTITY startPageCmd.label "Mail Start Page">
|
||||||
|
@ -379,10 +377,6 @@
|
||||||
<!ENTITY watchThreadMenu.label "Watch Thread">
|
<!ENTITY watchThreadMenu.label "Watch Thread">
|
||||||
<!ENTITY watchThreadMenu.accesskey "W">
|
<!ENTITY watchThreadMenu.accesskey "W">
|
||||||
<!ENTITY watchThreadMenu.key "w">
|
<!ENTITY watchThreadMenu.key "w">
|
||||||
<!ENTITY fileHereMenu.label "File Here">
|
|
||||||
<!ENTITY fileHereMenu.accesskey "F">
|
|
||||||
<!ENTITY copyHereMenu.label "Copy Here">
|
|
||||||
<!ENTITY copyHereMenu.accesskey "C">
|
|
||||||
<!ENTITY tagMenu.label "Tag">
|
<!ENTITY tagMenu.label "Tag">
|
||||||
<!ENTITY tagMenu.accesskey "g">
|
<!ENTITY tagMenu.accesskey "g">
|
||||||
<!ENTITY tagCmd0.key "0">
|
<!ENTITY tagCmd0.key "0">
|
||||||
|
|
|
@ -215,11 +215,6 @@ treechildren::-moz-tree-image(junkStatusCol) {
|
||||||
-moz-padding-start: 2px;
|
-moz-padding-start: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#folderLocationPopup menuitem:first-child {
|
|
||||||
padding-top: 3px;
|
|
||||||
padding-bottom: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (-moz-windows-default-theme) {
|
@media (-moz-windows-default-theme) {
|
||||||
#afterViewPickerUnreadSeparator,
|
#afterViewPickerUnreadSeparator,
|
||||||
#afterViewPickerCustomViewsSeparator {
|
#afterViewPickerCustomViewsSeparator {
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
Components.utils.import("resource:///modules/StringBundle.js", this);
|
Components.utils.import("resource:///modules/StringBundle.js", this);
|
||||||
this._stringBundle = new this
|
this._stringBundle = new this
|
||||||
.StringBundle("chrome://messenger/locale/folderWidgets.properties");
|
.StringBundle("chrome://messenger/locale/folderWidgets.properties");
|
||||||
this._stringBundleMessenger = new this
|
|
||||||
.StringBundle("chrome://messenger/locale/messenger.properties");
|
|
||||||
|
|
||||||
// Get the displayformat if set.
|
// Get the displayformat if set.
|
||||||
if (this.parentNode && this.parentNode.localName == "menulist")
|
if (this.parentNode && this.parentNode.localName == "menulist")
|
||||||
|
@ -88,7 +86,6 @@
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<field name="_stringBundle">null</field>
|
<field name="_stringBundle">null</field>
|
||||||
<field name="_stringBundleMessenger">null</field>
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
- If non-null, the subFolders of this nsIMsgFolder will be used to
|
- If non-null, the subFolders of this nsIMsgFolder will be used to
|
||||||
|
@ -372,6 +369,7 @@
|
||||||
attribute or no mode attribute. However the code won't add such a
|
attribute or no mode attribute. However the code won't add such a
|
||||||
menu item if one of the following conditions is met:
|
menu item if one of the following conditions is met:
|
||||||
(*) There is no parent folder
|
(*) There is no parent folder
|
||||||
|
(*) Folder is server and showAccountsFileHere is explicitly false
|
||||||
(*) Current folder has a mode, the parent folder can be selected,
|
(*) Current folder has a mode, the parent folder can be selected,
|
||||||
no messages can be filed into the parent folder (e.g. when the
|
no messages can be filed into the parent folder (e.g. when the
|
||||||
parent folder is a news group or news server) and the folder
|
parent folder is a news group or news server) and the folder
|
||||||
|
@ -381,32 +379,34 @@
|
||||||
label or if the attribute does not exist the name of the parent
|
label or if the attribute does not exist the name of the parent
|
||||||
folder instead.
|
folder instead.
|
||||||
*/
|
*/
|
||||||
if (this._parentFolder && (!mode ||
|
let parent = this._parentFolder;
|
||||||
(this.getAttribute("showFileHereLabel") == "true" &&
|
if (parent && (this.getAttribute("showFileHereLabel") == "true" || !mode)) {
|
||||||
(this._parentFolder.noSelect ||
|
let showAccountsFileHere = this.getAttribute("showAccountsFileHere");
|
||||||
this._parentFolder.canFileMessages || mode == "newFolder" ||
|
if ((!parent.isServer || showAccountsFileHere != "false") &&
|
||||||
this.getAttribute("showAccountsFileHere") == "true")))) {
|
(!mode || mode == "newFolder" || parent.noSelect ||
|
||||||
var menuitem = document.createElement("menuitem");
|
parent.canFileMessages || showAccountsFileHere == "true")) {
|
||||||
menuitem._folder = this._parentFolder;
|
var menuitem = document.createElement("menuitem");
|
||||||
menuitem.setAttribute("generated", "true");
|
menuitem._folder = this._parentFolder;
|
||||||
if (this.hasAttribute("fileHereLabel")) {
|
menuitem.setAttribute("generated", "true");
|
||||||
menuitem.setAttribute("label", this.getAttribute("fileHereLabel"));
|
if (this.hasAttribute("fileHereLabel")) {
|
||||||
menuitem.setAttribute("accesskey", this.getAttribute("fileHereAccessKey"));
|
menuitem.setAttribute("label", this.getAttribute("fileHereLabel"));
|
||||||
} else {
|
menuitem.setAttribute("accesskey", this.getAttribute("fileHereAccessKey"));
|
||||||
menuitem.setAttribute("label", this._parentFolder.prettyName);
|
} else {
|
||||||
menuitem.setAttribute("class", "folderMenuItem menuitem-iconic");
|
menuitem.setAttribute("label", this._parentFolder.prettyName);
|
||||||
this._setCssSelectors(this._parentFolder, menuitem);
|
menuitem.setAttribute("class", "folderMenuItem menuitem-iconic");
|
||||||
|
this._setCssSelectors(this._parentFolder, menuitem);
|
||||||
|
}
|
||||||
|
// Eww. have to support some legacy code here...
|
||||||
|
menuitem.setAttribute("id", this._parentFolder.URI);
|
||||||
|
this.appendChild(menuitem);
|
||||||
|
|
||||||
|
if (this._parentFolder.noSelect)
|
||||||
|
menuitem.setAttribute("disabled", "true");
|
||||||
|
|
||||||
|
var sep= document.createElement("menuseparator");
|
||||||
|
sep.setAttribute("generated", "true");
|
||||||
|
this.appendChild(sep);
|
||||||
}
|
}
|
||||||
// Eww. have to support some legacy code here...
|
|
||||||
menuitem.setAttribute("id", this._parentFolder.URI);
|
|
||||||
this.appendChild(menuitem);
|
|
||||||
|
|
||||||
if (this._parentFolder.noSelect)
|
|
||||||
menuitem.setAttribute("disabled", "true");
|
|
||||||
|
|
||||||
var sep= document.createElement("menuseparator");
|
|
||||||
sep.setAttribute("generated", "true");
|
|
||||||
this.appendChild(sep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let globalInboxFolder = null;
|
let globalInboxFolder = null;
|
||||||
|
@ -689,11 +689,11 @@
|
||||||
<parameter name="aFolder"/>
|
<parameter name="aFolder"/>
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
if (aFolder.isServer)
|
if (aFolder.isServer)
|
||||||
return aFolder.name;
|
return aFolder.prettyName;
|
||||||
|
|
||||||
if (this._displayformat == "verbose")
|
if (this._displayformat == "verbose")
|
||||||
return this._stringBundleMessenger.getFormattedString(
|
return this._stringBundle.getFormattedString("verboseFolderFormat",
|
||||||
"verboseFolderFormat", [aFolder.name, aFolder.server.prettyName]);
|
[aFolder.prettyName, aFolder.server.prettyName]);
|
||||||
|
|
||||||
if (this._displayformat == "path")
|
if (this._displayformat == "path")
|
||||||
return this.FeedUtils.getFolderPrettyPath(aFolder) || aFolder.name;
|
return this.FeedUtils.getFolderPrettyPath(aFolder) || aFolder.name;
|
||||||
|
@ -705,7 +705,7 @@
|
||||||
<!--
|
<!--
|
||||||
- Makes a given folder selected.
|
- Makes a given folder selected.
|
||||||
-
|
-
|
||||||
- @param aFolder the folder to select (if unset, then choose first folder)
|
- @param aFolder the folder to select (if none, then Choose Folder)
|
||||||
- @note If aFolder is not in this popup, but is instead a descendant of
|
- @note If aFolder is not in this popup, but is instead a descendant of
|
||||||
- a member of the popup, that ancestor will be selected.
|
- a member of the popup, that ancestor will be selected.
|
||||||
- @return true if any usable folder was found, otherwise false.
|
- @return true if any usable folder was found, otherwise false.
|
||||||
|
@ -713,54 +713,65 @@
|
||||||
<method name="selectFolder">
|
<method name="selectFolder">
|
||||||
<parameter name="aFolder"/>
|
<parameter name="aFolder"/>
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
// Set the label of the aParent element as if aFolder had been selected.
|
// Set the label of the menulist element as if aFolder had been selected.
|
||||||
function setupParent(aFolder, aParent) {
|
function setupParent(aFolder, aMenulist, aNoFolders) {
|
||||||
aParent.setAttribute("label",
|
let menupopup = aMenulist.menupopup;
|
||||||
aParent.menupopup.getDisplayName(aFolder));
|
if (aFolder) {
|
||||||
aParent.setAttribute("value", aFolder.URI);
|
aMenulist.setAttribute("label", menupopup.getDisplayName(aFolder));
|
||||||
aParent.setAttribute("IsServer", aFolder.isServer);
|
} else {
|
||||||
aParent.setAttribute("IsSecure", aFolder.server.isSecure);
|
aMenulist.setAttribute("label", menupopup._stringBundle.getString(
|
||||||
aParent.setAttribute("ServerType", aFolder.server.type);
|
aNoFolders ? "noFolders" : "chooseFolder"));
|
||||||
aParent.setAttribute("SpecialFolder",
|
}
|
||||||
aParent.menupopup.getSpecialFolderString(aFolder));
|
aMenulist.setAttribute("value",
|
||||||
aParent.setAttribute("IsFeedFolder",
|
aFolder ? aFolder.URI : "");
|
||||||
(aParent.menupopup.FeedUtils.getFeedUrlsInFolder(aFolder) ? true : false));
|
aMenulist.setAttribute("IsServer",
|
||||||
}
|
aFolder ? aFolder.isServer : false);
|
||||||
for (let child of this.childNodes) {
|
aMenulist.setAttribute("IsSecure",
|
||||||
if (!child || !child._folder || child.disabled)
|
aFolder ? aFolder.server.isSecure : false);
|
||||||
continue;
|
aMenulist.setAttribute("ServerType",
|
||||||
// Is this the folder in question or subfolder of the folder?
|
aFolder ? aFolder.server.type : "none");
|
||||||
if (!aFolder || (child._folder.URI == aFolder.URI) ||
|
aMenulist.setAttribute("SpecialFolder",
|
||||||
(child.tagName == "menu" &&
|
aFolder ? menupopup.getSpecialFolderString(aFolder) : "none");
|
||||||
child._folder.isAncestorOf(aFolder))) {
|
aMenulist.setAttribute("IsFeedFolder", Boolean(
|
||||||
if (!aFolder || (child._folder.URI == aFolder.URI))
|
aFolder && menupopup.FeedUtils.getFeedUrlsInFolder(aFolder)));
|
||||||
this.parentNode.selectedItem = child;
|
}
|
||||||
|
|
||||||
if (aFolder) {
|
let folder;
|
||||||
// If this is a subfolder of what's in question, we merely appear
|
if (aFolder) {
|
||||||
// to select this node.
|
for (let child of this.childNodes) {
|
||||||
setupParent(aFolder || child._folder, this.parentNode);
|
if (child && child._folder && !child.disabled &&
|
||||||
|
(child._folder.URI == aFolder.URI ||
|
||||||
|
(child.tagName == "menu" &&
|
||||||
|
child._folder.isAncestorOf(aFolder)))) {
|
||||||
|
if (child._folder.URI == aFolder.URI)
|
||||||
|
this.parentNode.selectedItem = child;
|
||||||
|
folder = aFolder;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aFolder) {
|
// If the caller specified a folder to select and it was not
|
||||||
// If the caller specified a folder to select and it was not
|
// found, or if the caller didn't pass a folder (meaning a logical
|
||||||
// found, blow up.
|
// and valid folder wasn't determined), don't blow up but reset
|
||||||
throw new Error("Unable to select folder " + aFolder.prettyName +
|
// attributes and set a nice Choose Folder label so the user may
|
||||||
" in the picker!");
|
// select a valid folder per the filter for this picker. If there are
|
||||||
} else {
|
// no children, then no folder passed the filter; disable the menulist
|
||||||
// If the caller didn't care much but nothing got selected,
|
// as there's nothing to choose from.
|
||||||
// this means there are at most some disabled items in the menulist.
|
let noFolders;
|
||||||
// Pretend to select the first one so that the widget is not shown
|
if (!this.childElementCount)
|
||||||
// empty.
|
{
|
||||||
if (this.childNodes.length > 0)
|
this.parentNode.setAttribute("disabled", true);
|
||||||
setupParent(this.getItemAtIndex(0)._folder, this.parentNode);
|
noFolders = true;
|
||||||
else
|
|
||||||
Components.utils.reportError("Unable to find any folder in the picker!");
|
|
||||||
}
|
}
|
||||||
return false;
|
else
|
||||||
|
{
|
||||||
|
this.parentNode.removeAttribute("disabled");
|
||||||
|
noFolders = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setupParent(folder, this.parentNode, noFolders);
|
||||||
|
return folder ? true : false;
|
||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,8 @@
|
||||||
|
|
||||||
<label value="&description.label;" accesskey="&description.accesskey;" control="msgNewFolderPicker"/>
|
<label value="&description.label;" accesskey="&description.accesskey;" control="msgNewFolderPicker"/>
|
||||||
|
|
||||||
<menulist id="msgNewFolderPicker" class="folderMenuItem">
|
<menulist id="msgNewFolderPicker" class="folderMenuItem"
|
||||||
|
displayformat="verbose">
|
||||||
<menupopup id="MsgNewFolderPopup" type="folder" showFileHereLabel="true"
|
<menupopup id="MsgNewFolderPopup" type="folder" showFileHereLabel="true"
|
||||||
class="menulist-menupopup"
|
class="menulist-menupopup"
|
||||||
mode="newFolder"
|
mode="newFolder"
|
||||||
|
|
|
@ -54,7 +54,8 @@
|
||||||
|
|
||||||
<row align="center" id="chooseFolderLocationRow">
|
<row align="center" id="chooseFolderLocationRow">
|
||||||
<label value="&description.label;" accesskey="&description.accesskey;" control="msgNewFolderPicker"/>
|
<label value="&description.label;" accesskey="&description.accesskey;" control="msgNewFolderPicker"/>
|
||||||
<menulist id="msgNewFolderPicker" class="folderMenuItem" flex="1">
|
<menulist id="msgNewFolderPicker" class="folderMenuItem" flex="1"
|
||||||
|
displayformat="verbose">
|
||||||
<menupopup id="msgNewFolderPopup" type="folder" mode="newFolder"
|
<menupopup id="msgNewFolderPopup" type="folder" mode="newFolder"
|
||||||
showFileHereLabel="true"
|
showFileHereLabel="true"
|
||||||
oncommand="onFolderPick(event);"/>
|
oncommand="onFolderPick(event);"/>
|
||||||
|
|
|
@ -186,7 +186,7 @@ var gFolderListener = {
|
||||||
|
|
||||||
if (eventType == "FolderCreateCompleted")
|
if (eventType == "FolderCreateCompleted")
|
||||||
{
|
{
|
||||||
SetFolderPicker(folder.URI, gActionTargetElement.id);
|
gActionTargetElement.selectFolder(folder);
|
||||||
SetBusyCursor(window, false);
|
SetBusyCursor(window, false);
|
||||||
}
|
}
|
||||||
else if (eventType == "FolderCreateFailed")
|
else if (eventType == "FolderCreateFailed")
|
||||||
|
@ -683,7 +683,8 @@ function SearchNewFolderOkCallback(name, uri)
|
||||||
if (!imapFolder)
|
if (!imapFolder)
|
||||||
{
|
{
|
||||||
var curFolder = uri+"/"+encodeURIComponent(name);
|
var curFolder = uri+"/"+encodeURIComponent(name);
|
||||||
SetFolderPicker(curFolder, gActionTargetElement.id);
|
let folder = MailUtils.getFolderForURI(curFolder);
|
||||||
|
gActionTargetElement.selectFolder(folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
<script type="application/javascript" src="chrome://messenger/content/mailWindowOverlay.js"/>
|
<script type="application/javascript" src="chrome://messenger/content/mailWindowOverlay.js"/>
|
||||||
<script type="application/javascript" src="chrome://messenger/content/mailCommands.js"/>
|
<script type="application/javascript" src="chrome://messenger/content/mailCommands.js"/>
|
||||||
<script type="application/javascript" src="chrome://messenger/content/FilterEditor.js"/>
|
<script type="application/javascript" src="chrome://messenger/content/FilterEditor.js"/>
|
||||||
<script type="application/javascript" src="chrome://messenger/content/msgFolderPickerOverlay.js"/>
|
|
||||||
|
|
||||||
<commandset>
|
<commandset>
|
||||||
<command id="cmd_updateFilterType" oncommand="updateFilterType();"/>
|
<command id="cmd_updateFilterType" oncommand="updateFilterType();"/>
|
||||||
|
|
|
@ -712,9 +712,15 @@
|
||||||
<implementation>
|
<implementation>
|
||||||
<constructor>
|
<constructor>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
if (!this.menulist.value)
|
Components.utils.import("resource:///modules/MailUtils.js", this);
|
||||||
this.menulist.value = gFilterList.folder.URI;
|
let folder = this.menulist.value ?
|
||||||
SetFolderPickerElement(this.menulist.value, this.menulist);
|
this.MailUtils.getFolderForURI(this.menulist.value) :
|
||||||
|
gFilterList.folder;
|
||||||
|
// An account folder is not a move/copy target; show "Choose Folder".
|
||||||
|
folder = folder.isServer ? null : folder;
|
||||||
|
let menupopup = this.menulist.menupopup;
|
||||||
|
// The menupopup constructor needs to finish first.
|
||||||
|
setTimeout(function() { menupopup.selectFolder(folder); }, 0);
|
||||||
]]>
|
]]>
|
||||||
</constructor>
|
</constructor>
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче