Commit a7d49f01 authored by Hussein's avatar Hussein

Merge branch 'bug/P4A-935' into develop

parents 99eaf44e e4462ff7
......@@ -3,7 +3,6 @@ package com.fsck.k9;
import android.app.Activity;
import android.app.Application;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
......@@ -332,7 +331,7 @@ public class K9 extends MultiDexApplication {
private static String pEpExtraAccounts = "";
//private static boolean pEpUseKeyserver = false;
private static boolean pEpPassiveMode = false;
private static boolean pEpSubjectUnprotected = false;
private static boolean pEpSubjectProtection = true;
private static boolean pEpForwardWarningEnabled = false;
private static boolean pEpSyncEnabled = BuildConfig.WITH_KEY_SYNC;
private static boolean shallRequestPermissions = true;
......@@ -604,7 +603,7 @@ public class K9 extends MultiDexApplication {
editor.putString("pEpExtraAccounts", pEpExtraAccounts);
//editor.putBoolean("pEpUseKeyserver", pEpUseKeyserver);
editor.putBoolean("pEpPassiveMode", pEpPassiveMode);
editor.putBoolean("pEpSubjectUnprotected", pEpSubjectUnprotected);
editor.putBoolean("pEpSubjectProtection", pEpSubjectProtection);
editor.putBoolean("pEpForwardWarningEnabled", pEpForwardWarningEnabled);
editor.putBoolean("pEpEnableSync", pEpSyncEnabled);
editor.putBoolean("shallRequestPermissions", shallRequestPermissions);
......@@ -963,7 +962,7 @@ public class K9 extends MultiDexApplication {
pEpExtraAccounts = storage.getString("pEpExtraAccounts", null);
//pEpUseKeyserver = storage.getBoolean("pEpUseKeyserver", false);
pEpPassiveMode = storage.getBoolean("pEpPassiveMode", false);
pEpSubjectUnprotected = storage.getBoolean("pEpSubjectUnprotected", false);
pEpSubjectProtection = getValuePEpSubjectProtection(storage);
pEpForwardWarningEnabled = storage.getBoolean("pEpForwardWarningEnabled", false);
pEpSyncEnabled = storage.getBoolean("pEpEnableSync", BuildConfig.WITH_KEY_SYNC);
......@@ -1013,6 +1012,10 @@ public class K9 extends MultiDexApplication {
K9.setUseFixedMessageViewTheme(storage.getBoolean("fixedMessageViewTheme", true));
}
private static boolean getValuePEpSubjectProtection(Storage storage) {
return storage.getBoolean("pEpSubjectProtection", !storage.getBoolean("pEpSubjectUnprotected", false));
}
/**
* Mutually excluyent setter for the behavior after a message is deleted.
*
......@@ -1750,14 +1753,14 @@ public class K9 extends MultiDexApplication {
}
public static boolean ispEpSubjectUnprotected() {
return pEpSubjectUnprotected;
public static boolean ispEpSubjectProtection() {
return pEpSubjectProtection;
}
public void setpEpSubjectUnprotected(boolean pEpSubjectUnprotected) {
K9.pEpSubjectUnprotected = pEpSubjectUnprotected;
pEpProvider.setSubjectUnprotected(pEpSubjectUnprotected);
MessagingController.getInstance(this).setSubjectUnprotected(pEpSubjectUnprotected);
public void setpEpSubjectProtection(boolean pEpSubjectProtection) {
K9.pEpSubjectProtection = pEpSubjectProtection;
pEpProvider.setSubjectProtection(pEpSubjectProtection);
MessagingController.getInstance(this).setSubjectProtected(pEpSubjectProtection);
}
......
......@@ -4859,8 +4859,8 @@ public class MessagingController implements Sync.MessageToSendCallback, KeyImpor
pEpProvider.setPassiveModeEnabled(enable);
}
public void setSubjectUnprotected(boolean subjectUnprotected) {
pEpProvider.setSubjectUnprotected(subjectUnprotected);
public void setSubjectProtected(boolean pEpSubjectProtection) {
pEpProvider.setSubjectProtection(pEpSubjectProtection);
}
public Message appendToInboxpEpSyncMessage(final Account account, final Message message) {
......
......@@ -176,7 +176,7 @@ public interface PEpProvider extends AutoCloseable {
KeyDetail getOwnKeyDetails(Message message);
void setSubjectUnprotected(boolean enabled);
void setSubjectProtection(boolean enabled);
List<KeyListItem> getBlacklistInfo();
......
......@@ -103,7 +103,7 @@ public class PEpProviderImpl implements PEpProvider {
private void initEngineConfig(Engine engine) {
engine.config_passive_mode(K9.getPEpPassiveMode());
configKeyServerLockup(K9.getPEpUseKeyserver());
engine.config_unencrypted_subject(K9.ispEpSubjectUnprotected());
engine.config_unencrypted_subject(!K9.ispEpSubjectProtection());
engine.setMessageToSendCallback(MessagingController.getInstance(context));
engine.setNotifyHandshakeCallback(((K9) context.getApplicationContext()).getNotifyHandshakeCallback());
}
......@@ -847,9 +847,9 @@ public class PEpProviderImpl implements PEpProvider {
// }
@Override
public synchronized void setSubjectUnprotected (boolean isUnprotected) {
public synchronized void setSubjectProtection(boolean isProtected) {
createEngineInstanceIfNeeded();
engine.config_unencrypted_subject(isUnprotected);
engine.config_unencrypted_subject(!isProtected);
}
@Override
......
......@@ -294,21 +294,23 @@ public class GlobalSettings {
s.put("pEpPassiveMode", Settings.versions(
new V(43, new BooleanSetting(true))
));
s.put("pEpSubjectUnprotected", Settings.versions(
new V(46, new BooleanSetting(true))
));
s.put("pEpForwardWarningEnabled", Settings.versions(
new V(47, new BooleanSetting(false))
));
s.put("pEpEnableSync", Settings.versions(
new V(49, new BooleanSetting(true))
));
s.put("pEpSubjectProtection", Settings.versions(
new V(50, new BooleanSetting(true))
));
SETTINGS = Collections.unmodifiableMap(s);
Map<Integer, SettingsUpgrader> u = new HashMap<>();
u.put(12, new SettingsUpgraderV12());
u.put(24, new SettingsUpgraderV24());
u.put(31, new SettingsUpgraderV31());
u.put(50, new SettingsUpgraderV50());
UPGRADERS = Collections.unmodifiableMap(u);
}
......@@ -422,6 +424,27 @@ public class GlobalSettings {
}
}
/**
* Upgrades the settings from version 49 to 50.
*
* <p>
* Convert value from <em>pEpSubjectUnprotected</em> to
* <em>pEpSubjectProtection</em>.
* </p>
*/
public static class SettingsUpgraderV50 implements SettingsUpgrader {
@Override
public Set<String> upgrade(Map<String, Object> settings) {
boolean oldValue = (Boolean) settings.get("pEpSubjectUnprotected");
settings.put("pEpSubjectProtection", !oldValue);
return new HashSet<>(Collections.singletonList("pEpSubjectUnprotected"));
}
}
private static class LanguageSetting extends PseudoEnumSetting<String> {
private final Map<String, String> mapping;
......
......@@ -45,7 +45,7 @@ class GeneralSettingsDataStore(
"sensitive_logging" -> K9.DEBUG_SENSITIVE
"pep_use_keyserver" -> K9.getPEpUseKeyserver()
"pep_passive_mode" -> K9.getPEpPassiveMode()
"pep_subject_unprotected" -> K9.ispEpSubjectUnprotected()
"pep_subject_protection" -> K9.ispEpSubjectProtection()
"pep_forward_warning" -> K9.ispEpForwardWarningEnabled()
"pep_enable_sync" -> K9.ispEpSyncEnabled()
else -> defValue
......@@ -84,7 +84,7 @@ class GeneralSettingsDataStore(
"sensitive_logging" -> K9.DEBUG_SENSITIVE = value
"pep_use_keyserver" -> app.setPEpUseKeyserver(value)
"pep_passive_mode" -> app.setPEpPassiveMode(value)
"pep_subject_unprotected" -> app.setpEpSubjectUnprotected(value)
"pep_subject_protection" -> app.setpEpSubjectProtection(value)
"pep_forward_warning" -> app.setpEpForwardWarningEnabled(value)
"pep_enable_sync" -> app.setpEpSyncEnabled(value) //TODO: CHECK
else -> return
......
......@@ -10,7 +10,6 @@
<string name="pep_extra_addresses">Extra key ids:</string>
<string name="pep_use_keyserver">Consultar les claus al servidor de claus</string>
<string name="pep_passive_mode">Mode passiu</string>
<string name="pep_subject_unprotected">Deshabilitar protecció de l\'assumpte</string>
<string name="pep_add_key_to_blacklist">Add a key to blacklist</string>
<string name="pep_remove_key_from_blacklist">Remove a key from blacklist</string>
<string name="pep_confirm_trustwords">Acceptar</string>
......
......@@ -12,7 +12,6 @@
<string name="pep_extra_addresses">Zusätzliche Schlüsselkennungen:</string>
<string name="pep_use_keyserver">Schlüssel auf Schlüsselserver suchen</string>
<string name="pep_passive_mode">Passivmodus</string>
<string name="pep_subject_unprotected">Betreff in Nachrichten nicht schützen</string>
<string name="pep_add_key_to_blacklist">Schlüssel nicht mehr verwenden</string>
<string name="pep_remove_key_from_blacklist">Schlüssel wieder verwenden</string>
<string name="pep_confirm_trustwords">Bestätigen</string>
......
......@@ -13,7 +13,6 @@
<!--<string name="pep_extra_addresses">Extra key ids:</string>-->
<string name="pep_use_keyserver">Buscar las claves en el servidor de claves</string>
<string name="pep_passive_mode">Modo pasivo</string>
<string name="pep_subject_unprotected">Deshabilitar protección del asunto</string>
<!--<string name="pep_add_key_to_blacklist">Add a key to blacklist</string>-->
<!--<string name="pep_remove_key_from_blacklist">Remove a key from blacklist</string>-->
<string name="pep_confirm_trustwords">Aceptar</string>
......
......@@ -13,7 +13,6 @@
<!--<string name="pep_extra_addresses">Extra key ids:</string>-->
<string name="pep_use_keyserver">Chercher les clefs sur le serveur de clefs</string>
<!--<string name="pep_passive_mode">Passive mode</string>-->
<string name="pep_subject_unprotected">Ne pas protéger le sujet des messages</string>
<!--<string name="pep_add_key_to_blacklist">Add a key to blacklist</string>-->
<!--<string name="pep_remove_key_from_blacklist">Remove a key from blacklist</string>-->
<string name="pep_confirm_trustwords">Accepter</string>
......
......@@ -12,7 +12,6 @@
<string name="pep_extra_addresses">Ekstra anahtar kimlikleri:</string>
<string name="pep_use_keyserver">Anahtarları anahtar sunucusunda ara</string>
<string name="pep_passive_mode">Pasif mod</string>
<string name="pep_subject_unprotected">Korunmasız mesaj konularını etkinleştir</string>
<string name="pep_add_key_to_blacklist">Kara listeye bir anahtarı ekleyin</string>
<string name="pep_remove_key_from_blacklist">Kara listeden bir anahtarı çıkarın</string>
<string name="pep_confirm_trustwords">Güvenlik kelimelerini Onayla</string>
......
......@@ -52,7 +52,7 @@
<string name="pep_extra_addresses">Extra key ids:</string>
<string name="pep_use_keyserver">Look up keys on key server</string>
<string name="pep_passive_mode">Passive mode</string>
<string name="pep_subject_unprotected">Unprotected message subjects</string>
<string name="pep_subject_protection">Protect Message subject</string>
<string name="pep_add_key_to_blacklist">Add a key to blacklist</string>
<string name="pep_remove_key_from_blacklist">Remove a key from blacklist</string>
<string name="pep_confirm_trustwords">Confirm</string>
......
......@@ -363,9 +363,9 @@
<!--CheckBoxPreference
android:key="pep_use_keyserver"
android:title="@string/pep_use_keyserver" /-->
<CheckBoxPreference
android:key="pep_subject_unprotected"
android:title="@string/pep_subject_unprotected" />
<SwitchPreferenceCompat
android:key="pep_subject_protection"
android:title="@string/pep_subject_protection" />
<Preference
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment