[FSO]: zhone patch for reading vcf instead of sim. was: Re: Once a whiner

Sven Klomp sven at klomp.de
Sun Jan 11 22:00:13 CET 2009


Thanks for resending your patch. I have missed your old mail.

It works like a charm.
However, Zhone has problems with number like "+49-1234-0000". I removed the - 
and replaced the + with 00.
I added the patch to the Wiki:
http://wiki.openmoko.org/wiki/Zhone


On Saturday January 10 2009 11:20:32 arne anka wrote:
> here it is.
> the code looks for addressbook.vcf in the user's $HOME and reads it in.
> multiple numbers per contact are supported.
>
> in /usr/bin/zhone search for
> class pyphone_contacts(edje_group):
> and find some lines below
>
> def prepare( self ):
>
> and modify like below (be aware of unintentional linebreaks!)
>
> def prepare( self ):
>          if not self.ready and not self.busy:
>              file = open(os.environ.get('HOME')+"/addressbook.vcf", "r")
>              entries = []
>              entry_nr = 1
>              name = None
>              number = None
>              for line in file:
>                  #if line.startswith("END:VCARD"):
>                  if line.startswith("TEL;"):
>                      number = unicode(line.partition(":")[2].strip())
>                      if name and number:
>                          entry = entry_nr, name, number
>                          entries.append(entry)
>                          entry_nr = entry_nr + 1
>                  if line.startswith("END:VCARD"):
>                      name = None
>                      number = None
>                  if line.startswith("N:"):
>                      name = unicode(line.partition(":")[2].replace(';','
> ').strip(), "utf8", "utf8")
>                  #if line.startswith("TEL;"):
>                  #    number = unicode(line.partition(":")[2].strip())
>              file.close()
>              self.cbPhonebookReply(entries)
>
>          """
>              if dbus_object.gsm_device_obj:
>                  logger.info( "retrieving phonebook..." )
>                  dbus_object.gsm_sim_iface.RetrievePhonebook(
>                      "contacts",
>                      reply_handler=self.cbPhonebookReply,
>                      error_handler=self.cbPhonebookError
>                  )
>                  self.busy = True
>              else:
>                  # Fake phonebook...
>                  self.cbPhonebookReply( [
>                      (1, u'Kirk', '+023224433'),
>                      (2, u'Spock', '+034433463'),
>                      (3, u'McCoy', '+013244344'),
>                      (4, u'Scott', '+013244344'),
>                      (5, u'Uhura', '+013244344'),
>                      (6, u'Sulu', '+013244344'),
>                      (7, u'Chekov', '+456663443'),
>                  ] )
>          """
>
> _______________________________________________
> support mailing list
> support at lists.openmoko.org
> https://lists.openmoko.org/mailman/listinfo/support




More information about the support mailing list