mirror of https://github.com/M66B/FairEmail.git
parent
87ead339f9
commit
f74adb7b25
|
@ -76,6 +76,7 @@ public class EntityFolder implements Parcelable {
|
|||
static final String TRASH = "Trash";
|
||||
static final String JUNK = "Junk";
|
||||
static final String SENT = "Sent";
|
||||
static final String SYSTEM = "System";
|
||||
static final String USER = "User";
|
||||
|
||||
static final List<String> SYSTEM_FOLDER_ATTR = Arrays.asList(
|
||||
|
@ -83,14 +84,18 @@ public class EntityFolder implements Parcelable {
|
|||
"Drafts",
|
||||
"Trash",
|
||||
"Junk",
|
||||
"Sent"
|
||||
"Sent",
|
||||
"Important",
|
||||
"Flagged"
|
||||
);
|
||||
static final List<String> SYSTEM_FOLDER_TYPE = Arrays.asList(
|
||||
ARCHIVE,
|
||||
DRAFTS,
|
||||
TRASH,
|
||||
JUNK,
|
||||
SENT
|
||||
SENT,
|
||||
SYSTEM,
|
||||
SYSTEM
|
||||
); // MUST match SYSTEM_FOLDER_ATTR
|
||||
|
||||
static final List<String> FOLDER_SORT_ORDER = Arrays.asList(
|
||||
|
@ -101,6 +106,7 @@ public class EntityFolder implements Parcelable {
|
|||
ARCHIVE,
|
||||
TRASH,
|
||||
JUNK,
|
||||
SYSTEM,
|
||||
USER
|
||||
);
|
||||
|
||||
|
|
|
@ -310,6 +310,7 @@ public class FragmentFolder extends FragmentEx {
|
|||
// Consider previous save as cancelled
|
||||
pbWait.setVisibility(View.GONE);
|
||||
Helper.setViewsEnabled(view, true);
|
||||
etRename.setEnabled(folder == null || EntityFolder.USER.equals(folder.type));
|
||||
btnSave.setEnabled(true);
|
||||
ibDelete.setEnabled(true);
|
||||
ibDelete.setVisibility(folder == null ? View.GONE : View.VISIBLE);
|
||||
|
|
|
@ -1239,17 +1239,23 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
for (Folder ifolder : ifolders) {
|
||||
String[] attrs = ((IMAPFolder) ifolder).getAttributes();
|
||||
boolean system = false;
|
||||
boolean selectable = true;
|
||||
for (String attr : attrs) {
|
||||
if ("\\Noselect".equals(attr)) { // TODO: is this attribute correct?
|
||||
selectable = false;
|
||||
break;
|
||||
}
|
||||
if (attr.startsWith("\\"))
|
||||
if (EntityFolder.SYSTEM_FOLDER_ATTR.contains(attr.substring(1))) {
|
||||
selectable = false;
|
||||
if (attr.startsWith("\\")) {
|
||||
attr = attr.substring(1);
|
||||
if (EntityFolder.SYSTEM_FOLDER_ATTR.contains(attr)) {
|
||||
int index = EntityFolder.SYSTEM_FOLDER_ATTR.indexOf(attr);
|
||||
system = EntityFolder.SYSTEM.equals(EntityFolder.SYSTEM_FOLDER_TYPE.get(index));
|
||||
if (!system)
|
||||
selectable = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selectable) {
|
||||
|
@ -1259,13 +1265,16 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
folder = new EntityFolder();
|
||||
folder.account = account.id;
|
||||
folder.name = ifolder.getFullName();
|
||||
folder.type = EntityFolder.USER;
|
||||
folder.type = (system ? EntityFolder.SYSTEM : EntityFolder.USER);
|
||||
folder.synchronize = false;
|
||||
folder.after = EntityFolder.DEFAULT_USER_SYNC;
|
||||
db.folder().insertFolder(folder);
|
||||
Log.i(Helper.TAG, folder.name + " added");
|
||||
} else
|
||||
} else {
|
||||
if (system)
|
||||
db.folder().setFolderType(folder.id, EntityFolder.SYSTEM);
|
||||
names.remove(folder.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -145,6 +145,7 @@
|
|||
<string name="title_folder_trash">Trash</string>
|
||||
<string name="title_folder_junk">Spam</string>
|
||||
<string name="title_folder_sent">Sent</string>
|
||||
<string name="title_folder_system">System</string>
|
||||
<string name="title_folder_user">User</string>
|
||||
<string name="title_folder_primary">Folders primary account</string>
|
||||
<string name="title_folder_thread">Conversation</string>
|
||||
|
|
Loading…
Reference in New Issue