예제 #1
0
  /**
   * Brief data
   *
   * @param uid
   * @param password
   * @param firstName
   * @param surname
   * @param email
   * @param phone
   * @param org
   * @param description
   * @return
   */
  public static Account createBrief(
      String uid,
      String password,
      String firstName,
      String surname,
      String email,
      String phone,
      String org,
      String title,
      String description) {

    Account account = new AccountImpl();

    account.setUid(uid);
    account.setPassword(password);

    account.setGivenName(firstName);
    account.setSurname(surname);

    account.setCommonName(formatCommonName(firstName, surname));

    account.setEmail(email);
    account.setPhone(phone);
    account.setOrg(org);
    account.setTitle(title);
    account.setDescription(description);

    return account;
  }
예제 #2
0
 /**
  * Creates an account object from another one, given as argument.
  *
  * @param o other account to copy
  */
 public static Account create(Account o) {
   Account a = new AccountImpl();
   a.setUid(o.getUid());
   a.setCommonName(o.getCommonName());
   a.setSurname(o.getSurname());
   a.setOrg(o.getOrg());
   a.setEmail(o.getEmail());
   a.setPhone(o.getPhone());
   a.setDescription(o.getDescription());
   // passwords / new passwords fields voluntarily omitted:
   // the password update process should not go through this.
   a.setGivenName(o.getGivenName());
   a.setTitle(o.getTitle());
   a.setPostalAddress(o.getPostalAddress());
   a.setPostalCode(o.getPostalCode());
   a.setRegisteredAddress(o.getRegisteredAddress());
   a.setPostOfficeBox(o.getPostOfficeBox());
   a.setPhysicalDeliveryOfficeName(o.getPhysicalDeliveryOfficeName());
   a.setStreet(o.getStreet());
   a.setLocality(o.getLocality());
   a.setFacsimile(o.getFacsimile());
   a.setMobile(o.getMobile());
   a.setRoomNumber(o.getRoomNumber());
   a.setStateOrProvince(o.getStateOrProvince());
   a.setOrganizationalUnit(o.getOrganizationalUnit());
   a.setHomePostalAddress(o.getHomePostalAddress());
   return a;
 }
예제 #3
0
  /**
   * Creates an account object with all data.
   *
   * @param uid
   * @param cn full name
   * @param surname surname
   * @param givenName first name
   * @param email
   * @param org
   * @param title
   * @param phone
   * @param description
   * @param postalAddress
   * @param postalCode
   * @param registeredAddress
   * @param postOfficeBox
   * @param physicalDeliveryOfficeName
   * @param locality
   * @param street
   * @param facsimile
   * @param organizationalUnit
   * @param mobile
   * @param roomNumber
   * @return {@link Account}
   */
  public static Account createFull(
      String uid,
      String cn,
      String surname,
      String givenName,
      String email,
      String org,
      String title,
      String phone,
      String description,
      String postalAddress,
      String postalCode,
      String registeredAddress,
      String postOfficeBox,
      String physicalDeliveryOfficeName,
      String street,
      String locality,
      String facsimile,
      String organizationalUnit,
      String homePostalAddress,
      String mobile,
      String roomNumber,
      String stateOrProvince) {

    Account a = new AccountImpl();

    a.setUid(uid);
    a.setCommonName(cn);
    a.setGivenName(givenName);
    a.setSurname(surname);
    a.setEmail(email);

    a.setOrg(org);
    a.setTitle(title);

    a.setPhone(phone);
    a.setDescription(description);

    a.setStreet(street);
    a.setLocality(locality);

    a.setPostalAddress(postalAddress);
    a.setPostalCode(postalCode);
    a.setRegisteredAddress(registeredAddress);
    a.setPostOfficeBox(postOfficeBox);
    a.setPhysicalDeliveryOfficeName(physicalDeliveryOfficeName);

    a.setFacsimile(facsimile);
    a.setOrganizationalUnit(organizationalUnit);

    a.setHomePostalAddress(homePostalAddress);
    a.setMobile(mobile);
    a.setRoomNumber(roomNumber);
    a.setStateOrProvince(stateOrProvince);

    return a;
  }
