mirror of https://github.com/M66B/FairEmail.git
Reset folder properties on reselect
This commit is contained in:
parent
419b572759
commit
8cf8e7bc19
|
@ -2138,25 +2138,27 @@ class Core {
|
||||||
String[] attrs = ((IMAPFolder) ifolder.second).getAttributes();
|
String[] attrs = ((IMAPFolder) ifolder.second).getAttributes();
|
||||||
String type = EntityFolder.getType(attrs, fullName, false);
|
String type = EntityFolder.getType(attrs, fullName, false);
|
||||||
if (type != null &&
|
if (type != null &&
|
||||||
!EntityFolder.INBOX.equals(type) &&
|
|
||||||
!EntityFolder.USER.equals(type) &&
|
!EntityFolder.USER.equals(type) &&
|
||||||
!EntityFolder.SYSTEM.equals(type)) {
|
!EntityFolder.SYSTEM.equals(type)) {
|
||||||
for (EntityFolder folder : new ArrayList<>(local.values()))
|
|
||||||
if (type.equals(folder.type) &&
|
// Rename system folders
|
||||||
!fullName.equals(folder.name) &&
|
if (!EntityFolder.INBOX.equals(type))
|
||||||
!local.containsKey(fullName) &&
|
for (EntityFolder folder : new ArrayList<>(local.values()))
|
||||||
!istore.getFolder(folder.name).exists()) {
|
if (type.equals(folder.type) &&
|
||||||
Log.e(account.host +
|
!fullName.equals(folder.name) &&
|
||||||
" renaming " + type + " folder" +
|
!local.containsKey(fullName) &&
|
||||||
" from " + folder.name + " to " + fullName);
|
!istore.getFolder(folder.name).exists()) {
|
||||||
local.remove(folder.name);
|
Log.e(account.host +
|
||||||
local.put(fullName, folder);
|
" renaming " + type + " folder" +
|
||||||
folder.name = fullName;
|
" from " + folder.name + " to " + fullName);
|
||||||
db.folder().setFolderName(folder.id, fullName);
|
local.remove(folder.name);
|
||||||
}
|
local.put(fullName, folder);
|
||||||
|
folder.name = fullName;
|
||||||
|
db.folder().setFolderName(folder.id, fullName);
|
||||||
|
}
|
||||||
|
|
||||||
// Reselect system folders once
|
// Reselect system folders once
|
||||||
String key = "reselected." + account.id + "." + type;
|
String key = "reselected." + type + "." + account.id;
|
||||||
boolean reselected = prefs.getBoolean(key, false);
|
boolean reselected = prefs.getBoolean(key, false);
|
||||||
if (!reselected) {
|
if (!reselected) {
|
||||||
prefs.edit().putBoolean(key, true).apply();
|
prefs.edit().putBoolean(key, true).apply();
|
||||||
|
@ -2164,8 +2166,9 @@ class Core {
|
||||||
if (folder == null) {
|
if (folder == null) {
|
||||||
folder = db.folder().getFolderByName(account.id, fullName);
|
folder = db.folder().getFolderByName(account.id, fullName);
|
||||||
if (folder != null) {
|
if (folder != null) {
|
||||||
Log.e("Reselecting " + account.host + " " + type + "=" + fullName);
|
Log.e("Reselected " + account.host + " " + type + "=" + fullName);
|
||||||
folder.type = type;
|
folder.type = type;
|
||||||
|
folder.setProperties();
|
||||||
db.folder().setFolderType(folder.id, folder.type);
|
db.folder().setFolderType(folder.id, folder.type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue