Re: gmail plugin: display all contact data -- integrate patch?



On 23/01/11 20:04, Karol Będkowski wrote:
Hi,

2011-01-16 13:28:35 Stefan Otte <stefan otte gmail com>:
What is wrong with the current code and what is expected?
The GoogleContact should be an ContactLeaf as mentioned in
obj/contacts.py? And the slot mechanism should be used?
Anything else?
I try to help with this stuff.

Grouping is a feature, that allow to group leaves from one or more
sources that have the same some attribute. For now we have only two
type of leaves: contacts (groped by name, email, jid) and hosts
(grouped by name or address).

For example, if you have the same contact in gmail, gajim, pingin etc,
leaves from appropriate sources will be grouped. One leaf will be
promoted to "main" leaf and other appear as its children.

Unique properties for each leaf are stored in "slots" - for example
"name", "email", "jid". Slots defined in "grouping_slots" are used
grouping. Type of group (contacts / host) is defined in source class.

We can provide new subclass of ContactLeaf for each source (for example
to provide other icon) or use one existing classes. But in actions we
should always use base class (ContactLeaf) and check that given leaf
have appropriate slot (i.e. "email" in actions related to sending
emails).

So, if you replace GoogleContact(EmailContact) with GoogleContact(Leaf)
this brake whole grouping for contacts from gmail (this leaves can't
(shouldn't) be grouped).

I did replace GoogleContact(EmailContact) with GoogleContact(Leaf).

What I now do is I use the EmailContact with the email and as the name Is pass the label from google i.e. 'Home email' or 'Work email'. This means I have around a 100 or so EmailContact instances which have the grouped_slots NAME set to 'Work email'.

From your explanation I would expect to have a Leaf in my index called 'Work email' which I can navigate into have all the work emails of my contacts listed. This is not the case. If I activate kupfer and type work email I just get a the option to large type the text.

Is my assumption correct or am I missing someting?


If you want provide provide some new attributes for contacts, I think
simplest and best method is create new class, something like that:

ATTRIBUTE_KEY = 'ATTRIBUTE_KEY'
VALUE_KEY = 'VALUE_KEY'

class ContactDetails (ContactLeaf):
	def __init__(self, name, attribute, value):
		slots = {ATTRIBUTE_KEY: attribute, NAME_KEY: name,
			VALUE_KEY: value}
		ContactLeaf.__init__(self, slots, value)

	def repr_key(self):
		return self.object[ATTRIBUTE_KEY]

	def get_description(self):
		return self.object[ATTRIBUTE_KEY]

	def get_text_representation(self):
		return self.object[VALUE_KEY]

And use this to keep additional information (yield this objects in
source). I check this for simple example and seems to work ok. Of
course this class may be extended or maybe there should be separate
class for phones, addresses etc.
This is basically what I have been thinking of doing, wafter reading your mail.

I see that you read from google information about skype and jabber id -
for this you should use JabberContacts and skype.Contacts. This allow
to use this information in other plugins.

Will add that as well.

I hope this help...

Regards, 
Karol



_______________________________________________ kupfer-list mailing list kupfer-list gnome org http://mail.gnome.org/mailman/listinfo/kupfer-list


-- 
Adi J. Sieker
Steurentalstr. 2
79252 Stegen
mobile: +49 / 178 / 88 5 88 13
   tel: +49 / 7661 / 91 92 813
   web: http://www.sieker.info/profile


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