finally hook up search, and bring filters more in line with the way search does things

r=sspitzer
#33101
This commit is contained in:
alecf%netscape.com 2000-06-18 05:52:03 +00:00
Родитель 82144ebae8
Коммит 621092769d
4 изменённых файлов: 34 добавлений и 32 удалений

Просмотреть файл

@ -191,6 +191,12 @@ function saveFilter() {
return true;
}
function onTargetFolderSelected(event)
{
SetFolderPicker(event.target.id, gActionTargetElement.id);
}
function onActionChanged(event)
{
var menuitem = event.target;

Просмотреть файл

@ -20,7 +20,7 @@ Rights Reserved.
-->
<?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/dialogOverlay.xul">
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/msgFolderPickerOverlay.xul"?>
<?xul-overlay href="chrome://messenger/content/searchTermOverlay.xul"?>
@ -34,8 +34,9 @@ Rights Reserved.
persist="width heigh screenX screenY"
onload="filterEditorOnLoad('msgFccFolderPicker');">
<script language="JavaScript" src="chrome://messenger/content/FilterEditor.js"/>
<script language="JavaScript" src="chrome://global/content/strres.js"/>
<script language="JavaScript" src="chrome://messenger/content/FilterEditor.js"/>
<keyset id="keyset"/>
<box orient="horizontal" class="padded">
<text value="&filterName.label;"/>
@ -58,28 +59,8 @@ Rights Reserved.
</menulist>
<deck id="actionValueDeck" flex="1">
<menulist id="actionTargetFolder" flex="1"
containment="http://home.netscape.com/NC-rdf#child"
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="..." data="..." value="rdf:http://home.netscape.com/NC-rdf#Name"/>
<menuseparator/>
</menupopup>
</menu>
</menupopup>
</rule>
<rule>
<menupopup>
<menuitem uri="..." data="..." value="rdf:http://home.netscape.com/NC-rdf#Name"/>
</menupopup>
</rule>
</template>
<menupopup/>
</menulist>
oncommand="onTargetFolderSelected(event);"/>
<menulist id="actionValuePriority">
<menupopup>
<!-- see MailNewsTypes2.idl -->

Просмотреть файл

@ -1,4 +1,4 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
/* -*- 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
@ -30,12 +30,14 @@ var gFolderPicker;
var RDF;
function searchOnLoad() {
function searchOnLoad()
{
initializeSearchWidgets();
initializeSearchWindowWidgets();
setSearchScope(0);
setupDatasource();
onMore(null);
}
function initializeSearchWindowWidgets()
@ -53,12 +55,20 @@ function onChooseFolder(event) {
gCurrentFolder =
RDF.GetResource(event.target.id).QueryInterface(nsIMsgFolder);
}
function onSearch(event)
{
// tell the search session what the new scope is
gSearchSession.AddScopeTerm(GetScopeForFolder(gCurrentFolder),
gSearchSession.addScopeTerm(GetScopeForFolder(gCurrentFolder),
gCurrentFolder)
saveSearchTerms(gSearchSession.searchTerms, gSearchSession);
gSearchSession.search(null);
}
function GetScopeForFolder(folder) {
if (folder.server.type == "nntp")
return nsMsgSearchScope.Newsgroup;
@ -72,7 +82,9 @@ function setupDatasource() {
gSearchDatasource = Components.classes[rdfDatasourcePrefix + "msgsearch"].createInstance(Components.interfaces.nsIRDFDataSource);
dump("The root is " + gSearchDatasource.URI + "\n");
gResultsTree.setAttribute("ref", gSearchDatasource.URI);
// 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)
@ -80,9 +92,13 @@ function setupDatasource() {
gResultsTree.database.AddDataSource(gSearchDatasource);
var messageDatasource = Components.classes[rdfDatasourcePrefix + "mailnewsmessages"].createInstance(Components.interfaces.nsIRDFDataSource);
gResultsTree.database.AddDataSource(messageDatasource);
// the datasource is a listener on the search results
searchListener = gSearchDatasource.QueryInterface(Components.interfaces.nsIMsgSearchNotify);
gSearchSession.RegisterListener(searchListener);
gSearchSession.registerListener(searchListener);
}

Просмотреть файл

@ -37,7 +37,6 @@ Rights Reserved.
<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>
@ -51,8 +50,8 @@ Rights Reserved.
<box>
<titledbox id="searchTermListBox" flex="1"/>
<box orient="vertical">
<button value="&searchButton.label;"/>
<button value="&resetButton.label;"/>
<button value="&searchButton.label;" onclick="onSearch(event)"/>
<button value="&resetButton.label;" onclick="onReset(event)"/>
</box>
</box>