Bug 905155 Stop building the XPFE autocomplete component r=Standard8

DONTBUILD (was only ever used by SeaMonkey and Thunderbird)

--HG--
extra : rebase_source : 41fc25e33ebf2824d767cc61e02b66a235a47d3a
This commit is contained in:
Neil Rashbrook 2013-08-18 00:17:52 +01:00
parent d19b8c335a
commit ab3b6bb47b
11 changed files with 0 additions and 613 deletions

View File

@ -3,5 +3,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['public', 'src']

View File

@ -1,16 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_SOURCES += [
'nsIAutoCompleteListener.idl',
'nsIAutoCompleteResults.idl',
'nsIAutoCompleteSession.idl',
]
XPIDL_MODULE = 'xpautocomplete'
MODULE = 'appcomps'

View File

@ -1,41 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
#include "nsIAutoCompleteResults.idl"
typedef long AutoCompleteStatus;
[scriptable, uuid(4BA0A180-097C-11d4-A449-CD1A8B47ED7C)]
interface nsIAutoCompleteStatus {
const long failed = -1;
const long noMatch = 0;
const long matchFound = 1;
const long ignored = 2;
// like failed, in that no successful matches were found, however,
// results should be displayed anyway, because they contain info about
// the failure in question
//
const long failureItems = 3;
// the following status values indicate that the async search hasn't ended
const long noMatchYet = 4;
const long matchSoFar = 5;
};
[scriptable, uuid(4BA0A181-097C-11d4-A449-CD1A8B47ED7C)]
interface nsIAutoCompleteListener : nsISupports {
/* onStatus is called by the autocomplete session during the search */
void onStatus(in wstring statusText);
/* onAutoComplete is called by the autocomplete session when the search is done or over */
void onAutoComplete(in nsIAutoCompleteResults result, in AutoCompleteStatus status);
/* private param used by the autocomplete widget */
attribute nsISupports param;
};

View File

@ -1,74 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
#include "nsISupportsArray.idl"
[scriptable, uuid(88DCFA80-062F-11d4-a449-B36A1A94C0FC)]
interface nsIAutoCompleteItem : nsISupports {
/**
* the result value
* using AString to avoid excess allocations
*/
attribute AString value;
/**
* an extra comment that will be
* displayed next to the value but that
* will not be part of the value
* itself
*/
attribute wstring comment;
/**
* class name used to define some style through
* css like the colors, an icon url, etc...
*/
attribute string className;
/**
* parameter use by the search engine
*/
attribute nsISupports param;
};
[scriptable, uuid(88DCFA81-062F-11d4-a449-B36A1A94C0FC)]
interface nsIAutoCompleteResults : nsISupports {
/**
* the original search string
*/
attribute wstring searchString;
/**
* Array of result items (nsIAutoCompleteItem)
*/
attribute nsISupportsArray items;
/**
* Index (0 base) of the default item that
* will be preselected and displayed
*/
attribute long defaultItemIndex;
/**
* param use by the the search engine
*/
attribute nsISupports param;
};
%{ C++
// {FE4FC780-063D-11d4-A449-D45A120774BC}
#define NS_AUTOCOMPLETERESULTS_CID \
{ 0xfe4fc780, 0x063d, 0x11d4, { 0xa4, 0x49, 0xd4, 0x5a, 0x12, 0x07, 0x74, 0xbc } }
#define NS_AUTOCOMPLETERESULTS_CONTRACTID "@mozilla.org/autocomplete/results;1"
// {FE4FC781-063D-11d4-A449-D45A120774BC}
#define NS_AUTOCOMPLETEITEM_CID \
{ 0xfe4fc781, 0x063d, 0x11d4, { 0xa4, 0x49, 0xd4, 0x5a, 0x12, 0x07, 0x74, 0xbc } }
#define NS_AUTOCOMPLETEITEM_CONTRACTID "@mozilla.org/autocomplete/item;1"
%}

View File

@ -1,29 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
%{ C++
#include "nsIAutoCompleteResults.h"
#include "nsIAutoCompleteListener.h"
%}
interface nsIAutoCompleteResults;
interface nsIAutoCompleteListener;
[scriptable, uuid(E0140B60-0264-11d4-8378-000000000000)]
interface nsIAutoCompleteSession : nsISupports {
/* onStartLookup is called when the user has stop typing for a predifined elapse time */
void onStartLookup(in wstring searchString, in nsIAutoCompleteResults previousSearchResult,
in nsIAutoCompleteListener listener);
/* onStopLookup is called each time the user press a key */
void onStopLookup();
/* onAutoComplete is called either when the user press enter/return or when the input element loses focus */
void onAutoComplete(in wstring searchString, in nsIAutoCompleteResults previousSearchResult,
in nsIAutoCompleteListener listener);
};

