diff --git a/res/values/strings.xml b/res/values/strings.xml index 154deeec2..3a50a47c9 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -545,7 +545,13 @@ Sync contacts - Also sync contacts from this account + Also sync contacts from this account + + + Sync calendar + + Also sync calendar from this account + Vibrate diff --git a/res/xml/account_settings_preferences.xml b/res/xml/account_settings_preferences.xml index 9dedd5d8d..0fc89f026 100644 --- a/res/xml/account_settings_preferences.xml +++ b/res/xml/account_settings_preferences.xml @@ -102,6 +102,12 @@ android:defaultValue="true" android:title="@string/account_settings_sync_contacts_enable" android:summary="@string/account_settings_sync_contacts_summary" /> + diff --git a/src/com/android/email/activity/setup/AccountSettings.java b/src/com/android/email/activity/setup/AccountSettings.java index ff643958e..f9e8b0f52 100644 --- a/src/com/android/email/activity/setup/AccountSettings.java +++ b/src/com/android/email/activity/setup/AccountSettings.java @@ -38,6 +38,7 @@ import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceCategory; import android.preference.RingtonePreference; +import android.provider.Calendar; import android.provider.ContactsContract; import android.util.Log; import android.view.KeyEvent; @@ -56,6 +57,7 @@ public class AccountSettings extends PreferenceActivity { private static final String PREFERENCE_INCOMING = "incoming"; private static final String PREFERENCE_OUTGOING = "outgoing"; private static final String PREFERENCE_SYNC_CONTACTS = "account_sync_contacts"; + private static final String PREFERENCE_SYNC_CALENDAR = "account_sync_calendar"; // NOTE: This string must match the one in res/xml/account_preferences.xml public static final String ACTION_ACCOUNT_MANAGER_ENTRY = @@ -79,6 +81,7 @@ public class AccountSettings extends PreferenceActivity { private CheckBoxPreference mAccountVibrate; private RingtonePreference mAccountRingtone; private CheckBoxPreference mSyncContacts; + private CheckBoxPreference mSyncCalendar; /** * Display (and edit) settings for a specific account @@ -264,15 +267,19 @@ public class AccountSettings extends PreferenceActivity { } mSyncContacts = (CheckBoxPreference) findPreference(PREFERENCE_SYNC_CONTACTS); + mSyncCalendar = (CheckBoxPreference) findPreference(PREFERENCE_SYNC_CALENDAR); if (mAccount.mHostAuthRecv.mProtocol.equals("eas")) { android.accounts.Account acct = new android.accounts.Account(mAccount.mEmailAddress, Email.EXCHANGE_ACCOUNT_MANAGER_TYPE); mSyncContacts.setChecked(ContentResolver .getSyncAutomatically(acct, ContactsContract.AUTHORITY)); + mSyncCalendar.setChecked(ContentResolver + .getSyncAutomatically(acct, Calendar.AUTHORITY)); } else { PreferenceCategory serverCategory = (PreferenceCategory) findPreference( PREFERENCE_SERVER_CATERGORY); serverCategory.removePreference(mSyncContacts); + serverCategory.removePreference(mSyncCalendar); } } @@ -341,6 +348,8 @@ public class AccountSettings extends PreferenceActivity { Email.EXCHANGE_ACCOUNT_MANAGER_TYPE); ContentResolver.setSyncAutomatically(acct, ContactsContract.AUTHORITY, mSyncContacts.isChecked()); + ContentResolver.setSyncAutomatically(acct, Calendar.AUTHORITY, + mSyncCalendar.isChecked()); } AccountSettingsUtils.commitSettings(this, mAccount);