Commit c5961ee4 authored by Hussein's avatar Hussein

P4A-1024 Add pEpSyncFolder setting

parent bbd7a6af
......@@ -10,7 +10,6 @@ import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
......@@ -27,7 +26,6 @@ import androidx.multidex.MultiDexApplication;
import com.evernote.android.job.JobManager;
import com.fsck.k9.Account.SortType;
import com.fsck.k9.account.AndroidAccountOAuth2TokenStore;
import com.fsck.k9.activity.K9ActivityCommon;
import com.fsck.k9.activity.MessageCompose;
import com.fsck.k9.activity.UpgradeDatabases;
import com.fsck.k9.controller.MessagingController;
......@@ -73,7 +71,6 @@ import java.util.Collections;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
......@@ -339,6 +336,7 @@ public class K9 extends MultiDexApplication {
private static boolean pEpForwardWarningEnabled = false;
private static boolean pEpSyncEnabled = BuildConfig.WITH_KEY_SYNC;
private static boolean shallRequestPermissions = true;
private static boolean usingpEpSyncFolder = true;
private boolean grouped = false;
private static Set<String> pEpExtraKeys = Collections.emptySet();
......@@ -612,6 +610,8 @@ public class K9 extends MultiDexApplication {
editor.putBoolean("pEpEnableSync", pEpSyncEnabled);
editor.putBoolean("shallRequestPermissions", shallRequestPermissions);
editor.putBoolean("pEpSyncFolder", usingpEpSyncFolder);
fontSizes.save(editor);
}
......@@ -971,7 +971,7 @@ public class K9 extends MultiDexApplication {
pEpSubjectProtection = getValuePEpSubjectProtection(storage);
pEpForwardWarningEnabled = storage.getBoolean("pEpForwardWarningEnabled", false);
pEpSyncEnabled = storage.getBoolean("pEpEnableSync", BuildConfig.WITH_KEY_SYNC);
usingpEpSyncFolder = storage.getBoolean("pEpSyncFolder", pEpSyncEnabled);
mAttachmentDefaultPath = storage.getString("attachmentdefaultpath",
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString());
......@@ -1628,6 +1628,14 @@ public class K9 extends MultiDexApplication {
K9.sPgpSignOnlyDialogCounter = pgpSignOnlyDialogCounter;
}
public static boolean isUsingpEpSyncFolder() {
return usingpEpSyncFolder;
}
public static void setUsingpEpSyncFolder(boolean usingpEpSyncFolder) {
K9.usingpEpSyncFolder = usingpEpSyncFolder;
}
/**
* Check if we already know whether all databases are using the current database schema.
*
......
......@@ -304,6 +304,9 @@ public class GlobalSettings {
s.put("pEpSubjectProtection", Settings.versions(
new V(50, new BooleanSetting(true))
));
s.put("pEpSyncFolder", Settings.versions(
new V(51, new BooleanSetting(true))
));
SETTINGS = Collections.unmodifiableMap(s);
Map<Integer, SettingsUpgrader> u = new HashMap<>();
......
......@@ -36,7 +36,7 @@ public class Settings {
*
* @see SettingsExporter
*/
public static final int VERSION = 50;
public static final int VERSION = 51;
static Map<String, Object> validate(int version, Map<String, TreeMap<Integer, SettingsDescription>> settings,
Map<String, String> importedSettings, boolean useDefaultValues) {
......
......@@ -49,6 +49,7 @@ class GeneralSettingsDataStore(
"pep_subject_protection" -> K9.ispEpSubjectProtection()
"pep_forward_warning" -> K9.ispEpForwardWarningEnabled()
"pep_enable_sync" -> K9.ispEpSyncEnabled()
"pep_sync_folder" -> K9.isUsingpEpSyncFolder()
else -> defValue
}
}
......@@ -88,6 +89,7 @@ class GeneralSettingsDataStore(
"pep_subject_protection" -> app.setpEpSubjectProtection(value)
"pep_forward_warning" -> app.setpEpForwardWarningEnabled(value)
"pep_enable_sync" -> app.setpEpSyncEnabled(value) //TODO: CHECK
"pep_sync_folder" -> K9.setUsingpEpSyncFolder(value)
else -> return
}
......
......@@ -278,4 +278,8 @@
<string name="pgp_key_import_dialog_accept_button">Select and import key</string>
<string name="pgp_key_import_dialog_summary">Import from filesystem</string>
<string name="pgp_key_import_dialog_empty_edittext">Fingerprint is mandatory</string>
<string name="pep_sync_folder">p≡p sync folder</string>
<string name="pep_sync_folder_is_enabled">p≡p sync folder is enabled</string>
<string name="pep_sync_folder_is_disabled"> p≡p sync folder is disabled, using INBOX</string>
</resources>
\ No newline at end of file
......@@ -350,6 +350,13 @@
android:summaryOn="@string/pep_sync_is_enabled_global"
android:title="@string/pep_sync" />
<SwitchPreferenceCompat
android:key="pep_sync_folder"
android:summaryOff="@string/pep_sync_folder_is_disabled"
android:summaryOn="@string/pep_sync_folder_is_enabled"
android:title="@string/pep_sync_folder"
app:dependency="pep_enable_sync"/>
<PreferenceCategory
android:key="pep_gpg_compatibility"
android:title="@string/pep_gpg_compatibility">
......
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