Re: Alias support



On Tue, 11 Jul 2000 00:02:33 Matthew Guenther wrote:
> On Mon, Jul 10, 2000 at 10:28:21AM +0200, Berend De Schouwer wrote:
> > On Mon, 10 Jul 2000 08:39:40 Matthew Guenther wrote:
> > > On Sat, Jul 08, 2000 at 01:36:15PM +0200, Berend De Schouwer wrote:
> > > > On Fri, 07 Jul 2000 19:14:55 Berend De Schouwer wrote:
> > > > > Hi,
> > > > > 
> > 
> > 	[ ... snip ... ]
> > 
> > > > 
> > > 
> > > Okay, I tried your patch, and it seems to be working for me so far
> > > (although it did seem to cause an infinite loop of Balsa Error dialog
> > > boxes, but I can't repeat it).
> > 
> > I've had similar problems until I go "make clean; make" because it changes
> > an offset somewhere.  Maybe that was the problem.
> > 
> > > However I've noticed a few things that should probably be fixed before
> > > it goes into CVS.  
> > 
> > Excellent: Feedback.
> >  
> > > Primarily, I think you're duplicating a lot of effort with your
> > > expand_alias and word_in_array functions that already exists in Glib's
> > > string-completion functions.  It would be a good idea to use as much of
> > > glib as possible IMHO.
> > 
> > I thought so too, but I only have glib reference documentation, and it
> > isn't complete enough to tell me which function do that(!).  I actually
> > first wrote it with the libc str(cat|str|cpy) functions, until I got the
> > glib ones going.  I really need to find better documentation.
> > 
> 
> Do you have the glib reference from developer.gnome.org?

Yes, but it was old (circa gtk-1.1.3).  I got a later version yesterday.

> That's the only
> glib documentation I use (the only docs for it in existence I think).  As
> Peter Williams mentioned, use of the GCompletion functions was what I was
> referring to.  Using this should also fix another problem I noticed, if you
> don't type a complete name it doesn't expand (i.e. I type Guen<Enter>, but
> it doesn't expand to my address.) 

That is on purpose :).  I can understand for people to want to change that,
so I'll explain what I wanted:
either "John", "James", or "Johnson" are aliases for "John James Johnson"..
Now assume you also have a "Jo Jimmy Jefferson".  Should "Jo" match both
names?  If it matches both names, it will not expand, since it can't
choose.  So I made a policy decision of only matching the name, if the
word is exactly right to reduce the number of clashes.

That is also the reason the code splits the name up by spaces.  Since
a lot of people complain about this, I assume it goes against what people
expect, so I'll have to modify the behaviour.  It was simpler to just
enforce exact matches.  It doesn't appear to be good enough.

> > That said, I need to fill documentation about alias into the Balsa manual
> > :P
> 
> Don't worry too much about that, it's probably a good idea to leave the
> documentation until the implementation has fully settled out.
> 
> > > Secondarily, for me it is very natural to press TAB to complete the
> > > alias, it would be very helpful to be able to do so in Balsa (so it
> > > would be similar to my other, console-based mail client, mutt and pine).

> > 
> > I've thought about this, and I haven't done it (yet) because: 
> > 
> > - I need a way to NOT expand the alias, which tab currently does.  
> >
> > - I need a signal on gtk_entry() for tab.  
> >
> > The first problem is a policy choice, and could be an option.  The second
> > problem comes down to playing with gtk.
> > 
> 
> Hmmm, perhaps you should have TAB only perform the expansion if whatever's
> being typed isn't already a valid email address.  That way if I typed in
> someone's address and pressed tab, it would correctly move to the next
> field.  We already have functions to test for valid addresses, so that
> shouldn't be too difficult.

Good.  I'll look around.

> This will involve messing around with GTK/GDK's keyboard signals, but I
> think a proper implementation will have to do this regardless.  I know
> Gnumeric has tab completion in cell items, maybe you could check out their
> code?

I have already got a simple gtk_signal_connect going for keyboard events
in a gtk_entry() box, the "key-press-event".

I have a bigger worry: alias expansion can take some milliseconds.  So
the function might have to be re-entrant.

> > > Also, it would be helpful (to me at least) to see what I'm currently
> > > typing will be expanded into before I actually complete it (similar to
> > > many windows applications, like typing urls into win32 netscape).
> > 
> > I personally hate that.  It also requires caching the aliases otherwise
> > its too slow, and I need to trap every keystroke in a gtk_entry() box.
> > Its also a problem with multiple alias matches.  I don't say I won't
> > implement it, but its a whole new ballgame.
> > 
> 
> Hmmm, it's not necessary, as long as I can select to easily unexpand it if
> it expands to the wrong address (maybe ESC or Backspace immediately after an
> expansion?).

> > I'm thinking: - start with a blank entry.  - trap every key, when user
> > hits ',' forget about the previous input, and make blank again.  - As the
> > user types, print "<user input><cursor> [<first matched alias>]" - If the
> > user hits <tab> or <end>, replace with <first matched alias>, and change
> > focus.
> > 
> > Problems: - If more than one matched alias, what do you do?  - If "joe" is
> > an alias, but I don't want it expanded, what does the user do?
> > 
> 
> Good point, I think netscape just matches the last one used, but this would
> probably be a little too complicated.

A friend came up with tab completion: if the first match is wrong, hit TAB,
and it cycles through matches.  That could work.

> > > Have you given any thought into how you will handle multiple alias
> > > matches?
> > 
> > Currently: - multiple aliases gives a gnome warning box.  This is because
> > you shouldn't have multiple aliases.  It would be nice if it told you
> > which GnomeCard entries match, but it doesn't do that yet.  - multiple
> > usernames (when using usernames and not aliases) refuses to expand, but
> > doesn't give a warning.  The reason is, that you could know a lot of
> > people called "John", so warning about that is bad.
> > 
> 
> I think it would be possible to solve two problems with one stone, have any
> expansion that matches more than one alias or name pop up a gnome dialog
> containing a GtkList of all the possible matches.  Double-clicking on a
> match or selecting one and pressing "OK" would invoke that expansion.
> Pressing "Cancel" would leave whatever you typed.  This feature or something
> like it would be necessary to properly fix the partial-name completion
> problem I mentioned above.

This is fine when the user changes focus to "Subject:" or clicks send.
This could be irritating if it happens while the user types.

> > > I think the patch is an excellent start to adding alias support, thanks
> > > for the help!
> > 
> > Cool.
> > 
> > I've now patched GnomeCard to be able to enter aliases too.
> > 
> 
> It seems to me that GnomeCard already supports aliases, it just calls them
> Card Names instead of aliases.  Card names are arbitrary but are usually the
> first and last names of people or the company name... but they can be
> anything.  We should probably avoid duplicating the functionalities on
> fields if it's not going to add anything appreciable.  We don't want people
> to have to go through and add a field to all the records of their address
> book.

I use card names to sort by.  I don't know if that is good or bad.
Its a very useful idea though, since GnomeCard makes card names unique,
which avoids other problems.

> MBG

PS.  Now this e-mail is getting to be bigger than the patch.  Sorry.
 
> -- 
>       Matthew Guenther
>       mguenthe@attcanada.ca                          Nice guys get sick.
>       http://www.attcanada.ca/~mguenthe/

-- 
Kind regards,				  
Berend                                  
                                        
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Berend De Schouwer, +27-11-712-1435, UCS





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]