Bug #349767 --> port Neil's folder location picker toolbar button to thunderbird as an optional toolbar button. sr=bienvenu

This commit is contained in:
scott%scott-macgregor.org 2006-08-24 02:45:04 +00:00
parent e4db6ab1b0
commit 588fda39f0
8 changed files with 110 additions and 15 deletions

View File

@ -336,9 +336,8 @@ function RerootFolder(uri, newFolder, viewType, viewFlags, sortType, sortOrder)
}
// that should have initialized gDBView, now re-root the thread pane
RerootThreadPane();
SetUpToolbarButtons(uri);
UpdateFolderLocationPicker(gMsgFolderSelected);
UpdateStatusMessageCounts(gMsgFolderSelected);
// hook for extra toolbar items
@ -790,8 +789,9 @@ function FolderPaneSelectionChange()
if (msgFolder == gMsgFolderSelected)
return;
gPrevSelectedFolder = gMsgFolderSelected;
gPrevSelectedFolder = gMsgFolderSelected;
gMsgFolderSelected = msgFolder;
UpdateFolderLocationPicker(gMsgFolderSelected);
var folderFlags = msgFolder.flags;
// if this is same folder, and we're not showing a virtual folder
// then do nothing.

View File

@ -72,6 +72,13 @@ function MailToolboxCustomizeDone(aToolboxChanged)
// make sure the mail views search box is initialized
if (document.getElementById("mailviews-container"))
viewPickerOnLoad();
// make sure the folder location picker is initialized
if (document.getElementById("folder-location-container"))
{
loadFolderViewForTree(gCurrentFolderView, document.getElementById('folderLocationPopup').tree);
UpdateFolderLocationPicker(gMsgFolderSelected);
}
gSearchInput = null;
if (document.getElementById("search-container"))

View File

@ -29,7 +29,7 @@
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate yourÄ
# use your version of this file under the terms of the MPL, indicate your
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
@ -1942,6 +1942,14 @@
</textbox>
</toolbaritem>
<toolbaritem id ="folder-location-container" title="&folderLocationToolbarItem.title;"
align="center" class="chromeclass-toolbar-additional">
<menulist id="locationFolders" class="folderMenuItem" label=" " crop="center">
<menupopup id="folderLocationPopup" class="folderLocationPopup" height="400" flex="1"
oncommand="OnLocationTreeSelect(this);"/>
</menulist>
</toolbaritem>
<toolbaritem id="mailviews-container" title="&mailViewsToolbarItem.title;" align="center" class="chromeclass-toolbar-additional">
<label value="&viewPicker.label;" control="viewPicker" accesskey="&viewPicker.accesskey;"/>
<menulist id="viewPicker" oncreate="FillLabelValues();" oncommand="viewChange(this, this.value);">
@ -1975,7 +1983,7 @@
#ifdef XP_MACOSX
defaultset="button-getmsg,button-newmsg,button-address,spacer,button-reply,button-replyall,button-forward,spacer,button-tag,button-delete,button-junk,spacer,button-print,button-stop,spring,search-container,throbber-box">
#else
defaultset="button-getmsg,button-newmsg,button-address,separator,button-reply,button-replyall,button-forward,separator,button-tag,button-delete,button-junk,separator,button-print,button-stop,spring,search-container">
defaultset="button-getmsg,button-newmsg,button-address,separator,button-reply,button-replyall,button-forward,separator,button-tag,button-delete,button-junk,separator,button-print,button-stop,spring,search-container">
#endif
</toolbar>
<toolbarset id="customToolbars" context="toolbar-context-menu"/>

View File

