Log In
New Account
  
Home My Page Project Cloud Code Snippets Project Openings Hermes
Summary Lists News SCM
authorFredrik Wendt <fredrik@wendt.se>
Wed, 9 Jun 2010 21:31:22 +0000 (22:31 +0100)
committerFredrik Wendt <fredrik@wendt.se>
Wed, 9 Jun 2010 21:31:22 +0000 (22:31 +0100)
Signed-off-by: Fredrik Wendt <fredrik@wendt.se>

package/src/org/maemo/hermes/engine/hermes.py

index 2cbacd6..9a00bfd 100644 (file)
@@ -44,8 +44,8 @@ class Hermes:
         
         contacts = []
         self.address_book = self._get_address_book()
-        for contact in self.address_book.get_all_contacts():
-            contacts.append(Contact(self.address_book, contact))
+        for econtact in self.address_book.get_all_contacts():
+            contacts.append(self._create_contact_wrapper(econtact))
 
         # work out progress bar info
         total_contacts = len(contacts) * len(self._services)
@@ -128,11 +128,8 @@ class Hermes:
 
     # -----------------------------------------------------------------------
     def create_contact_from_friend(self, friend):
-        econtact = evolution.ebook.EContact()
-        econtact.props.full_name = friend['name']
-        econtact.props.given_name = friend['first_name']
-        econtact.props.family_name = friend['last_name']
-        contact = Contact(self.address_book, econtact)
+        econtact = self._create_empty_contact(friend)
+        contact = self._create_contact_wrapper(econtact)
                 
         self.address_book.add_contact(contact.get_econtact())
         self.update_contact(contact, friend)
@@ -143,3 +140,14 @@ class Hermes:
     # -----------------------------------------------------------------------
     def _get_address_book(self):
         return evolution.ebook.open_addressbook('default')
+
+    # -----------------------------------------------------------------------
+    def _create_empty_contact(self, friend):
+        econtact = evolution.ebook.EContact()
+        econtact.props.full_name = friend['name']
+        econtact.props.given_name = friend['first_name']
+        econtact.props.family_name = friend['last_name']
+    
+    # -----------------------------------------------------------------------
+    def _create_contact_wrapper(self, econtact):
+        return Contact(self.address_book, econtact)
\ No newline at end of file

Terms of Use    Privacy Policy    Contribution Guidelines    Feedback

Powered By GForge Collaborative Development Environment