Proposed patch to phonebook.py

"Andrew Zitnay" <[email protected]>
Newsgroups gmane.comp.mobile.bitpim.devel
Message-ID <[email protected]>
I'm still chugging along on phonebook support for my phone (LG VI-125), and
I'm almost done, but I wanted to run a patch for phonebook.py by you guys...
I was running into a problem with speed dials, where if there was one in the
BitPim database for a particular phone number, but not in the phone itself,
and I tried to update the BitPim database with the contents of the phone,
the speed dial wouldn't get removed from the BitPim database.  I traced the
problem to phonebook.py, and the attached patch (phonebook.py.diff) fixes
the problem for me.
 
Please take this patch with a grain of salt; you guys have been working with
BitPim a lot longer than I have, so you're in a better position to know
whether or not this patch will screw up anything for any other model phone.
Let me know if it makes sense to do it my way, or if I'm misunderstanding
something.
 
Drew
phonebook.py.diff (application/octet-stream, 952 B)
Index: phonebook.py
===================================================================
RCS file: /cvsroot/bitpim/bitpim/phonebook.py,v
retrieving revision 1.136
diff -u -r1.136 phonebook.py
--- phonebook.py	24 Jul 2005 06:07:19 -0000	1.136
+++ phonebook.py	24 Sep 2005 00:46:37 -0000
@@ -2402,6 +2402,9 @@
                 found=True
                 if i.has_key('speeddial'):
                     r['speeddial']=i['speeddial']
+                else:
+                    if r.has_key('speeddial'):
+                        del r['speeddial']
                 break
         if found:
             continue
@@ -2413,6 +2416,9 @@
                 r['number']=i['number']
                 if i.has_key('speeddial'):
                     r['speeddial']=i['speeddial']
+                else:
+                    if r.has_key('speeddial'):
+                        del r['speeddial']
                 found=True
                 break
         if found:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.