patch from stephen walker to remove some crufty grippy code and to remove some unnecessary boxes.
git-svn-id: svn://10.0.0.236/trunk@143439 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
505b2011c3
commit
fd14d5d88f
@ -681,17 +681,6 @@ function OnMouseUpThreadAndMessagePaneSplitter()
|
||||
NotifyChangedMessagePaneVisibility(now_hidden);
|
||||
}
|
||||
|
||||
function OnClickThreadAndMessagePaneSplitterGrippy()
|
||||
{
|
||||
// the collapsed state is the state when we clicked on the grippy
|
||||
// not when afterwards, so we need to reverse this value
|
||||
var now_hidden = !IsThreadAndMessagePaneSplitterCollapsed();
|
||||
if (gDBView) {
|
||||
gDBView.suppressMsgDisplay = now_hidden;
|
||||
}
|
||||
NotifyChangedMessagePaneVisibility(now_hidden);
|
||||
}
|
||||
|
||||
function FolderPaneSelectionChange()
|
||||
{
|
||||
var folderTree = GetFolderTree();
|
||||
|
||||
@ -148,29 +148,19 @@
|
||||
<tree id="folderTree" flex="1" style="min-width: 100px;" context="folderPaneContext" persist="collapsed width height"/>
|
||||
</vbox>
|
||||
|
||||
<splitter id="gray_vertical_splitter" collapse="before" persist="state">
|
||||
<grippy/>
|
||||
</splitter>
|
||||
<splitter id="gray_vertical_splitter" collapse="before" persist="state"/>
|
||||
|
||||
<hbox id="messengerBox" persist="collapsed width" flex="2">
|
||||
<vbox id="searchAndthreadpaneBox" persist="width" flex ="1">
|
||||
<vbox id="messagesBox" flex="1">
|
||||
<hbox id="searchBox"/>
|
||||
<vbox id="threadpaneBox" flex="1" persist="width">
|
||||
<tree id="threadTree" flex="1" persist="width" style="width:0px" context="threadPaneContext"/>
|
||||
</vbox>
|
||||
</vbox>
|
||||
<vbox id="messengerBox" persist="collapsed width" flex="2">
|
||||
<hbox id="searchBox"/>
|
||||
<tree id="threadTree" flex="1" persist="width" context="threadPaneContext"/>
|
||||
<vbox id="accountCentralBox" flex="1" persist="width">
|
||||
<iframe name="accountCentralPane" flex="1" src="about:blank"/>
|
||||
</vbox>
|
||||
<hbox id="accountCentralBox" flex="1" persist="width">
|
||||
<iframe name="accountCentralPane" style="width:0px;" flex="1" src="about:blank"/>
|
||||
</hbox>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<!-- if you change this id, please change GetThreadAndMessagePaneSplitter() and MsgToggleMessagePane() -->
|
||||
<splitter id="threadpane-splitter" collapse="after" persist="state"
|
||||
onmouseup="OnMouseUpThreadAndMessagePaneSplitter()">
|
||||
<grippy onclick="OnClickThreadAndMessagePaneSplitterGrippy()"/>
|
||||
</splitter>
|
||||
onmouseup="OnMouseUpThreadAndMessagePaneSplitter()"/>
|
||||
<!-- msg header view -->
|
||||
<vbox id="messagepanebox" flex="4" persist="collapsed height">
|
||||
<hbox id="junkBar"/>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
# Jan Varga <varga@utcru.sk>
|
||||
# Håkan Waara (hwaara@chello.se)
|
||||
|
||||
//This file stores variables common to mail windows
|
||||
//This file stores variables common to mail windows
|
||||
var messengerContractID = "@mozilla.org/messenger;1";
|
||||
var statusFeedbackContractID = "@mozilla.org/messenger/statusfeedback;1";
|
||||
var mailSessionContractID = "@mozilla.org/messenger/services/session;1";
|
||||
@ -56,9 +56,11 @@ var folderDSContractID = datasourceContractIDPrefix + "mailnewsfolders";
|
||||
var accountManagerDataSource;
|
||||
var folderDataSource;
|
||||
|
||||
var messagesBox = null;
|
||||
var accountCentralBox = null;
|
||||
var gSearchBox = null;
|
||||
var gThreadPane = null;
|
||||
var gThreadPaneSplitter = null;
|
||||
var gMessagePaneBox = null;
|
||||
var gAccountCentralLoaded = false;
|
||||
var gFakeAccountPageLoaded = false;
|
||||
var gPaneConfig = null;
|
||||
@ -184,9 +186,11 @@ function CreateMailWindowGlobals()
|
||||
accountManagerDataSource = Components.classes[accountManagerDSContractID].createInstance();
|
||||
folderDataSource = Components.classes[folderDSContractID].createInstance();
|
||||
|
||||
messagesBox = document.getElementById("messagesBox");
|
||||
accountCentralBox = document.getElementById("accountCentralBox");
|
||||
gSearchBox = document.getElementById("searchBox");
|
||||
gThreadPane = document.getElementById("threadTree");
|
||||
gThreadPaneSplitter = document.getElementById("threadpane-splitter");
|
||||
gMessagePaneBox = document.getElementById("messagepanebox");
|
||||
gPaneConfig = pref.getIntPref("mail.pane_config");
|
||||
}
|
||||
|
||||
@ -492,30 +496,24 @@ function loadStartPage() {
|
||||
// Load iframe in the AccountCentral box with corresponding page
|
||||
function ShowAccountCentral()
|
||||
{
|
||||
var acctCentralPage = pref.getComplexValue("mailnews.account_central_page.url",
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
gSearchBox.setAttribute("collapsed", "true");
|
||||
gThreadPane.setAttribute("collapsed", "true");
|
||||
gMessagePaneBox.setAttribute("collapsed", "true");
|
||||
accountCentralBox.removeAttribute("collapsed");
|
||||
window.frames["accountCentralPane"].location = acctCentralPage;
|
||||
gAccountCentralLoaded = true;
|
||||
|
||||
try
|
||||
{
|
||||
var acctCentralPage = pref.getComplexValue("mailnews.account_central_page.url",
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
switch (gPaneConfig)
|
||||
{
|
||||
case 0:
|
||||
messagesBox.setAttribute("collapsed", "true");
|
||||
gSearchBox.setAttribute("collapsed", "true");
|
||||
accountCentralBox.removeAttribute("collapsed");
|
||||
window.frames["accountCentralPane"].location = acctCentralPage;
|
||||
gAccountCentralLoaded = true;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
var messagePaneBox = document.getElementById("messagepanebox");
|
||||
messagePaneBox.setAttribute("collapsed", "true");
|
||||
var searchAndThreadPaneBox = document.getElementById("searchAndthreadpaneBox");
|
||||
searchAndThreadPaneBox.setAttribute("collapsed", "true");
|
||||
var threadPaneSplitter = document.getElementById("threadpane-splitter");
|
||||
threadPaneSplitter.setAttribute("collapsed", "true");
|
||||
accountCentralBox.removeAttribute("collapsed");
|
||||
window.frames["accountCentralPane"].location = acctCentralPage;
|
||||
gAccountCentralLoaded = true;
|
||||
gThreadPaneSplitter.setAttribute("collapsed", "true");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -531,32 +529,22 @@ function ShowAccountCentral()
|
||||
// box and display message box.
|
||||
function HideAccountCentral()
|
||||
{
|
||||
gSearchBox.removeAttribute("collapsed");
|
||||
gThreadPane.removeAttribute("collapsed");
|
||||
gMessagePaneBox.removeAttribute("collapsed");
|
||||
accountCentralBox.setAttribute("collapsed", "true");
|
||||
window.frames["accountCentralPane"].location = "about:blank";
|
||||
gAccountCentralLoaded = false;
|
||||
|
||||
try
|
||||
{
|
||||
switch (gPaneConfig)
|
||||
{
|
||||
case 0:
|
||||
window.frames["accountCentralPane"].location = "about:blank";
|
||||
accountCentralBox.setAttribute("collapsed", "true");
|
||||
gSearchBox.removeAttribute("collapsed");
|
||||
messagesBox.removeAttribute("collapsed");
|
||||
gAccountCentralLoaded = false;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
window.frames["accountCentralPane"].location = "about:blank";
|
||||
accountCentralBox.setAttribute("collapsed", "true");
|
||||
// XXX todo
|
||||
// the code below that always removes the collapsed attribute
|
||||
// makes it so in this pane config, you can't keep the message pane hidden
|
||||
// see bug #188393
|
||||
var messagePaneBox = document.getElementById("messagepanebox");
|
||||
messagePaneBox.removeAttribute("collapsed");
|
||||
var searchAndThreadPaneBox = document.getElementById("searchAndthreadpaneBox");
|
||||
searchAndThreadPaneBox.removeAttribute("collapsed");
|
||||
var threadPaneSplitter = document.getElementById("threadpane-splitter");
|
||||
threadPaneSplitter.removeAttribute("collapsed");
|
||||
gAccountCentralLoaded = false;
|
||||
gThreadPaneSplitter.removeAttribute("collapsed");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +124,6 @@
|
||||
</toolbox>
|
||||
|
||||
<!-- msg header view -->
|
||||
<vbox id="messagesBox" flex="1">
|
||||
<vbox id="messagepanebox" flex="3" persist="collapsed"
|
||||
ondragover="nsDragAndDrop.dragOver(event, messagepaneObserver);"
|
||||
ondragdrop="nsDragAndDrop.drop(event, messagepaneObserver);"
|
||||
@ -136,11 +135,10 @@
|
||||
|
||||
<!-- message view -->
|
||||
<browser id="messagepane" context="messagePaneContext"
|
||||
style="height: 0px; min-height: 1px" flex="1" name="messagepane"
|
||||
disablesecurity="true" disablehistory="true" type="content-primary"
|
||||
src="about:blank" onclick="contentAreaClick(event);" autofind="false"/>
|
||||
style="height: 0px; min-height: 1px" flex="1" name="messagepane"
|
||||
disablesecurity="true" disablehistory="true" type="content-primary"
|
||||
src="about:blank" onclick="contentAreaClick(event);" autofind="false"/>
|
||||
</vbox>
|
||||
</vbox>
|
||||
|
||||
<statusbar class="chromeclass-status" id="status-bar"/>
|
||||
|
||||
|
||||
@ -147,25 +147,20 @@
|
||||
<tree id="folderTree" flex="1" style="min-width: 100px;" context="folderPaneContext" persist="collapsed width height"/>
|
||||
</vbox>
|
||||
|
||||
<splitter id="gray_vertical_splitter" collapse="before" persist="state">
|
||||
<grippy/>
|
||||
</splitter>
|
||||
<splitter id="gray_vertical_splitter" collapse="before" persist="state"/>
|
||||
|
||||
<vbox id="messengerBox" flex="1" persist="width">
|
||||
<!-- collapse this box. since we are loading on a timeout, the user will see it "jump" if it isn't collapsed" -->
|
||||
<vbox id="accountCentralBox" flex="1" collapsed="true">
|
||||
<iframe name="accountCentralPane" flex="1" src="about:blank"/>
|
||||
</vbox>
|
||||
<vbox id="messagesBox" flex="1">
|
||||
<hbox id="searchBox"/>
|
||||
<tree id="threadTree" flex="2" persist="height" style="height:0px" context="threadPaneContext"/>
|
||||
<tree id="threadTree" flex="2" persist="height" context="threadPaneContext"/>
|
||||
|
||||
<!-- if you change this id, please change GetThreadAndMessagePaneSplitter() and MsgToggleMessagePane() -->
|
||||
<splitter collapse="after" persist="state"
|
||||
onmouseup="OnMouseUpThreadAndMessagePaneSplitter()"
|
||||
id="threadpane-splitter">
|
||||
<grippy onclick="OnClickThreadAndMessagePaneSplitterGrippy()"/>
|
||||
</splitter>
|
||||
id="threadpane-splitter"/>
|
||||
|
||||
<vbox id="messagepanebox" flex="3" persist="collapsed height" onclick="contentAreaClick(event);">
|
||||
|
||||
@ -177,9 +172,8 @@
|
||||
style="height: 0px; min-height: 1px" flex="1" name="messagepane"
|
||||
disablehistory="true" type="content-primary" src="about:blank"
|
||||
disablesecurity="true" autofind="false"/>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</hbox>
|
||||
|
||||
<statusbar id="status-bar" class="chromeclass-status mailwindow-statusbar">
|
||||
|
||||
265
mozilla/mail/base/content/widgetglue.js
Normal file
265
mozilla/mail/base/content/widgetglue.js
Normal file
@ -0,0 +1,265 @@
|
||||
# -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is Mozilla Communicator client code, released
|
||||
# March 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Jan Varga (varga@utcru.sk)
|
||||
# Håkan Waara (hwaara@chello.se)
|
||||
|
||||
/*
|
||||
* widget-specific wrapper glue. There should be one function for every
|
||||
* widget/menu item, which gets some context (like the current selection)
|
||||
* and then calls a function/command in commandglue
|
||||
*/
|
||||
|
||||
//The eventual goal is for this file to go away and its contents to be brought into
|
||||
//mailWindowOverlay.js. This is currently being done.
|
||||
|
||||
//NOTE: gMessengerBundle must be defined and set or this Overlay won't work
|
||||
|
||||
function ConvertDOMListToResourceArray(nodeList)
|
||||
{
|
||||
var result = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
|
||||
|
||||
for (var i=0; i<nodeList.length; i++) {
|
||||
result.AppendElement(nodeList[i].resource);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function GetSelectedFolderURI()
|
||||
{
|
||||
var folderTree = GetFolderTree();
|
||||
var selection = folderTree.treeBoxObject.selection;
|
||||
if (selection.count == 1)
|
||||
{
|
||||
var startIndex = {};
|
||||
var endIndex = {};
|
||||
selection.getRangeAt(0, startIndex, endIndex);
|
||||
var folderResource = GetFolderResource(folderTree, startIndex.value);
|
||||
return folderResource.Value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function MsgRenameFolder()
|
||||
{
|
||||
var preselectedURI = GetSelectedFolderURI();
|
||||
var folderTree = GetFolderTree();
|
||||
|
||||
var name = GetFolderNameFromUri(preselectedURI, folderTree);
|
||||
|
||||
dump("preselectedURI = " + preselectedURI + "\n");
|
||||
var dialog = window.openDialog(
|
||||
"chrome://messenger/content/renameFolderDialog.xul",
|
||||
"newFolder",
|
||||
"chrome,titlebar,modal",
|
||||
{preselectedURI: preselectedURI,
|
||||
okCallback: RenameFolder, name: name});
|
||||
}
|
||||
|
||||
function RenameFolder(name,uri)
|
||||
{
|
||||
dump("uri,name = " + uri + "," + name + "\n");
|
||||
var folderTree = GetFolderTree();
|
||||
if (folderTree)
|
||||
{
|
||||
if (uri && (uri != "") && name && (name != ""))
|
||||
{
|
||||
var selectedFolder = GetResourceFromUri(uri);
|
||||
if (gDBView)
|
||||
gCurrentlyDisplayedMessage = gDBView.currentlyDisplayedMessage;
|
||||
|
||||
ClearThreadPane();
|
||||
ClearMessagePane();
|
||||
folderTree.treeBoxObject.selection.clearSelection();
|
||||
|
||||
try
|
||||
{
|
||||
messenger.RenameFolder(GetFolderDatasource(), selectedFolder, name);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
SelectFolder(selectedFolder.URI); //restore selection
|
||||
throw(e); // so that the dialog does not automatically close
|
||||
dump ("Exception : RenameFolder \n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dump("no name or nothing selected\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dump("no folder tree\n");
|
||||
}
|
||||
}
|
||||
|
||||
function MsgEmptyTrash()
|
||||
{
|
||||
var folderTree = GetFolderTree();
|
||||
var startIndex = {};
|
||||
var endIndex = {};
|
||||
folderTree.treeBoxObject.selection.getRangeAt(0, startIndex, endIndex);
|
||||
if (startIndex.value >= 0)
|
||||
{
|
||||
var folderResource = GetFolderResource(folderTree, startIndex.value);
|
||||
try {
|
||||
messenger.EmptyTrash(GetFolderDatasource(), folderResource);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
dump ("Exception : messenger.EmptyTrash \n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function MsgCompactFolder(isAll)
|
||||
{
|
||||
// Get the selected folders.
|
||||
var selectedFolders = GetSelectedMsgFolders();
|
||||
|
||||
if (selectedFolders.length == 1)
|
||||
{
|
||||
var selectedFolder = selectedFolders[0];
|
||||
var resource = selectedFolder.QueryInterface(Components.interfaces.nsIRDFResource);
|
||||
|
||||
if (selectedFolder.server.type != "imap") //can be local only
|
||||
{
|
||||
var msgfolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||
var expungedBytes = msgfolder.expungedBytes;
|
||||
|
||||
if (expungedBytes > 0)
|
||||
{
|
||||
if (gDBView)
|
||||
{
|
||||
gCurrentlyDisplayedMessage = gDBView.currentlyDisplayedMessage;
|
||||
}
|
||||
|
||||
ClearThreadPaneSelection();
|
||||
ClearThreadPane();
|
||||
ClearMessagePane();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!isAll) //you have one local folder with no room to compact
|
||||
return;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
messenger.CompactFolder(GetFolderDatasource(), resource, isAll);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
dump("Exception : messenger.CompactFolder : " + ex + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function MsgFolderProperties()
|
||||
{
|
||||
var preselectedURI = GetSelectedFolderURI();
|
||||
var msgFolder = GetMsgFolderFromUri(preselectedURI, true);
|
||||
|
||||
// if a server is selected, view settings for that account
|
||||
if (msgFolder.isServer) {
|
||||
MsgAccountManager(null);
|
||||
return;
|
||||
}
|
||||
|
||||
var serverType = msgFolder.server.type;
|
||||
var folderTree = GetFolderTree();
|
||||
|
||||
var name = GetFolderNameFromUri(preselectedURI, folderTree);
|
||||
|
||||
var windowTitle = gMessengerBundle.getString("folderProperties");
|
||||
var dialog = window.openDialog(
|
||||
"chrome://messenger/content/folderProps.xul",
|
||||
"",
|
||||
"chrome,centerscreen,titlebar,modal",
|
||||
{preselectedURI:preselectedURI, serverType:serverType,
|
||||
msgWindow:msgWindow, title:windowTitle,
|
||||
okCallback:FolderProperties,
|
||||
tabID:"", tabIndex:0, name:name});
|
||||
}
|
||||
|
||||
function FolderProperties(name, uri)
|
||||
{
|
||||
}
|
||||
|
||||
function MsgToggleMessagePane()
|
||||
{
|
||||
//OnClickThreadAndMessagePaneSplitter is based on the value before the splitter is toggled.
|
||||
MsgToggleSplitter("threadpane-splitter");
|
||||
}
|
||||
|
||||
function MsgToggleSplitter(id)
|
||||
{
|
||||
var splitter = document.getElementById(id);
|
||||
var state = splitter.getAttribute("state");
|
||||
if (state == "collapsed")
|
||||
splitter.setAttribute("state", null);
|
||||
else
|
||||
splitter.setAttribute("state", "collapsed")
|
||||
}
|
||||
|
||||
function MsgSetFolderCharset()
|
||||
{
|
||||
MsgFolderProperties()
|
||||
}
|
||||
|
||||
// Given a URI we would like to return corresponding message folder here.
|
||||
// An additonal input param which specifies whether or not to check folder
|
||||
// attributes (like if there exists a parent or is it a server) is also passed
|
||||
// to this routine. Qualifying against those checks would return an existing
|
||||
// folder. Callers who don't want to check those attributes will specify the
|
||||
// same and then this routine will simply return a msgfolder. This scenario
|
||||
// applies to a new imap account creation where special folders are created
|
||||
// on demand and hence needs to prior check of existence.
|
||||
function GetMsgFolderFromUri(uri, checkFolderAttributes)
|
||||
{
|
||||
//dump("GetMsgFolderFromUri of " + uri + "\n");
|
||||
var msgfolder = null;
|
||||
try {
|
||||
var resource = GetResourceFromUri(uri);
|
||||
msgfolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
|
||||
if (checkFolderAttributes) {
|
||||
if (!(msgfolder && (msgfolder.parent || msgfolder.isServer))) {
|
||||
msgfolder = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
//dump("failed to get the folder resource\n");
|
||||
}
|
||||
return msgfolder;
|
||||
}
|
||||
|
||||
function GetResourceFromUri(uri)
|
||||
{
|
||||
var RDF = Components.classes['@mozilla.org/rdf/rdf-service;1'].getService();
|
||||
RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
|
||||
var resource = RDF.GetResource(uri);
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
@ -12,6 +12,8 @@ messenger.jar:
|
||||
*+ content/messenger/messenger.xul (content/messenger.xul)
|
||||
*+ content/messenger/msgMail3PaneWindow.js (content/msgMail3PaneWindow.js)
|
||||
*+ content/messenger/mailCore.js (content/mailCore.js)
|
||||
*+ content/messenger/commandglue.js (content/commandglue.js)
|
||||
*+ content/messenger/widgetglue.js (content/widgetglue.js)
|
||||
*+ content/messenger/SearchDialog.xul (content/SearchDialog.xul)
|
||||
*+ content/messenger/subscribe.xul (content/subscribe.xul)
|
||||
*+ content/messenger/aboutDialog.xul (content/aboutDialog.xul)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user