View File

@ -1,16 +0,0 @@
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
EXPORT_LIBRARY = 1
LIBXUL_LIBRARY = 1
include $(topsrcdir)/config/rules.mk

View File

@ -1,14 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MODULE = 'appcomps'
CPP_SOURCES += [
'nsAutoComplete.cpp',
]
LIBRARY_NAME = 'xpautocomplete'

View File

@ -1,170 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsCOMPtr.h"
#include "nsAutoComplete.h"
#include "nsComponentManagerUtils.h"
#include "mozilla/ModuleUtils.h"
/******************************************************************************
* nsAutoCompleteItem
******************************************************************************/
NS_IMPL_ISUPPORTS1(nsAutoCompleteItem, nsIAutoCompleteItem)
nsAutoCompleteItem::nsAutoCompleteItem()
{
}
nsAutoCompleteItem::~nsAutoCompleteItem()
{
}
NS_IMETHODIMP nsAutoCompleteItem::GetValue(nsAString& aValue)
{
aValue.Assign(mValue);
return NS_OK;
}
NS_IMETHODIMP nsAutoCompleteItem::SetValue(const nsAString& aValue)
{
mValue.Assign(aValue);
return NS_OK;
}
NS_IMETHODIMP nsAutoCompleteItem::GetComment(PRUnichar * *aComment)
{
if (!aComment) return NS_ERROR_NULL_POINTER;
*aComment = ToNewUnicode(mComment);
return NS_OK;
}
NS_IMETHODIMP nsAutoCompleteItem::SetComment(const PRUnichar * aComment)
{
mComment = aComment;
return NS_OK;
}
/* attribute string className; */
NS_IMETHODIMP nsAutoCompleteItem::GetClassName(char * *aClassName)
{
if (!aClassName) return NS_ERROR_NULL_POINTER;
*aClassName = ToNewCString(mClassName);
return NS_OK;
}
NS_IMETHODIMP nsAutoCompleteItem::SetClassName(const char * aClassName)
{
mClassName.Assign(aClassName);
return NS_OK;
}
/* attribute nsISupports param; */
NS_IMETHODIMP nsAutoCompleteItem::GetParam(nsISupports * *aParam)
{
if (!aParam) return NS_ERROR_NULL_POINTER;
*aParam = mParam;
NS_IF_ADDREF(*aParam);
return NS_OK;
}
NS_IMETHODIMP nsAutoCompleteItem::SetParam(nsISupports * aParam)
{
mParam = aParam;
return NS_OK;
}
/******************************************************************************
* nsAutoCompleteResults
******************************************************************************/
NS_IMPL_ISUPPORTS1(nsAutoCompleteResults, nsIAutoCompleteResults)
nsAutoCompleteResults::nsAutoCompleteResults() :
mItems(do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID)),
mDefaultItemIndex(0)
{
}
nsAutoCompleteResults::~nsAutoCompleteResults()
{
}
NS_IMETHODIMP nsAutoCompleteResults::GetSearchString(PRUnichar * *aSearchString)
{
if (!aSearchString) return NS_ERROR_NULL_POINTER;
*aSearchString = ToNewUnicode(mSearchString);
return NS_OK;
}
NS_IMETHODIMP nsAutoCompleteResults::SetSearchString(const PRUnichar * aSearchString)
{
mSearchString = aSearchString;
return NS_OK;
}
NS_IMETHODIMP nsAutoCompleteResults::GetParam(nsISupports * *aParam)
{
if (!aParam) return NS_ERROR_NULL_POINTER;
*aParam = mParam;
NS_IF_ADDREF(*aParam);
return NS_OK;
}
NS_IMETHODIMP nsAutoCompleteResults::SetParam(nsISupports * aParam)
{
mParam = aParam;
return NS_OK;
}
NS_IMETHODIMP nsAutoCompleteResults::GetItems(nsISupportsArray * *aItems)
{
if (!aItems) return NS_ERROR_NULL_POINTER;
*aItems = mItems;
NS_IF_ADDREF(*aItems);
return NS_OK;
}
NS_IMETHODIMP nsAutoCompleteResults::SetItems(nsISupportsArray * aItems)
{
mItems = aItems;
return NS_OK;
}
NS_IMETHODIMP nsAutoCompleteResults::GetDefaultItemIndex(int32_t *aDefaultItemIndex)
{
if (!aDefaultItemIndex) return NS_ERROR_NULL_POINTER;
*aDefaultItemIndex = mDefaultItemIndex;
return NS_OK;
}
NS_IMETHODIMP nsAutoCompleteResults::SetDefaultItemIndex(int32_t aDefaultItemIndex)
{
mDefaultItemIndex = aDefaultItemIndex;
return NS_OK;
}
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteItem)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteResults)
NS_DEFINE_NAMED_CID(NS_AUTOCOMPLETERESULTS_CID);
NS_DEFINE_NAMED_CID(NS_AUTOCOMPLETEITEM_CID);
const mozilla::Module::CIDEntry kAutoCompleteCIDs[] = {
{ &kNS_AUTOCOMPLETERESULTS_CID, false, NULL, nsAutoCompleteResultsConstructor },
{ &kNS_AUTOCOMPLETEITEM_CID, false, NULL, nsAutoCompleteItemConstructor },
{ NULL }
};
const mozilla::Module::ContractIDEntry kAutoCompleteContracts[] = {
{ NS_AUTOCOMPLETERESULTS_CONTRACTID, &kNS_AUTOCOMPLETERESULTS_CID },
{ NS_AUTOCOMPLETEITEM_CONTRACTID, &kNS_AUTOCOMPLETEITEM_CID },
{ NULL }
};
static const mozilla::Module kAutoCompleteModule = {
mozilla::Module::kVersion,
kAutoCompleteCIDs,
kAutoCompleteContracts
};
NSMODULE_DEFN(xpAutoComplete) = &kAutoCompleteModule;

