Merge change I778df15f into eclair

* changes:
  Create a title on long press in view contact
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5bf5bcf..77659ad 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -130,7 +130,7 @@
 
     <!-- Menu item that joins an aggregate with another aggregate -->
     <string name="menu_joinAggregate">Join</string>
-    
+
     <!-- Menu item to toggle the tabs that show where the contact data comes from. -->
     <string name="menu_showSources">Show sources</string>
     <string name="menu_hideSources">Hide sources</string>
@@ -301,6 +301,9 @@
     <!-- The text displayed when the contacts list is empty while displaying all contacts -->
     <string name="noContacts">No contacts.</string>
 
+    <!-- The text displayed when the contacts list is empty while displaying results after searching contacts -->
+    <string name="noMatchingContacts">No matching contacts found.</string>
+
     <!-- The text displayed when the contacts list is empty while displaying only contacts that have phone numbers -->
     <string name="noContactsWithPhoneNumbers">No contacts with phone numbers.</string>
 
@@ -1130,7 +1133,7 @@
     <string name="name_phonetic_middle">Phonetic middle name</string>
     <!-- Field title for the phonetic family name of a contact -->
     <string name="name_phonetic_family">Phonetic family name</string>
-    
+
     <!-- The title for the action to remove a contact from an aggregated contact -->
     <string name="split_label">Split</string>
     <!-- The explanation of what "split" will do. This needs word-smithing. -->
diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java
index d446efe..6a433d1 100644
--- a/src/com/android/contacts/ContactsListActivity.java
+++ b/src/com/android/contacts/ContactsListActivity.java
@@ -620,6 +620,8 @@
             gravity = Gravity.CENTER;
         } else if (mMode == MODE_STREQUENT || mMode == MODE_STARRED) {
             empty.setText(getText(R.string.noFavoritesHelpText));
+        } else if (mMode == MODE_QUERY) {
+             empty.setText(getText(R.string.noMatchingContacts));
         } else {
             boolean hasSim = ((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE))
                     .hasIccCard();
diff --git a/src/com/android/contacts/model/EntityDelta.java b/src/com/android/contacts/model/EntityDelta.java
index f95bc12..7ac0f5b 100644
--- a/src/com/android/contacts/model/EntityDelta.java
+++ b/src/com/android/contacts/model/EntityDelta.java
@@ -437,6 +437,7 @@
         protected ContentValues mBefore;
         protected ContentValues mAfter;
         protected String mIdColumn = BaseColumns._ID;
+        private boolean mFromTemplate;
 
         /**
          * Next value to assign to {@link #mIdColumn} when building an insert
@@ -543,6 +544,14 @@
             return isPrimary == null ? false : isPrimary != 0;
         }
 
+        public void setFromTemplate(boolean isFromTemplate) {
+            mFromTemplate = isFromTemplate;
+        }
+
+        public boolean isFromTemplate() {
+            return mFromTemplate;
+        }
+
         public boolean beforeExists() {
             return (mBefore != null && mBefore.containsKey(mIdColumn));
         }
diff --git a/src/com/android/contacts/model/EntityModifier.java b/src/com/android/contacts/model/EntityModifier.java
index beaf3e6..d6f6571 100644
--- a/src/com/android/contacts/model/EntityModifier.java
+++ b/src/com/android/contacts/model/EntityModifier.java
@@ -389,7 +389,7 @@
                     // TODO: remove this verbose logging
                     Log.w(TAG, "Trimming: " + entry.toString());
                     entry.markDeleted();
-                } else {
+                } else if (!entry.isFromTemplate()) {
                     hasValues = true;
                 }
             }
diff --git a/src/com/android/contacts/model/GoogleSource.java b/src/com/android/contacts/model/GoogleSource.java
index 9968ace..b6f1e29 100644
--- a/src/com/android/contacts/model/GoogleSource.java
+++ b/src/com/android/contacts/model/GoogleSource.java
@@ -42,7 +42,6 @@
 
 public class GoogleSource extends FallbackSource {
     public static final String ACCOUNT_TYPE = "com.google.GAIA";
-
     public GoogleSource(String resPackageName) {
         this.accountType = ACCOUNT_TYPE;
         this.resPackageName = null;
@@ -160,6 +159,7 @@
 
     public static final void attemptMyContactsMembership(EntityDelta state, Context context) {
         final ValuesDelta stateValues = state.getValues();
+	stateValues.setFromTemplate(true);
         final String accountName = stateValues.getAsString(RawContacts.ACCOUNT_NAME);
         final String accountType = stateValues.getAsString(RawContacts.ACCOUNT_TYPE);
         attemptMyContactsMembership(state, accountName, accountType, context, true);