@ -165,6 +165,12 @@ dummy.usesMailWidgets {
-moz-binding: url("chrome://messenger/content/mailWidgets.xml#searchpopup");
}
.folderLocationPopup {
display: -moz-popup;
-moz-binding: url("chrome://messenger/content/mailWidgets.xml#locationpopup");
visibility: visible;
}
.folderSummaryPopup
{
-moz-binding: url("chrome://messenger/content/mailWidgets.xml#folderSummary-popup");

View File

@ -174,6 +174,7 @@ var folderListener = {
if (item == msgWindow.openFolder) {
if(property.toString() == "TotalMessages" || property.toString() == "TotalUnreadMessages") {
UpdateStatusMessageCounts(gMsgFolderSelected);
UpdateFolderLocationPicker(item);
}
}
},
@ -1087,14 +1088,13 @@ function UpdateFolderColumnVisibility()
}
}
function loadFolderView(aNewFolderView)
// loadFolderViewForTree -- a helper routine split away from
// loadFolderView.
// returns a localized string corresponding to the name of the new view
function loadFolderViewForTree(aNewFolderView, aFolderTree)
{
if (gCurrentFolderView && (gCurrentFolderView == aNewFolderView))
return;
var folderPaneHeader = document.getElementById('folderpane-title');
var folderTree = GetFolderTree();
var database = GetFolderDatasource();
var database = aFolderTree.database;
var nsIRDFDataSource = Components.interfaces.nsIRDFDataSource;
// Each folder pane view has the following properties:
@ -1127,10 +1127,31 @@ function loadFolderView(aNewFolderView)
msgDS.window = msgWindow;
}
folderTree.setAttribute('ref', folderViews[aNewFolderView].ref);
folderPaneHeader.value = gMessengerBundle.getString(folderViews[aNewFolderView].label);
aFolderTree.setAttribute('ref', folderViews[aNewFolderView].ref);
return gMessengerBundle.getString(folderViews[aNewFolderView].label);
}
// reflect the new value back into prefs
function loadFolderView(aNewFolderView)
{
if (gCurrentFolderView && (gCurrentFolderView == aNewFolderView))
return;
var folderTree = GetFolderTree();
var folderPaneHeader = document.getElementById('folderpane-title');
var folderTree = GetFolderTree();
var database = GetFolderDatasource();
// load the folder view into the folder pane
folderPaneHeader.value = loadFolderViewForTree(aNewFolderView, GetFolderTree());
// if the folder location picker is visible, load the folder view into the location
// picker as well.
var folderLocationPicker = document.getElementById('folder-location-container');
if (folderLocationPicker)
loadFolderViewForTree(aNewFolderView, document.getElementById('folderLocationPopup').tree);
// now reflect the new value back into prefs
pref.setIntPref('mail.ui.folderpane.view', gCurrentFolderView = aNewFolderView);
}
@ -1210,7 +1231,47 @@ function UpgradeThreadPaneUI()
function OnLoadThreadPane()
{
UpgradeThreadPaneUI();
UpgradeThreadPaneUI();
}
// folderLocationPickerOnLoad can be called multiple times
// and it can be called when the location picker isn't in the toolbar
function folderLocationPickerOnLoad()
{
var folderLocationPicker = document.getElementById('folder-location-container');
if (!folderLocationPicker)
return;
var locationTree = document.getElementById('folderLocationPopup').tree;
locationTree.database.AddDataSource(accountManagerDataSource);
locationTree.database.AddDataSource(folderDataSource);
locationTree.setAttribute("ref", "msgaccounts:/");
}
function OnLocationTreeSelect(menulist)
{
SelectFolder(menulist.getAttribute('uri'));
}
function UpdateFolderLocationPicker(resource)
{
var folderLocationPicker = document.getElementById('folder-location-container');
if (!folderLocationPicker)
return;
var tree = GetFolderTree();
var folders = document.getElementById('locationFolders');
var properties = ['BiffState', 'NewMessages', 'HasUnreadMessages',
'SpecialFolder', 'IsServer', 'IsSecure', 'ServerType', 'NoSelect'];
var label = GetFolderAttribute(tree, resource, 'FolderTreeName');
folders.setAttribute("label", label);
for (var i in properties)
{
var property = properties[i];
var value = GetFolderAttribute(tree, resource, property);
folders.setAttribute(property, value);
}
folders.setAttribute('uri', resource.Value);
}
function GetFolderDatasource()

View File

@ -443,6 +443,7 @@
<!ENTITY addressBookButton.label "Address Book">
<!ENTITY searchItem.title "Quick Search">
<!ENTITY mailViewsToolbarItem.title "Mail Views">
<!ENTITY folderLocationToolbarItem.title "Folder Location">
<!ENTITY tagButton.label "Tag">
<!-- Mail Toolbar Tooltips-->

View File

@ -908,6 +908,12 @@ splitter {
border: 1px solid transparent;
}
/* ..... folder location toolbar button adjustments ..... */
#locationFolders {
width: 25em;
}
/* ..... message pane adjustments ..... */
#messagepanebox {

View File

@ -844,6 +844,12 @@ treechildren::-moz-tree-cell-text(lc-black, selected, focus) {
border: 1px solid ThreeDShadow;
}
/* ..... folder location toolbar button adjustments ..... */
#locationFolders {
width: 20em;
}
/* ..... message pane adjustments ..... */
#messagepanebox {