make the search folder picker come from the folder picker overlay, and make it update correctly, plus start to hook up the datasources to the thread pane in the search window

r=sspitzer
part of bug #33101


git-svn-id: svn://10.0.0.236/trunk@72358 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
alecf%netscape.com 2000-06-16 07:43:42 +00:00
parent 9f5dcee0a1
commit e8000a5455
4 changed files with 137 additions and 14 deletions

View File

@ -1,3 +1,29 @@
/* -*- Mode: Java; 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.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Alec Flett <alecf@netscape.com>
*/
var Bundle = srGetStrBundle("chrome://messenger/locale/messenger.properties");
// call this from dialog onload() to set the menu item to the correct value
function MsgFolderPickerOnLoad(pickerID)
{
@ -57,12 +83,17 @@ function SetFolderPicker(uri,pickerID)
if (msgfolder.isServer)
selectedValue = msgfolder.name;
else {
if (msgfolder.server) {
selectedValue = msgfolder.name + " on " + msgfolder.server.prettyName;
}
else {
selectedValue = msgfolder.name + " on ???";
}
if (msgfolder.server)
serverName = msgfolder.server.prettyName;
else {
dump("Cant' find server for " + uri + "\n");
serverName = "???";
}
selectedValue =
Bundle.formatStringFromName("verboseFolderFormat",
[ msgfolder.name,
serverName ], 2);
}
picker.setAttribute("value",selectedValue);

View File

@ -300,4 +300,27 @@ Rights Reserved.
</template>
<menupopup />
</menu>
<menulist id="searchableFolders"
datasources="rdf:msgaccountmanager rdf:mailnewsfolders"
ref="msgaccounts:/">
<template>
<rule iscontainer="true" isempty="false">
<menupopup>
<menu uri="..." value="rdf:http://home.netscape.com/NC-rdf#Name">
<menupopup>
<menuitem uri="..." value="&filemessageschoosethis.label;"/>
<menuseparator/>
</menupopup>
</menu>
</menupopup>
</rule>
<rule>
<menupopup>
<menuitem uri="..."
value="rdf:http://home.netscape.com/NC-rdf#Name"/>
</menupopup>
</rule>
</template>
</menulist>
</overlay>

View File

@ -18,8 +18,79 @@
* Rights Reserved.
*/
var rdfDatasourcePrefix = "component://netscape/rdf/datasource?name=";
var rdfServiceProgID = "component://netscape/rdf/rdf-service";
var searchSessionProgID = "component://netscape/messenger/searchSession";
var gSearchDatasource;
var nsIMsgFolder = Components.interfaces.nsIMsgFolder;
var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
var gFolderPicker;
var RDF;
function searchOnLoad() {
initializeSearchWidgets();
initializeSearchWindowWidgets();
setSearchScope(0);
setupDatasource();
}
function initializeSearchWindowWidgets()
{
gFolderPicker = document.getElementById("searchableFolders");
gResultsTree = document.getElementById("threadTree");
}
function onChooseFolder(event) {
dump("event.target = " + event.target.id + "\n");
SetFolderPicker(event.target.id, gFolderPicker.id);
// use the URI to get the real folder
gCurrentFolder =
RDF.GetResource(event.target.id).QueryInterface(nsIMsgFolder);
// tell the search session what the new scope is
gSearchSession.AddScopeTerm(GetScopeForFolder(gCurrentFolder),
gCurrentFolder)
}
function GetScopeForFolder(folder) {
if (folder.server.type == "nntp")
return nsMsgSearchScope.Newsgroup;
else
return nsMsgSearchScope.MailFolder;
}
function setupDatasource() {
RDF = Components.classes[rdfServiceProgID].getService(Components.interfaces.nsIRDFService);
gSearchDatasource = Components.classes[rdfDatasourcePrefix + "msgsearch"].createInstance(Components.interfaces.nsIRDFDataSource);
// the thread pane needs to use the search datasource (to get the
// actual list of messages) and the message datasource (to get any
// attributes about each message)
gSearchSession = Components.classes[searchSessionProgID].createInstance(Components.interfaces.nsIMsgSearchSession);
gResultsTree.database.AddDataSource(gSearchDatasource);
// the datasource is a listener on the search results
searchListener = gSearchDatasource.QueryInterface(Components.interfaces.nsIMsgSearchNotify);
gSearchSession.RegisterListener(searchListener);
}
// stub functions for thread pane
function ChangeThreadView() {
dump("Not supported, column should be hidden!\n");
}
function MsgSortBySubject() {
dump("Sort by subject..\n");
}

View File

@ -24,6 +24,7 @@ Rights Reserved.
<?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
<?xul-overlay href="chrome://messenger/content/threadPane.xul"?>
<?xul-overlay href="chrome://messenger/content/searchTermOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/msgFolderPickerOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://messenger/locale/SearchDialog.dtd" >
@ -34,18 +35,15 @@ Rights Reserved.
class="dialog"
orient="vertical">
<script src="chrome://messenger/content/SearchDialog.js"/>
<script src="chrome://global/content/strres.js"/>
<script src="chrome://messenger/content/SearchDialog.js"/>
<script src="chrome://messenger/content/msgFolderPickerOverlay.js"/>
<text value="This dialog is a work in progress! Please don't file any bugs against it."/>
<box>
<text class="label" value="&searchHeading.label;"/>
<menulist>
<menupopup>
<menuitem value="sample1"/>
<menuitem value="sample1"/>
<menuitem value="sample1"/>
</menupopup>
</menulist>
<menulist id="searchableFolders" flex="2"
oncommand="onChooseFolder(event)"/>
<spring flex="1"/>
<checkbox value="&searchSubfolders.label;"/>
</box>