1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Elminate harmful selection of delete policy on Incoming settings page.

This commit is contained in:
Daniel Applebaum 2009-03-12 01:50:06 +00:00
parent 272bb699c9
commit 9f7a4b05d8
2 changed files with 0 additions and 36 deletions

View File

@ -65,17 +65,6 @@
android:id="@+id/account_security_type" android:id="@+id/account_security_type"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="fill_parent" /> android:layout_width="fill_parent" />
<TextView
android:id="@+id/account_delete_policy_label"
android:text="@string/account_setup_incoming_delete_policy_label"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />
<Spinner
android:id="@+id/account_delete_policy"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<LinearLayout <LinearLayout
android:id="@+id/imap_path_prefix_section" android:id="@+id/imap_path_prefix_section"
android:layout_width="fill_parent" android:layout_width="fill_parent"

View File

@ -58,7 +58,6 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
private EditText mServerView; private EditText mServerView;
private EditText mPortView; private EditText mPortView;
private Spinner mSecurityTypeView; private Spinner mSecurityTypeView;
private Spinner mDeletePolicyView;
private EditText mImapPathPrefixView; private EditText mImapPathPrefixView;
private EditText mImapFolderDrafts; private EditText mImapFolderDrafts;
private EditText mImapFolderSent; private EditText mImapFolderSent;
@ -96,7 +95,6 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
mServerView = (EditText)findViewById(R.id.account_server); mServerView = (EditText)findViewById(R.id.account_server);
mPortView = (EditText)findViewById(R.id.account_port); mPortView = (EditText)findViewById(R.id.account_port);
mSecurityTypeView = (Spinner)findViewById(R.id.account_security_type); mSecurityTypeView = (Spinner)findViewById(R.id.account_security_type);
mDeletePolicyView = (Spinner)findViewById(R.id.account_delete_policy);
mImapPathPrefixView = (EditText)findViewById(R.id.imap_path_prefix); mImapPathPrefixView = (EditText)findViewById(R.id.imap_path_prefix);
mImapFolderDrafts = (EditText)findViewById(R.id.account_imap_folder_drafts); mImapFolderDrafts = (EditText)findViewById(R.id.account_imap_folder_drafts);
mImapFolderSent = (EditText)findViewById(R.id.account_imap_folder_sent); mImapFolderSent = (EditText)findViewById(R.id.account_imap_folder_sent);
@ -119,29 +117,11 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
new SpinnerOption(4, getString(R.string.account_setup_incoming_security_tls_label)), new SpinnerOption(4, getString(R.string.account_setup_incoming_security_tls_label)),
}; };
SpinnerOption deletePolicies[] = {
new SpinnerOption(Account.DELETE_POLICY_NEVER,
getString(R.string.account_setup_incoming_delete_policy_never_label)),
/*new SpinnerOption(Account.DELETE_POLICY_7DAYS,
getString(R.string.account_setup_incoming_delete_policy_7days_label)),*/
new SpinnerOption(Account.DELETE_POLICY_ON_DELETE,
getString(R.string.account_setup_incoming_delete_policy_delete_label)),
new SpinnerOption(Account.DELETE_POLICY_MARK_AS_READ,
getString(R.string.account_setup_incoming_delete_policy_markread_label)),
};
ArrayAdapter<SpinnerOption> securityTypesAdapter = new ArrayAdapter<SpinnerOption>(this, ArrayAdapter<SpinnerOption> securityTypesAdapter = new ArrayAdapter<SpinnerOption>(this,
android.R.layout.simple_spinner_item, securityTypes); android.R.layout.simple_spinner_item, securityTypes);
securityTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); securityTypesAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mSecurityTypeView.setAdapter(securityTypesAdapter); mSecurityTypeView.setAdapter(securityTypesAdapter);
ArrayAdapter<SpinnerOption> deletePoliciesAdapter = new ArrayAdapter<SpinnerOption>(this,
android.R.layout.simple_spinner_item, deletePolicies);
deletePoliciesAdapter
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mDeletePolicyView.setAdapter(deletePoliciesAdapter);
/* /*
* Updates the port when the user changes the security type. This allows * Updates the port when the user changes the security type. This allows
* us to show a reasonable default which the user can change. * us to show a reasonable default which the user can change.
@ -275,8 +255,6 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
} }
} }
SpinnerOption.setSpinnerOptionValue(mDeletePolicyView, mAccount.getDeletePolicy());
if (uri.getHost() != null) { if (uri.getHost() != null) {
mServerView.setText(uri.getHost()); mServerView.setText(uri.getHost());
} }
@ -381,13 +359,10 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
throw new Error(use); throw new Error(use);
} }
int deleteSpinnerVal = (Integer)((SpinnerOption)mDeletePolicyView.getSelectedItem()).value;
mAccount.setDraftsFolderName(mImapFolderDrafts.getText().toString()); mAccount.setDraftsFolderName(mImapFolderDrafts.getText().toString());
mAccount.setSentFolderName(mImapFolderSent.getText().toString()); mAccount.setSentFolderName(mImapFolderSent.getText().toString());
mAccount.setTrashFolderName(mImapFolderTrash.getText().toString()); mAccount.setTrashFolderName(mImapFolderTrash.getText().toString());
mAccount.setOutboxFolderName(mImapFolderOutbox.getText().toString()); mAccount.setOutboxFolderName(mImapFolderOutbox.getText().toString());
mAccount.setDeletePolicy(deleteSpinnerVal);
AccountSetupCheckSettings.actionCheckSettings(this, mAccount, true, false); AccountSetupCheckSettings.actionCheckSettings(this, mAccount, true, false);
} }