From b19bc4c0b6b96516870665cf0d4e5b45638c16f4 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Wed, 23 Sep 2009 18:31:16 -0700 Subject: [PATCH] Save HostAuth's when returning from editing Incoming/Outgoing settings * in onActivityResult, we not only need to update the Account, but also the relevant HostAuth (both if coming from AccountSetupExchange) Change-Id: I0657ff257fe949e46e100eb3e6cfec6162514aa9 --- .../android/email/activity/setup/AccountSetupExchange.java | 5 ++++- .../android/email/activity/setup/AccountSetupIncoming.java | 2 +- .../android/email/activity/setup/AccountSetupOutgoing.java | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/com/android/email/activity/setup/AccountSetupExchange.java b/src/com/android/email/activity/setup/AccountSetupExchange.java index bafca3571..c8c2e9041 100644 --- a/src/com/android/email/activity/setup/AccountSetupExchange.java +++ b/src/com/android/email/activity/setup/AccountSetupExchange.java @@ -267,10 +267,13 @@ public class AccountSetupExchange extends Activity implements OnClickListener, public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (Intent.ACTION_EDIT.equals(getIntent().getAction())) { - // TODO Review carefully to make sure this is bulletproof if (mAccount.isSaved()) { + // Account.update will NOT save the HostAuth's mAccount.update(this, mAccount.toContentValues()); + mAccount.mHostAuthRecv.update(this, mAccount.mHostAuthRecv.toContentValues()); + mAccount.mHostAuthSend.update(this, mAccount.mHostAuthSend.toContentValues()); } else { + // Account.save will save the HostAuth's mAccount.save(this); } finish(); diff --git a/src/com/android/email/activity/setup/AccountSetupIncoming.java b/src/com/android/email/activity/setup/AccountSetupIncoming.java index 24ae3e667..2dbd803f8 100644 --- a/src/com/android/email/activity/setup/AccountSetupIncoming.java +++ b/src/com/android/email/activity/setup/AccountSetupIncoming.java @@ -325,9 +325,9 @@ public class AccountSetupIncoming extends Activity implements OnClickListener { public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (Intent.ACTION_EDIT.equals(getIntent().getAction())) { - // TODO Review carefully to make sure this is bulletproof if (mAccount.isSaved()) { mAccount.update(this, mAccount.toContentValues()); + mAccount.mHostAuthRecv.update(this, mAccount.mHostAuthRecv.toContentValues()); } else { mAccount.save(this); } diff --git a/src/com/android/email/activity/setup/AccountSetupOutgoing.java b/src/com/android/email/activity/setup/AccountSetupOutgoing.java index 510fbaf7a..557fa1d0a 100644 --- a/src/com/android/email/activity/setup/AccountSetupOutgoing.java +++ b/src/com/android/email/activity/setup/AccountSetupOutgoing.java @@ -245,10 +245,10 @@ public class AccountSetupOutgoing extends Activity implements OnClickListener, public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (Intent.ACTION_EDIT.equals(getIntent().getAction())) { - // TODO Review carefully to make sure this is bulletproof if (mAccount.isSaved()) { mAccount.update(this, mAccount.toContentValues()); - } else { + mAccount.mHostAuthSend.update(this, mAccount.mHostAuthSend.toContentValues()); + } else { mAccount.save(this); } finish();