Home | History | Annotate | Download | only in adapter

Lines Matching refs:Mailbox

32 import com.android.emailcommon.provider.Mailbox;
74 // Chunk size for our mailbox commits
83 MailboxColumns.TYPE + "!=" + Mailbox.TYPE_EAS_ACCOUNT_MAILBOX;
120 UNINITIALIZED_PARENT_KEY.put(MailboxColumns.PARENT_KEY, Mailbox.PARENT_KEY_UNINITIALIZED);
141 // only the account mailbox
145 mContentResolver.delete(Mailbox.CONTENT_URI, ALL_BUT_ACCOUNT_MAILBOX,
174 // Save away any mailbox sync information that is NOT default
177 mContentResolver.delete(Mailbox.CONTENT_URI, ALL_BUT_ACCOUNT_MAILBOX,
217 return mContentResolver.query(Mailbox.CONTENT_URI, MAILBOX_ID_COLUMNS_PROJECTION,
226 // Find the mailbox in this account with the given serverId
232 ContentUris.withAppendedId(Mailbox.CONTENT_URI,
265 Account.CHECK_INTERVAL_NEVER + " OR " + Mailbox.SYNC_LOOKBACK + "!=" +
277 * For every mailbox in this account that has a non-default interval or lookback, save those
284 Cursor c = mContentResolver.query(Mailbox.CONTENT_URI, MAILBOX_STATE_PROJECTION,
300 * For every set of saved mailbox sync options, try to find and restore those values
313 mContentResolver.update(Mailbox.CONTENT_URI, cv, WHERE_SERVER_ID_AND_ACCOUNT,
321 public Mailbox addParser() throws IOException {
351 Mailbox mailbox = new Mailbox();
352 mailbox.mDisplayName = name;
353 mailbox.mServerId = serverId;
354 mailbox.mAccountKey = mAccountId;
355 mailbox.mType = Mailbox.TYPE_MAIL;
358 mailbox.mSyncInterval = Mailbox.CHECK_INTERVAL_NEVER;
361 mailbox.mType = Mailbox.TYPE_INBOX;
362 mailbox.mSyncInterval = mAccount.mSyncInterval;
365 mailbox.mType = Mailbox.TYPE_CONTACTS;
366 mailbox.mSyncInterval = mAccount.mSyncInterval;
371 // mailbox.
372 mailbox.mType = Mailbox.TYPE_OUTBOX;
375 mailbox.mType = Mailbox.TYPE_SENT;
378 mailbox.mType = Mailbox.TYPE_DRAFTS;
381 mailbox.mType = Mailbox.TYPE_TRASH;
384 mailbox.mType = Mailbox.TYPE_CALENDAR;
385 mailbox.mSyncInterval = mAccount.mSyncInterval;
388 mailbox.mType = Mailbox.TYPE_UNKNOWN;
393 mailbox.mFlagVisible = (mailbox.mType < Mailbox.TYPE_NOT_EMAIL);
396 mailbox.mParentServerId = parentId;
404 return mailbox;
410 * Determine whether a given mailbox holds mail, rather than other data. We do this by first
411 * checking the type of the mailbox (if it's a known good type, great; if it's a known bad
417 * @param mailbox the mailbox we're checking
419 * the corresponding mailbox structures
420 * @return whether or not the mailbox contains email (rather than PIM or unknown data)
422 /*package*/ boolean isValidMailFolder(Mailbox mailbox, HashMap<String, Mailbox> mailboxMap) {
423 int folderType = mailbox.mType;
425 if (folderType < Mailbox.TYPE_NOT_EMAIL) return true;
427 if (folderType != Mailbox.TYPE_UNKNOWN) return false;
429 Mailbox parent = mailboxMap.get(mailbox.mParentServerId);
431 // Mailbox, so we'll have to query the database
435 if (mailbox.mParentServerId != null) {
436 mBindArguments[1] = mailbox.mParentServerId;
437 parentId = Utility.getFirstRowInt(mContext, Mailbox.CONTENT_URI,
444 parent = Mailbox.restoreMailboxWithId(mContext, parentId);
478 // If we find the mailbox (using serverId), make the change
492 cv.put(Mailbox.DISPLAY_NAME, displayName);
495 cv.put(Mailbox.PARENT_SERVER_ID, parentId);
497 cv.put(Mailbox.PARENT_KEY, Mailbox.PARENT_KEY_UNINITIALIZED);
499 ContentUris.withAppendedId(Mailbox.CONTENT_URI,
510 private boolean commitMailboxes(ArrayList<Mailbox> validMailboxes,
511 ArrayList<Mailbox> userMailboxes, HashMap<String, Mailbox> mailboxMap,
515 for (Mailbox m: userMailboxes) {
517 m.mType = Mailbox.TYPE_MAIL;
520 userLog("Rejecting unknown type mailbox: " + m.mDisplayName);
525 for (Mailbox m: validMailboxes) {
526 userLog("Adding mailbox: ", m.mDisplayName);
528 .newInsert(Mailbox.CONTENT_URI).withValues(m.toContentValues()).build());
532 userLog("Applying ", mOperations.size(), " mailbox operations.");
551 final ArrayList<Mailbox> addMailboxes = new ArrayList<Mailbox>();
553 // Indicate start of (potential) mailbox changes
558 Mailbox mailbox = addParser();
559 if (mailbox != null) {
560 addMailboxes.add(mailbox);
576 ArrayList<Mailbox> validMailboxes = new ArrayList<Mailbox>();
578 ArrayList<Mailbox> userMailboxes = new ArrayList<Mailbox>();
580 // Maps folder serverId to mailbox (used to validate user mailboxes)
581 HashMap<String, Mailbox> mailboxMap = new HashMap<String, Mailbox>();
582 for (Mailbox mailbox : addMailboxes) {
583 mailboxMap.put(mailbox.mServerId, mailbox);
587 for (Mailbox mailbox : addMailboxes) {
588 // And add the mailbox to the proper list
589 if (mailbox.mType == Mailbox.TYPE_UNKNOWN) {
590 userMailboxes.add(mailbox);
592 validMailboxes.add(mailbox);
620 String accountSelector = Mailbox.ACCOUNT_KEY + "=" + mAccount.mId;
628 Cursor c = mContentResolver.query(Mailbox.CONTENT_URI,
629 Mailbox.CONTENT_PROJECTION, Mailbox.PARENT_SERVER_ID + "=?",
641 // Signal completion of mailbox changes
662 Cursor c = mContentResolver.query(Mailbox.CONTENT_URI,
676 mContentResolver.delete(ContentUris.withAppendedId(Mailbox.CONTENT_URI, id),
679 mContentResolver.delete(Mailbox.CONTENT_URI, WHERE_PARENT_SERVER_ID_AND_ACCOUNT,