Search in sources :

Example 96 with Account

use of com.fsck.k9.Account in project k-9 by k9mail.

the class MessageList method showThread.

@Override
public void showThread(Account account, String folderName, long threadRootId) {
    showMessageViewPlaceHolder();
    LocalSearch tmpSearch = new LocalSearch();
    tmpSearch.addAccountUuid(account.getUuid());
    tmpSearch.and(SearchField.THREAD_ID, String.valueOf(threadRootId), Attribute.EQUALS);
    MessageListFragment fragment = MessageListFragment.newInstance(tmpSearch, true, false);
    addMessageListFragment(fragment, true);
}
Also used : LocalSearch(com.fsck.k9.search.LocalSearch) MessageListFragment(com.fsck.k9.fragment.MessageListFragment)

Example 97 with Account

use of com.fsck.k9.Account in project k-9 by k9mail.

the class MessageList method openMessage.

@Override
public void openMessage(MessageReference messageReference) {
    Preferences prefs = Preferences.getPreferences(getApplicationContext());
    Account account = prefs.getAccount(messageReference.getAccountUuid());
    String folderName = messageReference.getFolderName();
    if (folderName.equals(account.getDraftsFolderName())) {
        MessageActions.actionEditDraft(this, messageReference);
    } else {
        mMessageViewContainer.removeView(mMessageViewPlaceHolder);
        if (mMessageListFragment != null) {
            mMessageListFragment.setActiveMessage(messageReference);
        }
        MessageViewFragment fragment = MessageViewFragment.newInstance(messageReference);
        FragmentTransaction ft = getFragmentManager().beginTransaction();
        ft.replace(R.id.message_view_container, fragment);
        mMessageViewFragment = fragment;
        ft.commit();
        if (mDisplayMode != DisplayMode.SPLIT_VIEW) {
            showMessageView();
        }
    }
}
Also used : SearchAccount(com.fsck.k9.search.SearchAccount) Account(com.fsck.k9.Account) FragmentTransaction(android.app.FragmentTransaction) MessageViewFragment(com.fsck.k9.ui.messageview.MessageViewFragment) Preferences(com.fsck.k9.Preferences)

Example 98 with Account

use of com.fsck.k9.Account in project k-9 by k9mail.

the class EditIdentity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mIdentity = (Identity) getIntent().getSerializableExtra(EXTRA_IDENTITY);
    mIdentityIndex = getIntent().getIntExtra(EXTRA_IDENTITY_INDEX, -1);
    String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
    mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
    if (mIdentityIndex == -1) {
        mIdentity = new Identity();
    }
    setContentView(R.layout.edit_identity);
    /*
         * If we're being reloaded we override the original account with the one
         * we saved
         */
    if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_IDENTITY)) {
        mIdentity = (Identity) savedInstanceState.getSerializable(EXTRA_IDENTITY);
    }
    mDescriptionView = (EditText) findViewById(R.id.description);
    mDescriptionView.setText(mIdentity.getDescription());
    mNameView = (EditText) findViewById(R.id.name);
    mNameView.setText(mIdentity.getName());
    mEmailView = (EditText) findViewById(R.id.email);
    mEmailView.setText(mIdentity.getEmail());
    mReplyTo = (EditText) findViewById(R.id.reply_to);
    mReplyTo.setText(mIdentity.getReplyTo());
    //      mAccountAlwaysBcc = (EditText)findViewById(R.id.bcc);
    //      mAccountAlwaysBcc.setText(mIdentity.getAlwaysBcc());
    mSignatureLayout = (LinearLayout) findViewById(R.id.signature_layout);
    mSignatureUse = (CheckBox) findViewById(R.id.signature_use);
    mSignatureView = (EditText) findViewById(R.id.signature);
    mSignatureUse.setChecked(mIdentity.getSignatureUse());
    mSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                mSignatureLayout.setVisibility(View.VISIBLE);
                mSignatureView.setText(mIdentity.getSignature());
            } else {
                mSignatureLayout.setVisibility(View.GONE);
            }
        }
    });
    if (mSignatureUse.isChecked()) {
        mSignatureView.setText(mIdentity.getSignature());
    } else {
        mSignatureLayout.setVisibility(View.GONE);
    }
}
Also used : Identity(com.fsck.k9.Identity) CompoundButton(android.widget.CompoundButton)

