public static void actionIncomingSettings(
     Activity context, Account account, boolean makeDefault) {
   Intent i = new Intent(context, AccountSetupIncoming.class);
   i.putExtra(EXTRA_ACCOUNT, account.getUuid());
   i.putExtra(EXTRA_MAKE_DEFAULT, makeDefault);
   context.startActivity(i);
 }
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putString(EXTRA_ACCOUNT, mAccount.getUuid());
   outState.putInt(STATE_SECURITY_TYPE_POSITION, mCurrentSecurityTypeViewPosition);
   outState.putInt(STATE_AUTH_TYPE_POSITION, mCurrentAuthTypeViewPosition);
 }
  public synchronized Account newAccount() {
    newAccount = new Account(K9.app);
    accounts.put(newAccount.getUuid(), newAccount);
    accountsInOrder.add(newAccount);

    return newAccount;
  }
 public static void actionCheckSettings(
     Activity context, Account account, CheckDirection direction) {
   Intent i = new Intent(context, AccountSetupCheckSettings.class);
   i.putExtra(EXTRA_ACCOUNT, account.getUuid());
   i.putExtra(EXTRA_CHECK_DIRECTION, direction);
   context.startActivityForResult(i, ACTIVITY_REQUEST_CODE);
 }
  public synchronized Account getAccount(String uuid) {
    if (accounts == null) {
      loadAccounts();
    }

    for (Account account : accounts) {
      if (account.getUuid().equals(uuid)) {
        return account;
      }
    }

    if ((newAccount != null) && newAccount.getUuid().equals(uuid)) {
      return newAccount;
    }

    return null;
  }
 public static void actionCheckSettings(
     Activity context, Account account, boolean checkIncoming, boolean checkOutgoing) {
   Intent i = new Intent(context, AccountSetupCheckSettings.class);
   i.putExtra(EXTRA_ACCOUNT, account.getUuid());
   i.putExtra(EXTRA_CHECK_INCOMING, checkIncoming);
   i.putExtra(EXTRA_CHECK_OUTGOING, checkOutgoing);
   context.startActivityForResult(i, ACTIVITY_REQUEST_CODE);
 }
Exemple #7
0
 public Conversation(
     final String name, final Account account, final Jid contactJid, final int mode) {
   this(
       java.util.UUID.randomUUID().toString(),
       name,
       null,
       account.getUuid(),
       contactJid,
       System.currentTimeMillis(),
       STATUS_AVAILABLE,
       mode,
       "");
   this.account = account;
 }
Exemple #8
0
  public static Intent actionHandleAccountIntent(
      Context context, Account account, String initialFolder, boolean fromShortcut) {
    Intent intent = new Intent(context, FolderList.class);
    intent.putExtra(EXTRA_ACCOUNT, account.getUuid());

    if (initialFolder != null) {
      intent.putExtra(EXTRA_INITIAL_FOLDER, initialFolder);
    }

    if (fromShortcut) {
      intent.putExtra(EXTRA_FROM_SHORTCUT, true);
    }

    return intent;
  }
Exemple #9
0
  public static Intent actionHandleNotification(
      Context context, Account account, String initialFolder) {
    Intent intent =
        new Intent(
            Intent.ACTION_VIEW,
            Uri.parse("email://accounts/" + account.getAccountNumber()),
            context,
            FolderList.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra(EXTRA_ACCOUNT, account.getUuid());
    intent.putExtra(EXTRA_FROM_NOTIFICATION, true);

    if (initialFolder != null) {
      intent.putExtra(EXTRA_INITIAL_FOLDER, initialFolder);
    }
    return intent;
  }
Exemple #10
0
 public synchronized void loadAccounts() {
   accounts = new HashMap<String, Account>();
   accountsInOrder = new LinkedList<Account>();
   String accountUuids = getPreferences().getString("accountUuids", null);
   if ((accountUuids != null) && (accountUuids.length() != 0)) {
     String[] uuids = accountUuids.split(",");
     for (String uuid : uuids) {
       Account newAccount = new Account(this, uuid);
       accounts.put(uuid, newAccount);
       accountsInOrder.add(newAccount);
     }
   }
   if ((newAccount != null) && newAccount.getAccountNumber() != -1) {
     accounts.put(newAccount.getUuid(), newAccount);
     accountsInOrder.add(newAccount);
     newAccount = null;
   }
 }
Exemple #11
0
  public synchronized void deleteAccount(Account account) {
    if (account == null) {
      LogUtils.i("K9zywx", "deleteAccount: account is null, cancelled");
      return;
    }

    if (accounts != null) {
      accounts.remove(account.getUuid());
    }
    if (accountsInOrder != null) {
      accountsInOrder.remove(account);
    }

    account.delete(this);

    if (newAccount == account) {
      newAccount = null;
    }
  }
 public static Intent intentActionEditIncomingSettings(Context context, Account account) {
   Intent i = new Intent(context, AccountSetupIncoming.class);
   i.setAction(Intent.ACTION_EDIT);
   i.putExtra(EXTRA_ACCOUNT, account.getUuid());
   return i;
 }
 public static void actionNewAccountSetup(Activity context, Account account) {
   Intent i = new Intent(context, AccountSetupIncoming.class);
   i.putExtra(EXTRA_ACCOUNT, account.getUuid());
   i.putExtra(EXTRA_MAKE_DEFAULT, true);
   context.startActivityForResult(i, 0);
 }
Exemple #14
0
 public void setDefaultAccount(Account account) {
   getPreferences().edit().putString("defaultAccountUuid", account.getUuid()).commit();
 }
 public void setAccount(Account account) {
   this.account = account;
   this.accountUuid = account.getUuid();
 }
Exemple #16
0
 public static void actionSettings(Context context, Account account, String folderName) {
   Intent i = new Intent(context, FolderSettings.class);
   i.putExtra(EXTRA_FOLDER_NAME, folderName);
   i.putExtra(EXTRA_ACCOUNT, account.getUuid());
   context.startActivity(i);
 }