Open
Bug 28769
Opened 26 years ago
Updated 14 years ago
Auto-complete server names based on e-mail address
Categories
(SeaMonkey :: MailNews: Account Configuration, enhancement)
SeaMonkey
MailNews: Account Configuration
Tracking
(Not tracked)
ASSIGNED
People
(Reporter: mpt, Assigned: iannbugzilla)
Details
Attachments
(1 file, 7 obsolete files)
2.90 KB,
patch
|
neil
:
review+
|
Details | Diff | Splinter Review |
This broke out of bug 28589.
When a user is entering the incoming and outgoing server names in the account
manager, the fields should auto-complete based on the domain part of their e-mail
address (which they have just entered in the previous page of the wizard).
For example, if I have entered my e-mail address as xyz@foo.bar, and I then start
typing `imaphost.f' in the incoming mail server field, Mozilla should
auto-complete with `oo.bar'.
Reporter | ||
Comment 1•26 years ago
|
||
[Changing helpwanted flag to keyword, as per bug 28345.]
Keywords: helpwanted
Summary: [helpwanted] Auto-complete server names based on e-mail address → Auto-complete server names based on e-mail address
Comment 2•24 years ago
|
||
Adds a function that is triggered by keyup and autocompletes if possible.
Comment 3•24 years ago
|
||
Only autocompletes on first char or after a '.' (correctly now).
Please make old patch obsolete.
Attachment #61694 -
Attachment is obsolete: true
Updated against current trunk but for some reason doesn't work from chrome but
does from file
Attachment #61767 -
Attachment is obsolete: true
Current patch has some diagnostic dumps in but they don't seem to generate
anything :-(
Patch against AccountWizard.xul rather than aw-server.xul
Attachment #121822 -
Attachment is obsolete: true
Attachment #121826 -
Flags: review?(neil)
Comment 9•22 years ago
|
||
Comment on attachment 121826 [details] [diff] [review]
Patch v1.1
>+ // only autocomplete on characters
>+ if (keyCode < 48)
>+ return true;
Better to test for a nonzero charCode.
>+ // only autocomplete on first char or after a '.'
Actually this code doesn't (and perhaps should not) complete on the first char,
since it only autocompletes if a '.' is found. You could use a do loop to test
the whole servername first.
>+
>+ var shortname = servername;
>+ var j = shortname.indexOf('.') + 1;
>+ while (j > 0 && j < shortname.length)
Perhaps you are trying not to autocomplete after a '.' is typed... even if
that's the intent you should still check charCode above.
>+ {
>+ shortname = shortname.substring(j, shortname.length);
Don't need 2nd parameter to substring here or elsewhere when all you want is
the rest of the string
>+ if (emailArray[1].substring(0, shortname.length) == shortname) {
Should this be a case-insensitive match? (lowercase the email address and
shortname before the loop)
>+ servernameElement.select();
Don't need this, you're setting the selection again
Attachment #121826 -
Flags: review?(neil) → review-
Assignee | ||
Comment 10•22 years ago
|
||
If I was to check for non zero charCode I couldn't use onkeyup as that only
seems to generate zero charCodes I'd have to use onkeypress instead. That would
introduce it's own problems in that at the time of that event the character will
not have been added to the textbox. Updated function, keeping with onkeyup,
would look something like this:
function serverKeyup(keyCode, name)
{
// only autocomplete on characters
if (keyCode < 33 || keyCode > 126 || keyCode == 46)
return true;
var servernameElement = document.getElementById(name);
var servername = servernameElement.value.toLowerCase();
var pageData = parent.GetPageData();
var emailArray = pageData.identity.email.value.split('@');
var email = emailArray[1].toLowerCase();
// only autocomplete on first char after a '.'
var shortname = servername;
var j = shortname.indexOf('.') + 1;
while (j > 0 && j < shortname.length)
{
shortname = shortname.substring(j);
if (email.substring(0, shortname.length) == shortname) {
servernameElement.value = servername + email.substring(shortname.length);
servernameElement.selectionStart = servername.length;
servernameElement.selectionEnd = servernameElement.value.length;
return true;
}
j = shortname.indexOf('.') + 1;
}
return true;
}
Assignee | ||
Comment 11•22 years ago
|
||
Attachment #121826 -
Attachment is obsolete: true
Assignee | ||
Comment 12•22 years ago
|
||
Goes back to the do loop structure of James' original patch
Attachment #122512 -
Attachment is obsolete: true
Attachment #122515 -
Flags: review?(neil.parkwaycc.co.uk)
Comment 13•22 years ago
|
||
Comment on attachment 122515 [details] [diff] [review]
Patch v1.3
I'm not sure you don't want to autocomplete after a "." - say my email was
pov@bbc.co.uk then after I'd typed mail.bbc. I'd expect to see "co.uk"
autocompleted.
I've peeked into how "regular" autocomplete does it, it uses an onkeypress to
save the last key and an oninput to do the dirty work.
Also, I don't see the point of passing an id to serverKeyup when you can pass
the element itself (in the inline event handler the "this" keyword refers to
it).
Attachment #122515 -
Flags: review?(neil.parkwaycc.co.uk)
Assignee | ||
Comment 14•22 years ago
|
||
this seems to be [object ChromeWindow] when called from onkeypress, is that right?
Autocomplete seems to work as you suggested already.
Comment 15•22 years ago
|
||
I was wondering why you tested for key == 46 (I haven't had time to try it).
The meaning of "this" depends on context - in <element
onkeyup="doSomething(this);"> it's the element, but in function doSomething(arg)
{ dump(arg); dump(this); } it's the window.
Comment 16•22 years ago
|
||
Comment on attachment 122515 [details] [diff] [review]
Patch v1.3
>+ // only autocomplete on characters
>+ if (keyCode < 33 || keyCode > 126 || keyCode == 46)
>+ return true;
>+
>+ var servernameElement = document.getElementById(name);
>+ var servername = servernameElement.value.toLowerCase();
>+
>+ var pageData = parent.GetPageData();
>+ var emailArray = pageData.identity.email.value.split('@');
>+ var email = emailArray[1].toLowerCase();
>+
>+ // only autocomplete on first char or after a '.'
Except you don't autocomplete after a '.' because you exclude it above :-(
Attachment #122515 -
Flags: review-
Comment 17•22 years ago
|
||
+ // only autocomplete on characters
+ if (keyCode < 33 || keyCode > 126 || keyCode == 46)
+ return true;
these are just magic numbers to me. What do they refer to? Looks like non-ascii
characters, so what do you do for non-ASCII based languages? What happens in
japanese?
(and yes, hostnames can be internationalized, a la iDNS and such, which we support)
Assignee | ||
Comment 18•22 years ago
|
||
Element is now passed using 'this' and keycodes less than 33 are the only ones
ignored.
Attachment #122515 -
Attachment is obsolete: true
Comment 19•22 years ago
|
||
what special signifigance does "33" hold? I'm not doubting the signifigance of
control characters, but your code ought to be self-documenting here - offhand I
know that "32" is a space character, but 33 is just a magic number to me. You
shoudl use some of the DOM constants if you're going to be checking this kind of
thing.
Assignee | ||
Comment 20•22 years ago
|
||
Looking at changing those lines to:
+ // don't autocomplete when non character keys (e.g. tab or delete) are pressed
+ if (keyCode <= KeyEvent.DOM_VK_DELETE || keyCode == KeyEvent.DOM_VK_META ||
+ (keyCode >= KeyEvent.DOM_VK_F1 && keyCode <= KeyEvent.DOM_VK_SCROLL_LOCK))
+ return true;
Less magic numbery?
Comment 21•22 years ago
|
||
yes, this is exactly what I was referring to! thanks.
Assignee | ||
Comment 22•22 years ago
|
||
Revised patch checking for DOM_VK rather than 'magic' numbers.
Attachment #122793 -
Attachment is obsolete: true
Attachment #122957 -
Flags: review?(neil.parkwaycc.co.uk)
Updated•22 years ago
|
Attachment #122957 -
Flags: review?(neil.parkwaycc.co.uk) → review+
Attachment #122957 -
Flags: superreview?(sspitzer)
Attachment #122957 -
Flags: superreview?(sspitzer) → superreview?(dmose)
Comment 23•22 years ago
|
||
Attachment #122957 -
Flags: superreview?(dmose) → superreview+
Attachment #122957 -
Flags: approval1.4?
Comment 24•22 years ago
|
||
Comment on attachment 122957 [details] [diff] [review]
Patch v1.3b
since this is mail, I'd prefer to give the a (and test this.)
I want to test, because I'm a little nervous about doing home grown
autocomplete here.
for example, it isn't on a timer, which leads to a bad experience.
let me test and review before approval, ok?
Attachment #122957 -
Flags: approval1.4?
Comment 25•22 years ago
|
||
Comment on attachment 122957 [details] [diff] [review]
Patch v1.3b
in addition to dmose's review, I'd like to review as well.
so making an official request.
Attachment #122957 -
Flags: superreview+ → superreview?(sspitzer)
Updated•21 years ago
|
Product: Browser → Seamonkey
Comment 26•17 years ago
|
||
Ian, sspitzer,
Are you still working on this ?
Assignee | ||
Comment 27•17 years ago
|
||
Waiting for some sort of super-review, I suspect at some point I'll be asked to tweak the patch.
Updated•17 years ago
|
Priority: P3 → --
QA Contact: lchiang → nobody
Target Milestone: mozilla1.4final → ---
Comment 28•15 years ago
|
||
Iann comment #27
> Waiting for some sort of super-review, I suspect at some point I'll be asked to
> tweak the patch.
sr from spitzer?
Updated•14 years ago
|
Attachment #122957 -
Flags: superreview?(sspitzer)
You need to log in
before you can comment on or make changes to this bug.
Description
•