Example 99 with Account

use of com.fsck.k9.Account in project k-9 by k9mail.

the class EmailProviderTest method query_forThreadedMessages_showsThreadOfEmailWithSameSendTimeOnce.

@Test
public void query_forThreadedMessages_showsThreadOfEmailWithSameSendTimeOnce() throws MessagingException {
    Account account = Preferences.getPreferences(getContext()).newAccount();
    account.getUuid();
    account.getLocalStore().getFolder("Inbox").appendMessages(Collections.singletonList(message));
    account.getLocalStore().getFolder("Inbox").appendMessages(Collections.singletonList(replyAtSameTime));
    Cursor cursor = getProvider().query(Uri.parse("content://" + EmailProvider.AUTHORITY + "/account/" + account.getUuid() + "/messages/threaded"), new String[] { EmailProvider.MessageColumns.ID, EmailProvider.MessageColumns.FOLDER_ID, EmailProvider.ThreadColumns.ROOT, EmailProvider.MessageColumns.SUBJECT, EmailProvider.MessageColumns.DATE, EmailProvider.SpecialColumns.THREAD_COUNT }, "", new String[] {}, EmailProvider.MessageColumns.DATE + " DESC");
    assertNotNull(cursor);
    assertTrue(cursor.moveToFirst());
    assertEquals(2, cursor.getInt(5));
    assertFalse(cursor.moveToNext());
}
Also used : Account(com.fsck.k9.Account) Cursor(android.database.Cursor) Test(org.junit.Test)

Example 100 with Account

use of com.fsck.k9.Account in project k-9 by k9mail.

the class EmailProviderTest method query_forMessagesWithAccountAndWithoutRequiredFields_throwsIllegalArgumentException.

@Test(expected = IllegalArgumentException.class)
public void query_forMessagesWithAccountAndWithoutRequiredFields_throwsIllegalArgumentException() {
    Account account = Preferences.getPreferences(getContext()).newAccount();
    account.getUuid();
    Cursor cursor = getProvider().query(Uri.parse("content://" + EmailProvider.AUTHORITY + "/account/" + account.getUuid() + "/messages"), new String[] {}, "", new String[] {}, "");
    assertNotNull(cursor);
    assertTrue(cursor.isAfterLast());
}
Also used : Account(com.fsck.k9.Account) Cursor(android.database.Cursor) Test(org.junit.Test)

Aggregations

Account (com.fsck.k9.Account)122 Test (org.junit.Test)81 MessagingException (com.fsck.k9.mail.MessagingException)53 LocalFolder (com.fsck.k9.mailstore.LocalFolder)44 LocalMessage (com.fsck.k9.mailstore.LocalMessage)43 LocalStore (com.fsck.k9.mailstore.LocalStore)42 ArrayList (java.util.ArrayList)34 MessageReference (com.fsck.k9.activity.MessageReference)32 Message (com.fsck.k9.mail.Message)29 Folder (com.fsck.k9.mail.Folder)27 UnavailableStorageException (com.fsck.k9.mailstore.UnavailableStorageException)25 MimeMessage (com.fsck.k9.mail.internet.MimeMessage)22 IOException (java.io.IOException)22 Cursor (android.database.Cursor)21 CertificateValidationException (com.fsck.k9.mail.CertificateValidationException)20 Store (com.fsck.k9.mail.Store)20 SearchAccount (com.fsck.k9.search.SearchAccount)20 PendingIntent (android.app.PendingIntent)19 Pop3Store (com.fsck.k9.mail.store.pop3.Pop3Store)19 AuthenticationFailedException (com.fsck.k9.mail.AuthenticationFailedException)18