Don't set default values for special folders

This commit is contained in:
cketti 2018-03-12 00:31:37 +01:00
parent a82cec7010
commit 58ea146185
3 changed files with 15 additions and 30 deletions

View file

@ -321,6 +321,11 @@ public class Account implements BaseAccount, StoreConfig {
isEnabled = true;
markMessageAsReadOnView = true;
alwaysShowCcBcc = false;
archiveFolder = K9.FOLDER_NONE;
draftsFolder = K9.FOLDER_NONE;
sentFolder = K9.FOLDER_NONE;
spamFolder = K9.FOLDER_NONE;
trashFolder = K9.FOLDER_NONE;
searchableFolders = Searchable.ALL;
@ -399,11 +404,11 @@ public class Account implements BaseAccount, StoreConfig {
notifySync = storage.getBoolean(accountUuid + ".notifyMailCheck", false);
deletePolicy = DeletePolicy.fromInt(storage.getInt(accountUuid + ".deletePolicy", DeletePolicy.NEVER.setting));
inboxFolder = storage.getString(accountUuid + ".inboxFolderName", INBOX);
draftsFolder = storage.getString(accountUuid + ".draftsFolderName", "Drafts");
sentFolder = storage.getString(accountUuid + ".sentFolderName", "Sent");
trashFolder = storage.getString(accountUuid + ".trashFolderName", "Trash");
archiveFolder = storage.getString(accountUuid + ".archiveFolderName", "Archive");
spamFolder = storage.getString(accountUuid + ".spamFolderName", "Spam");
draftsFolder = storage.getString(accountUuid + ".draftsFolderName", K9.FOLDER_NONE);
sentFolder = storage.getString(accountUuid + ".sentFolderName", K9.FOLDER_NONE);
trashFolder = storage.getString(accountUuid + ".trashFolderName", K9.FOLDER_NONE);
archiveFolder = storage.getString(accountUuid + ".archiveFolderName", K9.FOLDER_NONE);
spamFolder = storage.getString(accountUuid + ".spamFolderName", K9.FOLDER_NONE);
expungePolicy = getEnumStringPref(storage, accountUuid + ".expungePolicy", Expunge.EXPUNGE_IMMEDIATELY);
syncRemoteDeletions = storage.getBoolean(accountUuid + ".syncRemoteDeletions", true);

View file

@ -5,7 +5,6 @@ package com.fsck.k9.activity.setup;
import java.io.Serializable;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Locale;
import android.app.AlertDialog;
import android.app.Dialog;
@ -320,8 +319,6 @@ public class AccountSetupBasics extends K9Activity
mAccount.setStoreUri(incomingUri.toString());
mAccount.setTransportUri(outgoingUri.toString());
setupFolderNames(incomingUriTemplate.getHost().toLowerCase(Locale.US));
ServerSettings incomingSettings = RemoteStore.decodeStoreUri(incomingUri.toString());
mAccount.setDeletePolicy(AccountCreator.getDefaultDeletePolicy(incomingSettings.type));
@ -415,28 +412,11 @@ public class AccountSetupBasics extends K9Activity
mAccount.setStoreUri(storeUri);
mAccount.setTransportUri(transportUri);
setupFolderNames(domain);
AccountSetupAccountType.actionSelectAccountType(this, mAccount, false);
finish();
}
private void setupFolderNames(String domain) {
mAccount.setDraftsFolder(getString(R.string.special_mailbox_name_drafts));
mAccount.setTrashFolder(getString(R.string.special_mailbox_name_trash));
mAccount.setSentFolder(getString(R.string.special_mailbox_name_sent));
mAccount.setArchiveFolder(getString(R.string.special_mailbox_name_archive));
// Yahoo! has a special folder for Spam, called "Bulk Mail".
if (domain.endsWith(".yahoo.com")) {
mAccount.setSpamFolder("Bulk Mail");
} else {
mAccount.setSpamFolder(getString(R.string.special_mailbox_name_spam));
}
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.next:

View file

@ -51,7 +51,7 @@ public class AccountSettings {
new V(13, new BooleanSetting(false))
));
s.put("archiveFolderName", Settings.versions(
new V(1, new StringSetting("Archive"))
new V(1, new StringSetting(K9.FOLDER_NONE))
));
s.put("autoExpandFolderName", Settings.versions(
new V(1, new StringSetting("INBOX"))
@ -73,7 +73,7 @@ public class AccountSettings {
R.array.account_settings_display_count_values))
));
s.put("draftsFolderName", Settings.versions(
new V(1, new StringSetting("Drafts"))
new V(1, new StringSetting(K9.FOLDER_NONE))
));
s.put("expungePolicy", Settings.versions(
new V(1, new StringResourceSetting(Expunge.EXPUNGE_IMMEDIATELY.name(),
@ -164,7 +164,7 @@ public class AccountSettings {
new V(1, new EnumSetting<>(Searchable.class, Searchable.ALL))
));
s.put("sentFolderName", Settings.versions(
new V(1, new StringSetting("Sent"))
new V(1, new StringSetting(K9.FOLDER_NONE))
));
s.put("sortTypeEnum", Settings.versions(
new V(9, new EnumSetting<>(SortType.class, Account.DEFAULT_SORT_TYPE))
@ -179,7 +179,7 @@ public class AccountSettings {
new V(1, new BooleanSetting(false))
));
s.put("spamFolderName", Settings.versions(
new V(1, new StringSetting("Spam"))
new V(1, new StringSetting(K9.FOLDER_NONE))
));
s.put("stripSignature", Settings.versions(
new V(2, new BooleanSetting(Account.DEFAULT_STRIP_SIGNATURE))
@ -191,7 +191,7 @@ public class AccountSettings {
new V(1, new BooleanSetting(true))
));
s.put("trashFolderName", Settings.versions(
new V(1, new StringSetting("Trash"))
new V(1, new StringSetting(K9.FOLDER_NONE))
));
s.put("useCompression.MOBILE", Settings.versions(
new V(1, new BooleanSetting(true))