mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-23 18:02:15 -05:00
IMAP "system" folders can be selected with pick list (Patch for Issue 182)
This commit is contained in:
parent
6411e006fc
commit
b0cf11d64c
@ -54,28 +54,6 @@
|
||||
android:id="@+id/account_signature"
|
||||
android:singleLine="false"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" />
|
||||
<TextView
|
||||
android:text="@string/account_settings_sent_items_label"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
<EditText
|
||||
android:id="@+id/account_sent_items"
|
||||
android:singleLine="false"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" />
|
||||
<TextView
|
||||
android:text="@string/account_settings_deleted_items_label"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
<EditText
|
||||
android:id="@+id/account_deleted_items"
|
||||
android:singleLine="false"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
@ -89,23 +89,23 @@
|
||||
<TextView android:layout_height="wrap_content"
|
||||
android:text="@string/account_setup_incoming_imap_folder_drafts"
|
||||
android:layout_width="fill_parent"></TextView>
|
||||
<EditText android:layout_height="wrap_content"
|
||||
android:id="@+id/account_imap_folder_drafts" android:layout_width="fill_parent"></EditText>
|
||||
<Button android:layout_height="wrap_content"
|
||||
android:id="@+id/account_imap_folder_drafts" android:layout_width="fill_parent"></Button>
|
||||
<TextView android:layout_height="wrap_content"
|
||||
android:text="@string/account_setup_incoming_imap_folder_sent"
|
||||
android:layout_width="fill_parent"></TextView>
|
||||
<EditText android:layout_height="wrap_content"
|
||||
android:id="@+id/account_imap_folder_sent" android:layout_width="fill_parent"></EditText>
|
||||
<Button android:layout_height="wrap_content"
|
||||
android:id="@+id/account_imap_folder_sent" android:layout_width="fill_parent"></Button>
|
||||
<TextView android:layout_height="wrap_content"
|
||||
android:text="@string/account_setup_incoming_imap_folder_trash"
|
||||
android:layout_width="fill_parent"></TextView>
|
||||
<EditText android:layout_height="wrap_content"
|
||||
android:id="@+id/account_imap_folder_trash" android:layout_width="fill_parent"></EditText>
|
||||
<Button android:layout_height="wrap_content"
|
||||
android:id="@+id/account_imap_folder_trash" android:layout_width="fill_parent"></Button>
|
||||
<TextView android:layout_height="wrap_content"
|
||||
android:text="@string/account_setup_incoming_imap_folder_outbox"
|
||||
android:layout_width="fill_parent"></TextView>
|
||||
<EditText android:layout_height="wrap_content"
|
||||
android:id="@+id/account_imap_folder_outbox" android:layout_width="fill_parent"></EditText>
|
||||
<Button android:layout_height="wrap_content"
|
||||
android:id="@+id/account_imap_folder_outbox" android:layout_width="fill_parent"></Button>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/webdav_path_prefix_section"
|
||||
|
@ -35,11 +35,13 @@ public class ChooseFolder extends ListActivity
|
||||
ArrayAdapter<String> adapter;
|
||||
private ChooseFolderHandler mHandler = new ChooseFolderHandler();
|
||||
String heldInbox = null;
|
||||
boolean hideCurrentFolder = true;
|
||||
|
||||
public static final String EXTRA_ACCOUNT = "com.android.email.ChooseFolder_account";
|
||||
public static final String EXTRA_CUR_FOLDER = "com.android.email.ChooseFolder_curfolder";
|
||||
public static final String EXTRA_NEW_FOLDER = "com.android.email.ChooseFolder_newfolder";
|
||||
public static final String EXTRA_MESSAGE_UID = "com.android.email.ChooseFolder_messageuid";
|
||||
public static final String EXTRA_SHOW_CURRENT = "com.android.email.ChooseFolder_showcurrent";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
@ -55,6 +57,9 @@ public class ChooseFolder extends ListActivity
|
||||
mAccount = (Account) intent.getSerializableExtra(EXTRA_ACCOUNT);
|
||||
mUID = intent.getStringExtra(EXTRA_MESSAGE_UID);
|
||||
mFolder = intent.getStringExtra(EXTRA_CUR_FOLDER);
|
||||
if (intent.getStringExtra(EXTRA_SHOW_CURRENT) != null) {
|
||||
hideCurrentFolder = false;
|
||||
}
|
||||
if(mFolder == null)
|
||||
mFolder = "";
|
||||
|
||||
@ -173,7 +178,7 @@ public class ChooseFolder extends ListActivity
|
||||
String name = folder.getName();
|
||||
|
||||
// Inbox needs to be compared case-insensitively
|
||||
if(name.equals(mFolder) || (Email.INBOX.equalsIgnoreCase(mFolder) && Email.INBOX.equalsIgnoreCase(name))) {
|
||||
if(hideCurrentFolder && (name.equals(mFolder) || (Email.INBOX.equalsIgnoreCase(mFolder) && Email.INBOX.equalsIgnoreCase(name)))) {
|
||||
continue;
|
||||
}
|
||||
try
|
||||
|
@ -34,6 +34,9 @@ import com.android.email.mail.store.TrustManagerFactory;
|
||||
* it doesn't correctly deal with restarting while its thread is running.
|
||||
*/
|
||||
public class AccountSetupCheckSettings extends Activity implements OnClickListener {
|
||||
|
||||
public static final int ACTIVITY_REQUEST_CODE = 1;
|
||||
|
||||
private static final String EXTRA_ACCOUNT = "account";
|
||||
|
||||
private static final String EXTRA_CHECK_INCOMING = "checkIncoming";
|
||||
@ -62,7 +65,7 @@ public class AccountSetupCheckSettings extends Activity implements OnClickListen
|
||||
i.putExtra(EXTRA_ACCOUNT, account);
|
||||
i.putExtra(EXTRA_CHECK_INCOMING, checkIncoming);
|
||||
i.putExtra(EXTRA_CHECK_OUTGOING, checkOutgoing);
|
||||
context.startActivityForResult(i, 1);
|
||||
context.startActivityForResult(i, ACTIVITY_REQUEST_CODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,9 +29,7 @@ public class AccountSetupComposition extends Activity {
|
||||
private EditText mAccountEmail;
|
||||
private EditText mAccountAlwaysBcc;
|
||||
private EditText mAccountName;
|
||||
private EditText mAccountSentItems;
|
||||
private EditText mAccountDeletedItems;
|
||||
|
||||
|
||||
|
||||
public static void actionEditCompositionSettings(Activity context, Account account) {
|
||||
Intent i = new Intent(context, AccountSetupComposition.class);
|
||||
@ -68,12 +66,6 @@ public class AccountSetupComposition extends Activity {
|
||||
|
||||
mAccountSignature = (EditText)findViewById(R.id.account_signature);
|
||||
mAccountSignature.setText(mAccount.getSignature());
|
||||
|
||||
mAccountSentItems = (EditText)findViewById(R.id.account_sent_items);
|
||||
mAccountSentItems.setText(mAccount.getSentFolderName());
|
||||
|
||||
mAccountDeletedItems = (EditText)findViewById(R.id.account_deleted_items);
|
||||
mAccountDeletedItems.setText(mAccount.getTrashFolderName());
|
||||
|
||||
}
|
||||
|
||||
@ -87,12 +79,9 @@ public class AccountSetupComposition extends Activity {
|
||||
mAccount.setEmail(mAccountEmail.getText().toString());
|
||||
mAccount.setAlwaysBcc(mAccountAlwaysBcc.getText().toString());
|
||||
mAccount.setName(mAccountName.getText().toString());
|
||||
mAccount.setSignature(mAccountSignature.getText().toString());
|
||||
mAccount.setSentFolderName(mAccountSentItems.getText().toString());
|
||||
mAccount.setTrashFolderName(mAccountDeletedItems.getText().toString());
|
||||
mAccount.setSignature(mAccountSignature.getText().toString());
|
||||
|
||||
mAccount.save(Preferences.getPreferences(this));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,10 +27,16 @@ import com.android.email.Email;
|
||||
import com.android.email.Preferences;
|
||||
import com.android.email.R;
|
||||
import com.android.email.Utility;
|
||||
import com.android.email.activity.ChooseFolder;
|
||||
|
||||
public class AccountSetupIncoming extends Activity implements OnClickListener {
|
||||
private static final String EXTRA_ACCOUNT = "account";
|
||||
private static final String EXTRA_MAKE_DEFAULT = "makeDefault";
|
||||
|
||||
private static final int SELECT_DRAFT_FOLDER = 100;
|
||||
private static final int SELECT_SENT_FOLDER = 101;
|
||||
private static final int SELECT_TRASH_FOLDER = 102;
|
||||
private static final int SELECT_OUTBOX_FOLDER = 103;
|
||||
|
||||
private static final int popPorts[] = {
|
||||
110, 995, 995, 110, 110
|
||||
@ -59,10 +65,10 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
|
||||
private EditText mPortView;
|
||||
private Spinner mSecurityTypeView;
|
||||
private EditText mImapPathPrefixView;
|
||||
private EditText mImapFolderDrafts;
|
||||
private EditText mImapFolderSent;
|
||||
private EditText mImapFolderTrash;
|
||||
private EditText mImapFolderOutbox;
|
||||
private Button mImapFolderDrafts;
|
||||
private Button mImapFolderSent;
|
||||
private Button mImapFolderTrash;
|
||||
private Button mImapFolderOutbox;
|
||||
private EditText mWebdavPathPrefixView;
|
||||
private EditText mWebdavAuthPathView;
|
||||
private EditText mWebdavMailboxPathView;
|
||||
@ -96,15 +102,19 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
|
||||
mPortView = (EditText)findViewById(R.id.account_port);
|
||||
mSecurityTypeView = (Spinner)findViewById(R.id.account_security_type);
|
||||
mImapPathPrefixView = (EditText)findViewById(R.id.imap_path_prefix);
|
||||
mImapFolderDrafts = (EditText)findViewById(R.id.account_imap_folder_drafts);
|
||||
mImapFolderSent = (EditText)findViewById(R.id.account_imap_folder_sent);
|
||||
mImapFolderTrash = (EditText)findViewById(R.id.account_imap_folder_trash);
|
||||
mImapFolderOutbox = (EditText)findViewById(R.id.account_imap_folder_outbox);
|
||||
mImapFolderDrafts = (Button)findViewById(R.id.account_imap_folder_drafts);
|
||||
mImapFolderSent = (Button)findViewById(R.id.account_imap_folder_sent);
|
||||
mImapFolderTrash = (Button)findViewById(R.id.account_imap_folder_trash);
|
||||
mImapFolderOutbox = (Button)findViewById(R.id.account_imap_folder_outbox);
|
||||
mWebdavPathPrefixView = (EditText)findViewById(R.id.webdav_path_prefix);
|
||||
mWebdavAuthPathView = (EditText)findViewById(R.id.webdav_auth_path);
|
||||
mWebdavMailboxPathView = (EditText)findViewById(R.id.webdav_mailbox_path);
|
||||
mNextButton = (Button)findViewById(R.id.next);
|
||||
|
||||
mImapFolderDrafts.setOnClickListener(this);
|
||||
mImapFolderSent.setOnClickListener(this);
|
||||
mImapFolderTrash.setOnClickListener(this);
|
||||
mImapFolderOutbox.setOnClickListener(this);
|
||||
mNextButton.setOnClickListener(this);
|
||||
|
||||
SpinnerOption securityTypes[] = {
|
||||
@ -297,6 +307,20 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (resultCode == RESULT_OK) {
|
||||
switch (requestCode) {
|
||||
case SELECT_DRAFT_FOLDER:
|
||||
mImapFolderDrafts.setText(data.getStringExtra(ChooseFolder.EXTRA_NEW_FOLDER));
|
||||
return;
|
||||
case SELECT_SENT_FOLDER:
|
||||
mImapFolderSent.setText(data.getStringExtra(ChooseFolder.EXTRA_NEW_FOLDER));
|
||||
return;
|
||||
case SELECT_TRASH_FOLDER:
|
||||
mImapFolderTrash.setText(data.getStringExtra(ChooseFolder.EXTRA_NEW_FOLDER));
|
||||
return;
|
||||
case SELECT_OUTBOX_FOLDER:
|
||||
mImapFolderOutbox.setText(data.getStringExtra(ChooseFolder.EXTRA_NEW_FOLDER));
|
||||
return;
|
||||
}
|
||||
if (Intent.ACTION_EDIT.equals(getIntent().getAction())) {
|
||||
mAccount.save(Preferences.getPreferences(this));
|
||||
finish();
|
||||
@ -371,6 +395,45 @@ public class AccountSetupIncoming extends Activity implements OnClickListener {
|
||||
case R.id.next:
|
||||
onNext();
|
||||
break;
|
||||
case R.id.account_imap_folder_drafts:
|
||||
selectImapFolder(SELECT_DRAFT_FOLDER);
|
||||
break;
|
||||
case R.id.account_imap_folder_sent:
|
||||
selectImapFolder(SELECT_SENT_FOLDER);
|
||||
break;
|
||||
case R.id.account_imap_folder_trash:
|
||||
selectImapFolder(SELECT_TRASH_FOLDER);
|
||||
break;
|
||||
case R.id.account_imap_folder_outbox:
|
||||
selectImapFolder(SELECT_OUTBOX_FOLDER);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void selectImapFolder(int activityCode) {
|
||||
String curFolder = null;
|
||||
switch (activityCode) {
|
||||
case SELECT_DRAFT_FOLDER:
|
||||
curFolder = mImapFolderDrafts.getText().toString();
|
||||
break;
|
||||
case SELECT_SENT_FOLDER:
|
||||
curFolder = mImapFolderSent.getText().toString();
|
||||
break;
|
||||
case SELECT_TRASH_FOLDER:
|
||||
curFolder = mImapFolderTrash.getText().toString();
|
||||
break;
|
||||
case SELECT_OUTBOX_FOLDER:
|
||||
curFolder = mImapFolderOutbox.getText().toString();
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
"Cannot select folder for: " + activityCode);
|
||||
}
|
||||
|
||||
Intent selectIntent = new Intent(this, ChooseFolder.class);
|
||||
selectIntent.putExtra(ChooseFolder.EXTRA_ACCOUNT, mAccount);
|
||||
selectIntent.putExtra(ChooseFolder.EXTRA_CUR_FOLDER, curFolder);
|
||||
selectIntent.putExtra(ChooseFolder.EXTRA_SHOW_CURRENT, "yes");
|
||||
startActivityForResult(selectIntent, activityCode);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user