Preserve header order (with the exception of duplicate headers like

"received" they all show up where the first one did
This commit is contained in:
Jesse Vincent 2011-11-14 23:32:46 -05:00
parent c642b10b39
commit a8ef6594ec
3 changed files with 4 additions and 4 deletions

View File

@ -64,7 +64,7 @@ public class MimeHeader {
}
public Set<String> getHeaderNames() {
Set<String> names = new HashSet<String>();
Set<String> names = new LinkedHashSet<String>();
for (Field field : mFields) {
names.add(field.name);
}

View File

@ -1779,7 +1779,7 @@ public class LocalStore extends Store implements Serializable {
}
cursor = db.rawQuery(
"SELECT message_id, name, value FROM headers " + "WHERE message_id in ( " + questions + ") ",
"SELECT message_id, name, value FROM headers " + "WHERE message_id in ( " + questions + ") ORDER BY id ASC",
ids.toArray(EMPTY_STRING_ARRAY));

View File

@ -26,7 +26,7 @@ import com.fsck.k9.mail.Message;
import com.fsck.k9.mail.MessagingException;
import com.fsck.k9.mail.internet.MimeUtility;
import com.fsck.k9.mail.store.LocalStore;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@ -256,7 +256,7 @@ public class MessageHeader extends LinearLayout {
* message view header. But do show "From", "To", and "Cc" again.
* This time including the email addresses. See issue 1805.
*/
Set<String> headerNames = new HashSet<String>(message.getHeaderNames());
Set<String> headerNames = new LinkedHashSet<String>(message.getHeaderNames());
headerNames.remove("Subject");
for (String headerName : headerNames) {
String[] headerValues = message.getHeader(headerName);