mirror of https://github.com/M66B/FairEmail.git
Added sign by default setting
This commit is contained in:
parent
0db54919e8
commit
3cd61f1801
|
@ -2197,6 +2197,7 @@ public class FragmentCompose extends FragmentBase {
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
boolean plain_only = prefs.getBoolean("plain_only", false);
|
boolean plain_only = prefs.getBoolean("plain_only", false);
|
||||||
|
boolean sign_default = prefs.getBoolean("sign_default", false);
|
||||||
boolean encrypt_default = prefs.getBoolean("encrypt_default", false);
|
boolean encrypt_default = prefs.getBoolean("encrypt_default", false);
|
||||||
boolean receipt_default = prefs.getBoolean("receipt_default", false);
|
boolean receipt_default = prefs.getBoolean("receipt_default", false);
|
||||||
|
|
||||||
|
@ -2233,6 +2234,8 @@ public class FragmentCompose extends FragmentBase {
|
||||||
data.draft.plain_only = true;
|
data.draft.plain_only = true;
|
||||||
if (encrypt_default)
|
if (encrypt_default)
|
||||||
data.draft.encrypt = EntityMessage.PGP_SIGNENCRYPT;
|
data.draft.encrypt = EntityMessage.PGP_SIGNENCRYPT;
|
||||||
|
else if (sign_default)
|
||||||
|
data.draft.encrypt = EntityMessage.PGP_SIGNONLY;
|
||||||
if (receipt_default)
|
if (receipt_default)
|
||||||
data.draft.receipt_request = true;
|
data.draft.receipt_request = true;
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||||
private SwitchCompat swDisableTracking;
|
private SwitchCompat swDisableTracking;
|
||||||
private SwitchCompat swDisplayHidden;
|
private SwitchCompat swDisplayHidden;
|
||||||
private Spinner spOpenPgp;
|
private Spinner spOpenPgp;
|
||||||
|
private SwitchCompat swSign;
|
||||||
private SwitchCompat swEncrypt;
|
private SwitchCompat swEncrypt;
|
||||||
private SwitchCompat swAutoDecrypt;
|
private SwitchCompat swAutoDecrypt;
|
||||||
private SwitchCompat swSecure;
|
private SwitchCompat swSecure;
|
||||||
|
@ -72,7 +73,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||||
|
|
||||||
private final static String[] RESET_OPTIONS = new String[]{
|
private final static String[] RESET_OPTIONS = new String[]{
|
||||||
"disable_tracking", "display_hidden",
|
"disable_tracking", "display_hidden",
|
||||||
"openpgp_provider", "encrypt_default", "auto_decrypt",
|
"openpgp_provider", "sign_default", "encrypt_default", "auto_decrypt",
|
||||||
"secure",
|
"secure",
|
||||||
"biometrics", "pin", "biometrics_timeout"
|
"biometrics", "pin", "biometrics_timeout"
|
||||||
};
|
};
|
||||||
|
@ -90,6 +91,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||||
swDisableTracking = view.findViewById(R.id.swDisableTracking);
|
swDisableTracking = view.findViewById(R.id.swDisableTracking);
|
||||||
swDisplayHidden = view.findViewById(R.id.swDisplayHidden);
|
swDisplayHidden = view.findViewById(R.id.swDisplayHidden);
|
||||||
spOpenPgp = view.findViewById(R.id.spOpenPgp);
|
spOpenPgp = view.findViewById(R.id.spOpenPgp);
|
||||||
|
swSign = view.findViewById(R.id.swSign);
|
||||||
swEncrypt = view.findViewById(R.id.swEncrypt);
|
swEncrypt = view.findViewById(R.id.swEncrypt);
|
||||||
swAutoDecrypt = view.findViewById(R.id.swAutoDecrypt);
|
swAutoDecrypt = view.findViewById(R.id.swAutoDecrypt);
|
||||||
swSecure = view.findViewById(R.id.swSecure);
|
swSecure = view.findViewById(R.id.swSecure);
|
||||||
|
@ -140,10 +142,18 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
swSign.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||||
|
prefs.edit().putBoolean("sign_default", checked).apply();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
swEncrypt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
swEncrypt.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||||
prefs.edit().putBoolean("encrypt_default", checked).apply();
|
prefs.edit().putBoolean("encrypt_default", checked).apply();
|
||||||
|
swSign.setEnabled(!checked);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -265,7 +275,9 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
swSign.setChecked(prefs.getBoolean("sign_default", false));
|
||||||
swEncrypt.setChecked(prefs.getBoolean("encrypt_default", false));
|
swEncrypt.setChecked(prefs.getBoolean("encrypt_default", false));
|
||||||
|
swSign.setEnabled(!swEncrypt.isChecked());
|
||||||
swAutoDecrypt.setChecked(prefs.getBoolean("auto_decrypt", false));
|
swAutoDecrypt.setChecked(prefs.getBoolean("auto_decrypt", false));
|
||||||
swSecure.setChecked(prefs.getBoolean("secure", false));
|
swSecure.setChecked(prefs.getBoolean("secure", false));
|
||||||
|
|
||||||
|
|
|
@ -80,15 +80,26 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tvOpenPgp" />
|
app:layout_constraintTop_toBottomOf="@id/tvOpenPgp" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
android:id="@+id/swSign"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:text="@string/title_advanced_sign_default"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/spOpenPgp"
|
||||||
|
app:switchPadding="12dp" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
android:id="@+id/swEncrypt"
|
android:id="@+id/swEncrypt"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="12dp"
|
||||||
android:text="@string/title_identity_encrypt"
|
android:text="@string/title_advanced_encrypt_default"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/spOpenPgp"
|
app:layout_constraintTop_toBottomOf="@id/swSign"
|
||||||
app:switchPadding="12dp" />
|
app:switchPadding="12dp" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
|
|
@ -331,6 +331,8 @@
|
||||||
<string name="title_advanced_tracking">Automatically recognize and disable tracking images</string>
|
<string name="title_advanced_tracking">Automatically recognize and disable tracking images</string>
|
||||||
<string name="title_advanced_display_hidden">Display hidden message texts</string>
|
<string name="title_advanced_display_hidden">Display hidden message texts</string>
|
||||||
<string name="title_advanced_openpgp">OpenPGP provider</string>
|
<string name="title_advanced_openpgp">OpenPGP provider</string>
|
||||||
|
<string name="title_advanced_sign_default">Sign by default</string>
|
||||||
|
<string name="title_advanced_encrypt_default">Encrypt by default</string>
|
||||||
<string name="title_advanced_auto_decrypt">Automatically decrypt messages</string>
|
<string name="title_advanced_auto_decrypt">Automatically decrypt messages</string>
|
||||||
<string name="title_advanced_secure">Hide from recent apps screen and prevent taking screenshots</string>
|
<string name="title_advanced_secure">Hide from recent apps screen and prevent taking screenshots</string>
|
||||||
<string name="title_advanced_biometrics_timeout">Biometric authentication timeout</string>
|
<string name="title_advanced_biometrics_timeout">Biometric authentication timeout</string>
|
||||||
|
@ -412,7 +414,6 @@
|
||||||
<string name="title_advanced_sender">Allow editing sender address</string>
|
<string name="title_advanced_sender">Allow editing sender address</string>
|
||||||
<string name="title_advanced_sender_regex">Regex to match edited addresses</string>
|
<string name="title_advanced_sender_regex">Regex to match edited addresses</string>
|
||||||
<string name="title_identity_reply_to">Reply to address</string>
|
<string name="title_identity_reply_to">Reply to address</string>
|
||||||
<string name="title_identity_encrypt">Encrypt by default</string>
|
|
||||||
<string name="title_identity_receipt">Request delivery/read receipt by default</string>
|
<string name="title_identity_receipt">Request delivery/read receipt by default</string>
|
||||||
<string name="title_identity_use_ip_hint">In case of \'invalid greeting\', \'requires valid address\' or a similar error, try to change this setting</string>
|
<string name="title_identity_use_ip_hint">In case of \'invalid greeting\', \'requires valid address\' or a similar error, try to change this setting</string>
|
||||||
<string name="title_optional">Optional</string>
|
<string name="title_optional">Optional</string>
|
||||||
|
|
Loading…
Reference in New Issue