View File

@ -1,54 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsAutoComplete_h___
#define nsAutoComplete_h___
#include "nsCOMPtr.h"
#include "nsStringGlue.h"
#include "nsIAutoCompleteResults.h"
/******************************************************************************
* nsAutoCompleteItem
******************************************************************************/
class nsAutoCompleteItem : public nsIAutoCompleteItem
{
public:
nsAutoCompleteItem();
virtual ~nsAutoCompleteItem();
NS_DECL_ISUPPORTS
NS_DECL_NSIAUTOCOMPLETEITEM
private:
nsString mValue;
nsString mComment;
nsCString mClassName;
nsCOMPtr<nsISupports> mParam;
};
/******************************************************************************
* nsAutoCompleteResults
******************************************************************************/
class nsAutoCompleteResults : public nsIAutoCompleteResults
{
public:
nsAutoCompleteResults();
virtual ~nsAutoCompleteResults();
NS_DECL_ISUPPORTS
NS_DECL_NSIAUTOCOMPLETERESULTS
private:
nsString mSearchString;
nsCOMPtr<nsISupportsArray> mItems;
int32_t mDefaultItemIndex;
nsCOMPtr<nsISupports> mParam;
};
#endif

View File

@ -1,189 +0,0 @@
<?xml-stylesheet href="chrome://messenger/skin/messenger.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
<window id="actest"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:nc="http://home.netscape.com/NC-rdf#"
orient="vertical"
width="750"
height="500"
onload="Initialize();"
>
<script type="application/x-javascript">
var AutoCompleteSession = {
onStartLookup: function(value, prevResult, listener)
{
dump("Search Session: onStartLookup\n");
var results = Components.classes["@mozilla.org/autocomplete/results;1"].createInstance();
results = results.QueryInterface(Components.interfaces.nsIAutoCompleteResults);
results.searchString = value;
results.defaultItemIndex = 0;
results.param = null;
var item = Components.classes["@mozilla.org/autocomplete/item;1"].createInstance();
item = item.QueryInterface(Components.interfaces.nsIAutoCompleteItem);
item.value = "Jean-Francois Ducarroz";
item.comment = "[put your comment here]";
item.className = "";
item.param = null;
results.items.AppendElement(item);
listener.onAutoComplete(results, Components.interfaces.nsIAutoCompleteStatus.matchFound);
},
onStopLookup: function()
{
dump("Search Session: onStopLookup\n");
},
onAutoComplete: function(value, prevResult, listener)
{
dump("Search Session: onAutoComplete, value =" + value + "\n");
var results = Components.classes["@mozilla.org/autocomplete/results;1"].createInstance();
results = results.QueryInterface(Components.interfaces.nsIAutoCompleteResults);
results.searchString = value;
results.defaultItemIndex = 0;
results.param = null;
var item = Components.classes["@mozilla.org/autocomplete/item;1"].createInstance();
item = item.QueryInterface(Components.interfaces.nsIAutoCompleteItem);
item.value = value + "@mozilla.org";
item.comment = "[put your comment here]";
item.className = "";
item.param = null;
results.items.AppendElement(item);
item = Components.classes["@mozilla.org/autocomplete/item;1"].createInstance();
item = item.QueryInterface(Components.interfaces.nsIAutoCompleteItem);
item.value = value + "@netscape.com";
item.comment = "[put your comment here]";
item.className = "";
item.param = null;
results.items.AppendElement(item);
listener.onAutoComplete(results, Components.interfaces.nsIAutoCompleteStatus.matchFound);
}
};
function function1()
{
var myAutoComplete = document.getElementById("test");
value = myAutoComplete.value;
match = "Jean-Francois Ducarroz";
lmatch = match.toLowerCase();
lvalue = value.toLowerCase();
dump("value = " + lvalue + ", match = " + lmatch + "\n");
if (lvalue == lmatch)
dump("exact match\n");
else
{
dump("substring = " + lmatch.substring(0, lvalue.length) + "\n");
if (lmatch.substring(0, lvalue.length) == lvalue)
{
dump("Ok, we can merge\n");
myAutoComplete.value = value + match.substring(value.length, match.length);
// myAutoComplete.anonymousContent[0].firstChild.anonymousContent[0].firstChild.setSelectionRange(value.length, match.length);
}
else
{
dump("oops, no match!\n");
myAutoComplete.value = value + " " + match;
}
}
}
function Initialize()
{
dump("Initialize!!\n");
var myAutoComplete = document.getElementById("test");
dump("myAutoComplete = " + myAutoComplete + ", session = " + myAutoComplete.mSessions + "\n");
myAutoComplete.autoCompleteSession = AutoCompleteSession;
var secondAutoComplete = document.getElementById("test2");
abSession = secondAutoComplete.mSessions['addrbook'].QueryInterface(Components.interfaces.nsIAbAutoCompleteSession);
abSession.defaultDomain = "mozilla.org";
var thirdAutoComplete = document.getElementById("test3");
var abSession3 = thirdAutoComplete.mSessions['ldap'].QueryInterface(Components.interfaces.nsILDAPAutoCompleteSession);
dump("\nthirdAutoComplete = " + thirdAutoComplete + "\n");
dump("thirdAutoComplete.mSessions['ldap'] = " +
thirdAutoComplete.mSessions['ldap'] + "\n");
dump("abSession3 = " + abSession3 + "\n");
var serverURL = Components.classes["@mozilla.org/network/ldap-url;1"].
createInstance().QueryInterface( Components.interfaces.nsILDAPURL);
//serverURL.spec = "ldap://ldap.bigfoot.com:389/??one?";
serverURL.spec = "ldap://nsdirectory.netscape.com/ou=People," +
"dc=netscape,dc=com??one";
abSession3.serverURL = serverURL;
abSession3.filterTemplate = "sn=";
abSession3.outputFormat = "cn &lt;mail&gt;";
abSession3.sizeLimit = 10;
var fourthAutoComplete = document.getElementById("test3");
var abSession4 = fourthAutoComplete.mSessions['ldap'].QueryInterface(Components.interfaces.nsILDAPAutoCompleteSession);
dump("\nfourthAutoComplete = " + fourthAutoComplete + "\n");
dump("fourthAutoComplete.mSessions['ldap'] = " +
fourthAutoComplete.mSessions['ldap'] + "\n");
dump("abSession4 = " + abSession4 + "\n");
var serverURL4 = Components.classes["@mozilla.org/network/ldap-url;1"].
createInstance().QueryInterface( Components.interfaces.nsILDAPURL);
//serverURL4.spec = "ldap://ldap.bigfoot.com:389/??one?";
serverURL4.spec = "ldap://nsdirectory.netscape.com/ou=People," +
"dc=netscape,dc=com??one";
abSession3.serverURL = serverURL4;
abSession3.filterTemplate = "sn=";
abSession3.outputFormat = "cn &lt;mail&gt;";
abSession3.sizeLimit = 10;
}
</script>
<html>Inline JS:</html>
<textbox id="test" timeout="300" type="autocomplete" />
<html>addrbook:</html>
<textbox id="test2"
type="autocomplete"
searchSessions="addrbook"
timeout="300"
onkeypress="if (event.keyCode == 13) dump('Done, value=' + this.value + '\n');"
/>
<html>ldap:</html>
<textbox id="test3"
type="autocomplete"
searchSessions="ldap"
timeout="300"
onkeypress="if (event.keyCode == 13) dump('Done, value=' + this.value + '\n');"
/>
<html>composite (addrbook, ldap):</html>
<textbox id="test3"
type="autocomplete"
searchSessions="addrbook ldap"
timeout="300"
onkeypress="if (event.keyCode == 13) dump('Done, value=' + this.value + '\n');"
/>
</window>

View File

@ -1,8 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MODULE = 'appcomps'