From 51d0cad0816369d6b150c995c8f899d0f65312ea Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Sun, 18 Aug 2002 20:05:23 +0000 Subject: [PATCH] from blake's branch checkins: "Autocomplete modifications to work with comma-delimited list." git-svn-id: svn://10.0.0.236/trunk@127566 18797224-902f-48f8-a5cc-f745e15eee43 --- .../compose/content/autocomplete.xml | 1649 +++++++++++++++++ mozilla/mail/components/compose/jar.mn | 14 +- 2 files changed, 1658 insertions(+), 5 deletions(-) create mode 100644 mozilla/mail/components/compose/content/autocomplete.xml diff --git a/mozilla/mail/components/compose/content/autocomplete.xml b/mozilla/mail/components/compose/content/autocomplete.xml new file mode 100644 index 00000000000..b0fa46e17fc --- /dev/null +++ b/mozilla/mail/components/compose/content/autocomplete.xml @@ -0,0 +1,1649 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + null + null + null + null + null + 0 + false + false + false + false + false + false + null + null + false + null + null + null + null + false + + + + + + + + + + + = 0) { + var item = this.mLastResults[obj.session].items.QueryElementAt(obj.index, nsIAutoCompleteItem); + return item; + } + } + return null; + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0) + return name; + } + return null; + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 && results.defaultItemIndex != -1) + { + defaultSession = name; + break; + } + } + + if (defaultSession) { + results = this.mLastResults[defaultSession]; + if (results && !this.noMatch) { + var commaPos = this.value.lastIndexOf(","); + if (commaPos != -1) + str = this.value.substr(0, commaPos + 1) + " "; + else + str = ""; + + if (results.defaultItemIndex != -1) + str += this.getSessionValueAt(defaultSession, results.defaultItemIndex); + else + str += this.getSessionValueAt(defaultSession, 0); // preselect the first one... + this.value = str; + } + } + } + + this.closeResultPopup(); + } + + this.mNeedToComplete = false; + this.clearTimer(); + + if (aFireTextCommand) + this._fireEvent("textcommand", this.userAction, aTriggeringEvent); + ]]> + + + + + + + + + + + + + + + + = aIndex) { + return {session: name, index: aIndex-idx}; + } + idx += this.mLastResults[name].items.Count(); + } + } + return null; + ]]> + + + + + + + = str.length) + this.mAutoCompleteTimer = setTimeout(this.callListener, this.timeout, this, "startLookup"); + else + this.noMatch = true; + ]]> + + + + + + + + + + + + 0 || this.alwaysOpenPopup)) { + this.openResultPopup(); + return; + } + + this.userAction = "scrolling"; + this.mNeedToComplete = false; + + var dir = k == KeyEvent.DOM_VK_DOWN || + k == KeyEvent.DOM_VK_PAGE_DOWN || + (k == KeyEvent.DOM_VK_TAB && !aEvent.shiftKey) ? 1 : -1; + var amt = k == KeyEvent.DOM_VK_PAGE_UP || + k == KeyEvent.DOM_VK_PAGE_DOWN ? this.resultsPopup.pageCount-1 : 1; + var selected = this.resultsPopup.selectBy(dir, amt); + + // determine which value to place in the textbox + this.ignoreInputEvent = true; + if (selected != null) { + if (this.getSessionStatusAt(selected) == + Components.interfaces.nsIAutoCompleteStatus.failureItems) { + if (this.currentSearchString) { + var commaPos = this.value.lastIndexOf(","); + if (commaPos != -1) + this.value = this.value.substr(0, commaPos + 1) + " " + this.currentSearchString; + else + this.value = this.currentSearchString; + } + } else { + var result = this.getResultValueAt(selected); + var commaPos = this.value.lastIndexOf(","); + if (commaPos != -1) + this.value = this.value.substr(0, commaPos + 1) + " " + result; + else + this.value = result; + } + this.mTransientValue = true; + } else { + var commaPos = this.value.lastIndexOf(","); + if (commaPos != -1) + this.value = this.value.substr(0, commaPos + 1) + " " + this.currentSearchString; + else + this.value = this.currentSearchString; + this.mTransientValue = false; + } + + // move cursor to the end + this.mInputElt.setSelectionRange(this.value.length, this.value.length); + this.ignoreInputEvent = false; + } + ]]> + + + + + + + + > " + resultValue; + this.mInputElt.setSelectionRange(currLength, this.value.length); + } else { + var commaPos = this.value.lastIndexOf(","); + var str; + if (commaPos != -1) + str = this.trim(this.value.substr(commaPos + 1)); + else + str = this.value; + var postIndex = resultValue.indexOf(str); + if (postIndex >= 0) { + var startPt = this.value.length; + this.value = this.value + resultValue.substr(startPt+postIndex); + this.mInputElt.setSelectionRange(startPt, this.value.length); + } + } + } + this.mNeedToComplete = true; + this.ignoreInputEvent = false; + this.mDefaultMatchFilled = true; + } + } + ]]> + + + + + + + = this.minResultsForPopup + || this.mFailureItems)) { + var w = this.boxObject.width; + if (w != this.resultsPopup.boxObject.width) + this.resultsPopup.setAttribute("width", w); + this.resultsPopup.removeAttribute("hidden"); + this.resultsPopup.showPopup(this, -1, -1, "popup", "bottomleft", "topleft"); + this.mMenuOpen = true; + } + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + document.getAnonymousElementByAttribute(this, "anonid", "tree"); + + + + document.getAnonymousElementByAttribute(this, "anonid", "treecols"); + + + + document.getAnonymousElementByAttribute(this, "anonid", "treebody"); + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + aMaxRow && aIndex != aMaxRow) + newIdx = aMaxRow; + else if (aDir > 0 && aIndex == null || newIdx < 0 && aIndex != 0) + newIdx = 0; + + if (newIdx < 0 && aIndex == 0 || newIdx > aMaxRow && aIndex == aMaxRow) + aIndex = null; + else + aIndex = newIdx; + + return aIndex; + ]]> + + + + + + + + + + + + this.textbox.mMenuOpen = true; + + + + this.textbox.mMenuOpen = false; + this.selectedIndex = null; + + + + + + + + + + + + + + + + + + + + + + new Date() + + + + = 0) + return {row: row.value, column: col.value}; + else + return null; + ]]> + + + + + + + + 30) { + var rc = this.getHoverCell(event); + if (rc && rc.row != this.textbox.view.selectedIndex) + this.textbox.view.selectedIndex = rc.row; + this.mLastMoveTime = new Date(); + } + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mozilla/mail/components/compose/jar.mn b/mozilla/mail/components/compose/jar.mn index ff69cb93ec9..21071cdb34f 100644 --- a/mozilla/mail/components/compose/jar.mn +++ b/mozilla/mail/components/compose/jar.mn @@ -1,11 +1,15 @@ messenger.jar: -+ content/messenger/messengercompose/addressingWidgetOverlay.js (content/addressingWidgetOverlay.js) -+ content/messenger/messengercompose/addressingWidgetOverlay.xul (content/addressingWidgetOverlay.xul) -+ content/messenger/messengercompose/MsgComposeCommands.js (content/MsgComposeCommands.js) -+ content/messenger/messengercompose/messengercompose.xul (content/messengercompose.xul) ++ content/messenger/messengercompose/addressingWidgetOverlay.js (content/addressingWidgetOverlay.js) ++ content/messenger/messengercompose/addressingWidgetOverlay.xul (content/addressingWidgetOverlay.xul) ++ content/messenger/messengercompose/MsgComposeCommands.js (content/MsgComposeCommands.js) ++ content/messenger/messengercompose/messengercompose.xul (content/messengercompose.xul) ++ content/messenger/addressbook/abCommon.js (content/abCommon.js) + +toolkit.jar: + content/global/autocomplete.xml (content/autocomplete.xml) en-US.jar: -+ locale/en-US/messenger/messengercompose/messengercompose.dtd (locale/messengercompose.dtd) ++ locale/en-US/messenger/messengercompose/messengercompose.dtd (locale/messengercompose.dtd) classic.jar: skin/classic/messenger/icons/more-disabled.gif (skin/more-disabled.gif)