예제 #4
0
  private void onDone() {
    mAccount.setDescription(mAccount.getEmail());
    mAccount.setNotifyNewMail(mNotifyView.isChecked());
    mAccount.setShowOngoing(mNotifySyncView.isChecked());
    mAccount.setAutomaticCheckIntervalMinutes(
        (Integer) ((SpinnerOption) mCheckFrequencyView.getSelectedItem()).value);
    mAccount.setDisplayCount((Integer) ((SpinnerOption) mDisplayCountView.getSelectedItem()).value);

    if (mPushEnable.isChecked()) {
      mAccount.setFolderPushMode(Account.FolderMode.FIRST_CLASS);
    } else {
      mAccount.setFolderPushMode(Account.FolderMode.NONE);
    }

    mAccount.save(Preferences.getPreferences(this));
    if (mAccount.equals(Preferences.getPreferences(this).getDefaultAccount())
        || getIntent().getBooleanExtra(EXTRA_MAKE_DEFAULT, false)) {
      Preferences.getPreferences(this).setDefaultAccount(mAccount);
    }
    K9.setServicesEnabled(this);
    AccountSetupNames.actionSetNames(this, mAccount);
    finish();
  }
  protected void onNext() {
    try {

      ConnectionSecurity connectionSecurity = getSelectedSecurity();

      String username = mUsernameView.getText().toString();
      String password = null;
      String clientCertificateAlias = null;

      AuthType authType = getSelectedAuthType();
      if (authType == AuthType.EXTERNAL) {
        clientCertificateAlias = mClientCertificateSpinner.getAlias();
      } else {
        password = mPasswordView.getText().toString();
      }
      String host = mServerView.getText().toString();
      int port = Integer.parseInt(mPortView.getText().toString());

      Map<String, String> extra = null;
      if (Type.IMAP == mStoreType) {
        extra = new HashMap<String, String>();
        extra.put(
            ImapStoreSettings.AUTODETECT_NAMESPACE_KEY,
            Boolean.toString(mImapAutoDetectNamespaceView.isChecked()));
        extra.put(ImapStoreSettings.PATH_PREFIX_KEY, mImapPathPrefixView.getText().toString());
      } else if (Type.WebDAV == mStoreType) {
        extra = new HashMap<String, String>();
        extra.put(WebDavStoreSettings.PATH_KEY, mWebdavPathPrefixView.getText().toString());
        extra.put(WebDavStoreSettings.AUTH_PATH_KEY, mWebdavAuthPathView.getText().toString());
        extra.put(
            WebDavStoreSettings.MAILBOX_PATH_KEY, mWebdavMailboxPathView.getText().toString());
      }

      mAccount.deleteCertificate(host, port, CheckDirection.INCOMING);
      ServerSettings settings =
          new ServerSettings(
              mStoreType,
              host,
              port,
              connectionSecurity,
              authType,
              username,
              password,
              clientCertificateAlias,
              extra);

      mAccount.setStoreUri(RemoteStore.createStoreUri(settings));

      mAccount.setCompression(NetworkType.MOBILE, mCompressionMobile.isChecked());
      mAccount.setCompression(NetworkType.WIFI, mCompressionWifi.isChecked());
      mAccount.setCompression(NetworkType.OTHER, mCompressionOther.isChecked());
      // mAccount.setSubscribedFoldersOnly(mSubscribedFoldersOnly.isChecked());

      // visual voicemail specific setup
      if (!Intent.ACTION_EDIT.equals(getIntent().getAction())) {
        mAccount.setRequiresCellular(mRequiresCellular.isChecked());
        mAccount.setDescription(mAccountName.getText().toString());
        mAccount.setPhoneNumber("");
        mAccount = AccountCreator.initialVisualVoicemailSetup(AccountSetupIncoming.this, mAccount);
      }

      AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.INCOMING);
    } catch (Exception e) {
      failure(e);
    }
  }