Using a vcard address book on debian/zhone
Thomas Köckerbauer
tkoeck at gup.jku.at
Thu Sep 4 01:44:51 CEST 2008
I've just installed debian on my freerunner and the thing I was missing most
was the possibility to import contacts since I do not store my contacts on
the SIM card. If anybody also has the same problem here is a very quick and
dirty hack which allows to use a vcard address book as source for the phone
book. I've tested it with a vcard 3.0 address book exported from "kontact".
Please note that things like editing entries do NOT work with this hack.
Just replace the function "prepare" in the class pyphone_contacts in the
file /usr/bin/zhone by the following:
def prepare( self ):
if not self.ready and not self.busy:
file = open("/root/addressbook.vcf", "r")
entries = []
entry_nr = 1
name = None
number = None
for line in file:
if line.startswith("END:VCARD"):
if name and number:
entry = entry_nr, name, number
entries.append(entry)
entry_nr = entry_nr + 1
name = None
number = None
if line.startswith("FN:"):
name = unicode(line.partition(":")
[2].strip(), "utf8", "utf8")
if line.startswith("TEL;TYPE=CELL:"):
number = unicode(line.partition(":")[2].strip())
file.close()
self.cbPhonebookReply(entries)
More information about the community
mailing list