| 456 | } |
| 457 | |
| 458 | private void onSave(boolean should) { |
| 459 | Bundle args = new Bundle(); |
| 460 | args.putLong("id", id); |
| 461 | |
| 462 | int encryption; |
| 463 | if (rgEncryption.getCheckedRadioButtonId() == R.id.radio_starttls) |
| 464 | encryption = EmailService.ENCRYPTION_STARTTLS; |
| 465 | else if (rgEncryption.getCheckedRadioButtonId() == R.id.radio_none) |
| 466 | encryption = EmailService.ENCRYPTION_NONE; |
| 467 | else |
| 468 | encryption = EmailService.ENCRYPTION_SSL; |
| 469 | |
| 470 | args.putBoolean("dnssec", cbDnsSec.isChecked()); |
| 471 | args.putString("host", etHost.getText().toString().trim().replace(" ", "")); |
| 472 | args.putInt("encryption", encryption); |
| 473 | args.putBoolean("insecure", cbInsecure.isChecked()); |
| 474 | args.putBoolean("dane", cbDane.isChecked()); |
| 475 | args.putString("port", etPort.getText().toString()); |
| 476 | args.putInt("auth", auth); |
| 477 | args.putString("user", etUser.getText().toString()); |
| 478 | args.putString("password", tilPassword.getEditText().getText().toString()); |
| 479 | |
| 480 | args.putString("name", etName.getText().toString()); |
| 481 | args.putString("category", etCategory.getText().toString()); |
| 482 | args.putInt("color", btnColor.getColor()); |
| 483 | args.putString("avatar", avatar); |
| 484 | args.putString("calendar", calendar); |
| 485 | |
| 486 | args.putBoolean("synchronize", cbSynchronize.isChecked()); |
| 487 | args.putBoolean("ignore_schedule", cbIgnoreSchedule.isChecked()); |
| 488 | args.putBoolean("ondemand", cbOnDemand.isChecked()); |
| 489 | args.putBoolean("primary", cbPrimary.isChecked()); |
| 490 | args.putBoolean("notify", cbNotify.isChecked()); |
| 491 | args.putBoolean("summary", cbSummary.isChecked()); |
| 492 | args.putBoolean("auto_seen", cbAutoSeen.isChecked()); |
| 493 | |
| 494 | args.putBoolean("leave_server", cbLeaveServer.isChecked()); |
| 495 | args.putBoolean("client_delete", cbClientDelete.isChecked()); |
| 496 | args.putBoolean("leave_deleted", cbLeaveDeleted.isChecked()); |
| 497 | args.putBoolean("leave_device", cbLeaveDevice.isChecked()); |
| 498 | args.putString("max", etMax.getText().toString()); |
| 499 | args.putString("interval", etInterval.getText().toString()); |
| 500 | args.putBoolean("unmetered", cbUnmetered.isChecked()); |
| 501 | args.putBoolean("vpn_only", cbVpnOnly.isChecked()); |
| 502 | |
| 503 | args.putLong("left", ((EntityFolder) spLeft.getSelectedItem()).id); |
| 504 | args.putLong("right", ((EntityFolder) spRight.getSelectedItem()).id); |
| 505 | |
| 506 | args.putBoolean("should", should); |
| 507 | |
| 508 | new SimpleTask<Boolean>() { |
| 509 | @Override |
| 510 | protected void onPreExecute(Bundle args) { |
| 511 | saving = true; |
| 512 | invalidateOptionsMenu(); |
| 513 | Helper.setViewsEnabled(view, false); |
| 514 | pbSave.setVisibility(View.VISIBLE); |
| 515 | grpError.setVisibility(View.GONE); |