Ejemplo n.º 1
0
 private void setDisplayMode(FolderMode newMode) {
   mAccount.setFolderDisplayMode(newMode);
   mAccount.save(Preferences.getPreferences(this));
   if (mAccount.getFolderPushMode() != FolderMode.NONE) {
     MailService.actionRestartPushers(this, null);
   }
   onRefresh(false);
 }
Ejemplo n.º 2
0
  /**
   * On resume we refresh the folder list (in the background) and we refresh the messages for any
   * folder that is currently open. This guarantees that things like unread message count and read
   * status are updated.
   */
  @Override
  public void onResume() {
    super.onResume();

    if (!mAccount.isAvailable(this)) {
      Log.i(K9.LOG_TAG, "account unavaliabale, not showing folder-list but account-list");
      startActivity(new Intent(this, Accounts.class));
      finish();
      return;
    }
    if (mAdapter == null) initializeActivityView();

    MessagingController.getInstance(getApplication()).addListener(mAdapter.mListener);
    // mAccount.refresh(Preferences.getPreferences(this));
    MessagingController.getInstance(getApplication())
        .getAccountStats(this, mAccount, mAdapter.mListener);

    onRefresh(!REFRESH_REMOTE);

    MessagingController.getInstance(getApplication()).notifyAccountCancel(this, mAccount);
  }
Ejemplo n.º 3
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case R.id.compose:
        MessageCompose.actionCompose(this, mAccount);

        return true;

      case R.id.check_mail:
        MessagingController.getInstance(getApplication())
            .checkMail(this, mAccount, true, true, mAdapter.mListener);

        return true;

      case R.id.send_messages:
        MessagingController.getInstance(getApplication()).sendPendingMessages(mAccount, null);
        return true;
      case R.id.accounts:
        onAccounts();

        return true;

      case R.id.list_folders:
        onRefresh(REFRESH_REMOTE);

        return true;

      case R.id.account_settings:
        onEditAccount();

        return true;

      case R.id.app_settings:
        onEditPrefs();

        return true;

      case R.id.empty_trash:
        onEmptyTrash(mAccount);

        return true;

      case R.id.compact:
        onCompact(mAccount);

        return true;

      case R.id.export:
        onExport(mAccount);
        return true;

      case R.id.export_all:
        onExport(null);
        return true;

      case R.id.display_1st_class:
        {
          setDisplayMode(FolderMode.FIRST_CLASS);
          return true;
        }
      case R.id.display_1st_and_2nd_class:
        {
          setDisplayMode(FolderMode.FIRST_AND_SECOND_CLASS);
          return true;
        }
      case R.id.display_not_second_class:
        {
          setDisplayMode(FolderMode.NOT_SECOND_CLASS);
          return true;
        }
      case R.id.display_all:
        {
          setDisplayMode(FolderMode.ALL);
          return true;
        }
      default:
        return super.onOptionsItemSelected(item);
    }
  }