Exemplo n.º 1
0
 // Delete a contact given by contactId (between 0 and max contacts). Returns
 // 1 if success otherwish returns 0.
 static int deleteContact(int contactId) {
   // #ifdef api.pim
   if (contactId >= 0 && contactId < s_contacts.length) {
     try {
       ContactList list = (ContactList) s_contacts[contactId].m_contact.getPIMList();
       list.removeContact((s_contacts[contactId].m_contact));
       s_contacts[contactId] = null;
       s_nbContacts--;
       for (int i = contactId; i < s_nbContacts; i++) {
         s_contacts[i] = s_contacts[i + 1];
       }
       return 1;
     } catch (Exception e) {
       Logger.println("Exception while deleting contact: " + e);
     }
   }
   // #endif
   return 0;
 }
Exemplo n.º 2
0
 /**
  * Delete an item from the store
  *
  * @param item the item to be removed (the key is the only relevant field)
  * @return true iff the item was successfully removed
  * @throws PIMException if the item cannot be removed
  */
 protected boolean deleteItem(PIMItem item) throws PIMException {
   ContactList cl = (ContactList) list;
   cl.removeContact((Contact) item);
   return true;
 }